From 950930b461cef025152de406f816a3b2efffb540 Mon Sep 17 00:00:00 2001 From: Joseph Artsimovich Date: Tue, 7 Feb 2012 15:47:23 +0000 Subject: [PATCH] Set default qmax for VC-3/DNxHD to 1024 (maximum allowed by VC-3 spec). Also increase the global limit on qmax. Signed-off-by: Michael Niedermayer --- libavcodec/dnxhdenc.c | 7 +++++++ libavcodec/options.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index e4c6274ae4..8045da2399 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -32,6 +32,7 @@ #include "mpegvideo.h" #include "mpegvideo_common.h" #include "dnxhdenc.h" +#include "internal.h" #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM #define DNX10BIT_QMAT_SHIFT 18 // The largest value that will not lead to overflow for 10bit samples. @@ -990,6 +991,11 @@ static int dnxhd_encode_end(AVCodecContext *avctx) return 0; } +static const AVCodecDefault dnxhd_defaults[] = { + { "qmax", "1024" }, /* Maximum quantization scale factor allowed for VC-3 */ + { NULL }, +}; + AVCodec ff_dnxhd_encoder = { .name = "dnxhd", .type = AVMEDIA_TYPE_VIDEO, @@ -1002,4 +1008,5 @@ AVCodec ff_dnxhd_encoder = { .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_YUV422P10, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), .priv_class = &class, + .defaults = dnxhd_defaults, }; diff --git a/libavcodec/options.c b/libavcodec/options.c index d154da765b..a5b36976c3 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -133,7 +133,7 @@ static const AVOption options[]={ {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -FLT_MAX, FLT_MAX, V|E}, {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -1, FLT_MAX, V|E}, {"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.dbl = 2 }, -1, 69, V|E}, -{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.dbl = 31 }, -1, 69, V|E}, +{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.dbl = 31 }, -1, 1024, V|E}, {"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.dbl = 3 }, INT_MIN, INT_MAX, V|E}, {"bf", "use 'frames' B frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, -1, FF_MAX_B_FRAMES, V|E}, {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},