[FFmpeg-devel] libopenjpegenc initialization

Aaron Boxer boxerab at gmail.com
Mon Mar 6 04:19:39 EET 2017


Dear Developers,

I have a few questions about the following code in libopenjpegenc.c :

    ctx->enc_params.mode = !!avctx->global_quality;
    ctx->enc_params.prog_order = ctx->prog_order;
    ctx->enc_params.numresolution = ctx->numresolution;
    ctx->enc_params.cp_disto_alloc = ctx->disto_alloc;
    ctx->enc_params.cp_fixed_alloc = ctx->fixed_alloc;
    ctx->enc_params.cp_fixed_quality = ctx->fixed_quality;
    ctx->enc_params.tcp_numlayers = ctx->numlayers;
    ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;

First of all, the mode flag in the enc_params refers to various JPEG 2000
modes that affect how the MQ arithmetic
coder operates, and is not directly connected to global_quality, so I think
the mode should always be set to 0.

Secondly, cp_disto_alloc,cp_fixed_alloc and cp_fixed_quality specify how
the quality layers are formed, and to function correctly,
they would need another list of numbers, one per quality layer, or one per
bit plane in the case of  cp_fixed_alloc. As it doesn't seem possible to
set this list of numbers, I think the encoder should stick to a single
quality layer, and remove the corresponding flags from the context.

See here https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec for more
info on how quality layers are specified in OpenJPEG.

Also, there doesn't seem to be any way of setting lossy vs. lossless
encoding.

Kind Regards,
Aaron


More information about the ffmpeg-devel mailing list