On Thu, Aug 03, 2017 at 03:58:22PM +0200, france...@bltitalia.com wrote:
> From: Francesco Cuzzocrea <france...@bltitalia.com>
> 
> Hi to all
> I've made some simple changes tha allow encoding with variable codeblock
> size.  Default value are the same as previous (16X16) but now setting them
> to 64x128 make generated codestream compatible with Analog Devices ADV212
> video codec.
> 
> 
> ---
>  libavcodec/j2kenc.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
> index c8d3861..1bd4fbd 100644
> --- a/libavcodec/j2kenc.c
> +++ b/libavcodec/j2kenc.c
> @@ -1178,17 +1178,21 @@ static int j2kenc_destroy(AVCodecContext *avctx)
>  // taken from the libopenjpeg wraper so it matches
>  
>  #define OFFSET(x) offsetof(Jpeg2000EncoderContext, x)
> +#define OFFSET1(x) offsetof(Jpeg2000CodingStyle, x)
> +
> +
>  #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
>  static const AVOption options[] = {
> -    { "format",        "Codec Format",      OFFSET(format),        
> AV_OPT_TYPE_INT,   { .i64 = CODEC_JP2   }, CODEC_J2K, CODEC_JP2,   VE, 
> "format"      },
> -    { "j2k",           NULL,                0,                     
> AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K   }, 0,         0,           VE, 
> "format"      },
> -    { "jp2",           NULL,                0,                     
> AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2   }, 0,         0,           VE, 
> "format"      },
> -    { "tile_width",    "Tile Width",        OFFSET(tile_width),    
> AV_OPT_TYPE_INT,   { .i64 = 256         }, 1,     1<<30,           VE, },
> -    { "tile_height",   "Tile Height",       OFFSET(tile_height),   
> AV_OPT_TYPE_INT,   { .i64 = 256         }, 1,     1<<30,           VE, },
> -    { "pred",          "DWT Type",          OFFSET(pred),          
> AV_OPT_TYPE_INT,   { .i64 = 0           }, 0,         1,           VE, "pred" 
>        },
> -    { "dwt97int",      NULL,                0,                     
> AV_OPT_TYPE_CONST, { .i64 = 0           }, INT_MIN, INT_MAX,       VE, "pred" 
>        },
> -    { "dwt53",         NULL,                0,                     
> AV_OPT_TYPE_CONST, { .i64 = 0           }, INT_MIN, INT_MAX,       VE, "pred" 
>        },
> -
> +    { "format",           "Codec Format",       OFFSET(format),              
>                  AV_OPT_TYPE_INT,   { .i64 = CODEC_JP2   }, CODEC_J2K, 
> CODEC_JP2,   VE, "format"      },
> +    { "j2k",               NULL,                0,                           
>                  AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K   }, 0,         0,     
>       VE, "format"      },
> +    { "jp2",               NULL,                0,                           
>                  AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2   }, 0,         0,     
>       VE, "format"      },
> +    { "tile_width",        "Tile Width",        OFFSET(tile_width),          
>                  AV_OPT_TYPE_INT,   { .i64 = 256         }, 1,     1<<30,     
>       VE, },
> +    { "tile_height",       "Tile Height",       OFFSET(tile_height),         
>                  AV_OPT_TYPE_INT,   { .i64 = 256         }, 1,     1<<30,     
>       VE, },
> +    { "pred",              "DWT Type",          OFFSET(pred),                
>                  AV_OPT_TYPE_INT,   { .i64 = 0           }, 0,         1,     
>       VE, "pred"        },
> +    { "dwt97int",          NULL,                0,                           
>                  AV_OPT_TYPE_CONST, { .i64 = 0           }, INT_MIN, INT_MAX, 
>       VE, "pred"        },
> +    { "dwt53",             NULL,                0,                           
>                  AV_OPT_TYPE_CONST, { .i64 = 0           }, INT_MIN, INT_MAX, 
>       VE, "pred"        },

> +    { "log2_cblk_width",   "Codeblock Width",   
> (OFFSET(codsty)+OFFSET1(log2_cblk_width)),    AV_OPT_TYPE_INT,   { .i64 = 4   
>         }, 1,     1<<30,           VE, },
> +    { "log2_cblk_height",  "Codeblock Height",  
> (OFFSET(codsty)+OFFSET1(log2_cblk_height)),   AV_OPT_TYPE_INT,   { .i64 = 4   
>         }, 1,     1<<30,           VE, },

OFFSET(codsty.log2_cblk_width) is more robust than adding offsets
the maximum also is certainly not 2^(2^30)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to