avcodec/mpegvideo: Deprecate mpeg_quant option for codecs != MPEG-4

mpeg_quant may only be set for MPEG-4 and MPEG-2, yet for the latter
it is no option as the code acts as if it were always set.
So deprecate the option for all codecs for which it makes no sense.

Furthermore, given that the code already errors out if the option is set
for a codec that doesn't support it we can restrict the range of
the option for all these codecs without breaking something. This means
that the checks for whether mpeg_quant is set for these codecs can be
removed as soon as AVCodecContext.mpeg_quant is removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-04-06 17:20:57 +02:00
parent dff774042a
commit 42c895ef5c
6 changed files with 31 additions and 4 deletions

View file

@ -86,6 +86,9 @@ static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
const AVOption ff_mpv_generic_options[] = {
FF_MPV_COMMON_OPTS
#if FF_API_MPEGVIDEO_OPTS
FF_MPV_DEPRECATED_MPEG_QUANT_OPT
#endif
{ NULL },
};
@ -560,15 +563,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (avctx->mpeg_quant)
s->mpeg_quant = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
// FIXME mpeg2 uses that too
if (s->mpeg_quant && ( s->codec_id != AV_CODEC_ID_MPEG4
&& s->codec_id != AV_CODEC_ID_MPEG2VIDEO)) {
av_log(avctx, AV_LOG_ERROR,
"mpeg2 style quantization not supported by codec\n");
return AVERROR(EINVAL);
}
#endif
if ((s->mpv_flags & FF_MPV_FLAG_CBP_RD) && !avctx->trellis) {
av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
@ -4708,6 +4710,9 @@ static const AVOption h263_options[] = {
{ "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "mb_info", "emit macroblock info for RFC 2190 packetization, the parameter value is the maximum payload size", OFFSET(mb_info), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
FF_MPV_COMMON_OPTS
#if FF_API_MPEGVIDEO_OPTS
FF_MPV_DEPRECATED_MPEG_QUANT_OPT
#endif
{ NULL },
};
@ -4738,6 +4743,9 @@ static const AVOption h263p_options[] = {
{ "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "structured_slices", "Write slice start position at every GOB header instead of just GOB number.", OFFSET(h263_slice_structured), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
FF_MPV_COMMON_OPTS
#if FF_API_MPEGVIDEO_OPTS
FF_MPV_DEPRECATED_MPEG_QUANT_OPT
#endif
{ NULL },
};
static const AVClass h263p_class = {