[FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size
Aaron Boxer
boxerab at gmail.com
Fri Aug 4 19:49:45 EEST 2017
On Fri, Aug 4, 2017 at 12:23 PM, Francesco, Cuzzocrea <
francesco at 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, <francesco at bltitalia.com> wrote:
>>>
>>> From: Francesco Cuzzocrea <francesco at 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.
>>>
>>>
>>> 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 at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>>
> --
> /*******************************************************************\
> * Ing. Francesco Cuzzocrea
> * company: BLT Italia srl web: 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: francesco at bltitalia.com
> \*******************************************************************/
> -- BLT will be at IBC (15~19 September 2017) - Hall 8, Stand 8.A69 --
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list