diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-26 17:34:37 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-07-01 00:01:46 -0300 |
commit | 96f5019bde0f6719133a36433fec465b8538df25 (patch) | |
tree | 7c70e2177ef35b46d74d2323eddd0cc8cf1c0a50 | |
parent | bffe1c42220f0f5622239c365df06db8bd141504 (diff) | |
download | android_external_ffmpeg-96f5019bde0f6719133a36433fec465b8538df25.tar.gz android_external_ffmpeg-96f5019bde0f6719133a36433fec465b8538df25.tar.bz2 android_external_ffmpeg-96f5019bde0f6719133a36433fec465b8538df25.zip |
avcodec/libopenjpegenc: Set numresolutions by default to a value that is not too large
Fixes issues with libopenjpeg 2.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e9394ca63dab3434bc8e869de019ecd86cb604ac)
-rw-r--r-- | libavcodec/libopenjpegenc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index b67c320b2f..058ca363c8 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -352,6 +352,12 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) ctx->enc_params.cp_cinema = ctx->cinema_mode; #endif + if (!ctx->numresolution) { + ctx->numresolution = 6; + while (FFMIN(avctx->width, avctx->height) >> ctx->numresolution < 1) + ctx->numresolution --; + } + ctx->enc_params.mode = !!avctx->global_quality; ctx->enc_params.prog_order = ctx->prog_order; ctx->enc_params.numresolution = ctx->numresolution; @@ -814,7 +820,7 @@ static const AVOption options[] = { { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RPCL) }, 0, 0, VE, "prog_order" }, { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(PCRL) }, 0, 0, VE, "prog_order" }, { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CPRL) }, 0, 0, VE, "prog_order" }, - { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, INT_MAX, VE }, + { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 10, VE }, { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, |