Deprecate CODEC_FLAG2_NON_LINEAR_QUANTtags/n0.9
| @@ -625,7 +625,9 @@ typedef struct RcOverride{ | |||||
| #endif | #endif | ||||
| #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping | #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. | #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. | #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_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_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) | ||||
| #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. | #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. | ||||
| @@ -934,9 +934,18 @@ static void mpeg1_encode_block(MpegEncContext *s, | |||||
| #define OFFSET(x) offsetof(MpegEncContext, x) | #define OFFSET(x) offsetof(MpegEncContext, x) | ||||
| #define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | #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}, | { "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 }, | { NULL }, | ||||
| }; | }; | ||||
| @@ -944,7 +953,7 @@ static const AVOption options[] = { | |||||
| static const AVClass mpeg## x ##_class = {\ | static const AVClass mpeg## x ##_class = {\ | ||||
| .class_name = "mpeg" #x "video encoder",\ | .class_name = "mpeg" #x "video encoder",\ | ||||
| .item_name = av_default_item_name,\ | .item_name = av_default_item_name,\ | ||||
| .option = options,\ | |||||
| .option = mpeg## x ##_options,\ | |||||
| .version = LIBAVUTIL_VERSION_INT,\ | .version = LIBAVUTIL_VERSION_INT,\ | ||||
| }; | }; | ||||
| @@ -338,8 +338,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) | |||||
| s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); | s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); | ||||
| #if FF_API_MPEGVIDEO_GLOBAL_OPTS | #if FF_API_MPEGVIDEO_GLOBAL_OPTS | ||||
| s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); | s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); | ||||
| #endif | |||||
| s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); | s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); | ||||
| #endif | |||||
| if(avctx->rc_max_rate && !avctx->rc_buffer_size){ | 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"); | 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(s->q_scale_type == 1){ | ||||
| #if FF_API_MPEGVIDEO_GLOBAL_OPTS | |||||
| if(s->codec_id != CODEC_ID_MPEG2VIDEO){ | if(s->codec_id != CODEC_ID_MPEG2VIDEO){ | ||||
| av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); | av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| #endif | |||||
| if(avctx->qmax > 12){ | if(avctx->qmax > 12){ | ||||
| av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); | av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); | ||||
| return -1; | return -1; | ||||
| @@ -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}, | {"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 | #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"}, | {"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"}, | {"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 | #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}, | {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D}, | ||||
| #endif | #endif | ||||