diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-27 09:57:36 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-08-31 13:21:59 +0200 |
commit | 88262ca87df1054209ef6db255b521e412fd78fc (patch) | |
tree | 65624e7716e57ba6873c470380c3a5dd8f1cca31 /libavcodec | |
parent | 2c5e1efc093084f1cb4e55b8c06c267801828965 (diff) | |
download | ffmpeg-88262ca87df1054209ef6db255b521e412fd78fc.tar.gz |
mpeg2enc: add 'non_linear_quant' private option
Deprecate CODEC_FLAG2_NON_LINEAR_QUANT
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 2 | ||||
-rw-r--r-- | libavcodec/mpeg12enc.c | 15 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 4 | ||||
-rw-r--r-- | libavcodec/options.c | 2 |
4 files changed, 18 insertions, 5 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5791911a2f..f8a8006c89 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -625,7 +625,9 @@ typedef struct RcOverride{ #endif #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. +#if FF_API_MPEGVIDEO_GLOBAL_OPTS #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer. +#endif #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index dd433215f3..30afa2eb46 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -934,9 +934,18 @@ static void mpeg1_encode_block(MpegEncContext *s, #define OFFSET(x) offsetof(MpegEncContext, x) #define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM -static const AVOption options[] = { - { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, +#define COMMON_OPTS\ + { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE },\ { "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE}, + +static const AVOption mpeg1_options[] = { + COMMON_OPTS + { NULL }, +}; + +static const AVOption mpeg2_options[] = { + COMMON_OPTS + { "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, { NULL }, }; @@ -944,7 +953,7 @@ static const AVOption options[] = { static const AVClass mpeg## x ##_class = {\ .class_name = "mpeg" #x "video encoder",\ .item_name = av_default_item_name,\ - .option = options,\ + .option = mpeg## x ##_options,\ .version = LIBAVUTIL_VERSION_INT,\ }; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 42fd6609c9..1f8f9f49d6 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -338,8 +338,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); #if FF_API_MPEGVIDEO_GLOBAL_OPTS s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); -#endif s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); +#endif if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); @@ -463,10 +463,12 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) } if(s->q_scale_type == 1){ +#if FF_API_MPEGVIDEO_GLOBAL_OPTS if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } +#endif if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; diff --git a/libavcodec/options.c b/libavcodec/options.c index 5231cb4c53..b9918819b1 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -423,8 +423,8 @@ static const AVOption options[]={ {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, V|E}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_DROP_FRAME_TIMECODE }, INT_MIN, INT_MAX, V|E, "flags2"}, -#endif {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NON_LINEAR_QUANT }, INT_MIN, INT_MAX, V|E, "flags2"}, +#endif #if FF_API_REQUEST_CHANNELS {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D}, #endif |