Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-04 Thread Aaron Boxer
On Fri, Aug 4, 2017 at 12:23 PM, Francesco, Cuzzocrea <
france...@bltitalia.com> wrote:

> Sorry. I intend 32x128



OK, that sounds better :)




>
>
> On 04/08/2017 10.21, Francesco, Cuzzocrea wrote:
>
>> The standard ISO/IEC FCD15444-1 specify limits for the exponent values
>> and their sum. That is codeblock
>>
>> size xcb and ycb are defined as:
>>
>> xcb = 2^(xvalue+2)  and ycb = 2^(yvalue+2)
>>
>> with values that ranges from a minimum of 2 and a maximum of 10. Moreover
>>
>> the sum should be less or equal to 12 ( xvalue + yvalue <=12). So 64x128
>> are allowed because
>>
>> xvalue = 4 and yvalue = 5.
>>
>>
>>
>> On 03/08/2017 19.24, Aaron Boxer wrote:
>>
>>> On Aug 3, 2017 9:58 AM,  wrote:
>>>
>>> From: Francesco Cuzzocrea 
>>>
>>> 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.
>>>
>>>
>>> Interesting - as far as I  aware, part 1 of standard only allows
>>> codeblock
>>> of max size 4096, so 64x128 would not be legal.
>>>
>>>
>>>
>>> ---
>>>   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, },
>>>   { NULL }
>>>   };
>>>
>>> --
>>> 2.1.4
>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> 

Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-04 Thread Francesco, Cuzzocrea

Sorry. I intend 32x128


On 04/08/2017 10.21, Francesco, Cuzzocrea wrote:
The standard ISO/IEC FCD15444-1 specify limits for the exponent values 
and their sum. That is codeblock


size xcb and ycb are defined as:

xcb = 2^(xvalue+2)  and ycb = 2^(yvalue+2)

with values that ranges from a minimum of 2 and a maximum of 10. Moreover

the sum should be less or equal to 12 ( xvalue + yvalue <=12). So 
64x128 are allowed because


xvalue = 4 and yvalue = 5.



On 03/08/2017 19.24, Aaron Boxer wrote:

On Aug 3, 2017 9:58 AM,  wrote:

From: Francesco Cuzzocrea 

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.


Interesting - as far as I  aware, part 1 of standard only allows 
codeblock

of max size 4096, so 64x128 would not be legal.



---
  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, },
  { NULL }
  };

--
2.1.4

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




--
/***\
*Ing. Francesco  Cuzzocrea
*company:BLT Italia srlweb:  http://www.blt.it
*address:via Rosselli, 91 city:  Lido di CAMAIORE
*country:ITALY zip:  55043-i
*  Tel. :+39 0584 904788   Fax:  +39 0584 904789
* e-mail:   

Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-04 Thread Francesco, Cuzzocrea
The standard ISO/IEC FCD15444-1 specify limits for the exponent values 
and their sum. That is codeblock


size xcb and ycb are defined as:

xcb = 2^(xvalue+2)  and ycb = 2^(yvalue+2)

with values that ranges from a minimum of 2 and a maximum of 10. Moreover

the sum should be less or equal to 12 ( xvalue + yvalue <=12). So 64x128 
are allowed because


xvalue = 4 and yvalue = 5.



On 03/08/2017 19.24, Aaron Boxer wrote:

On Aug 3, 2017 9:58 AM,  wrote:

From: Francesco Cuzzocrea 

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.


Interesting - as far as I  aware, part 1 of standard only allows codeblock
of max size 4096, so 64x128 would not be legal.



---
  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, },
  { NULL }
  };

--
2.1.4

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


--
/***\
*Ing. Francesco  Cuzzocrea
*company:BLT Italia srlweb:  http://www.blt.it
*address:via Rosselli, 91 city:  Lido di CAMAIORE
*country:ITALY zip:  55043-i
*  Tel. :+39 0584 904788   Fax:  +39 0584 904789
* e-mail:   france...@bltitalia.com

Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-03 Thread Michael Niedermayer
On Thu, Aug 03, 2017 at 03:58:22PM +0200, france...@bltitalia.com wrote:
> From: Francesco Cuzzocrea 
> 
> 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.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-03 Thread Aaron Boxer
On Aug 3, 2017 9:58 AM,  wrote:

From: Francesco Cuzzocrea 

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.


Interesting - as far as I  aware, part 1 of standard only allows codeblock
of max size 4096, so 64x128 would not be legal.



---
 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, },
 { NULL }
 };

--
2.1.4

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


[FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size

2017-08-03 Thread francesco
From: Francesco Cuzzocrea 

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, },
 { NULL }
 };
 
-- 
2.1.4

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