From 42d9b10beb87570269ca1470682e6b688cba3208 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 28 Feb 2025 00:05:28 +0100 Subject: [PATCH 28/40] avcodec/mpegvideo_enc: Move q_scale_type check to mpeg12enc.c The MPEG-2 encoder is the only encoder supporting q_scale_type. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12enc.c | 8 ++++++++ libavcodec/mpegvideo_enc.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 52264ac6a0..90baf1ed95 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -201,6 +201,14 @@ static av_cold int encode_init(AVCodecContext *avctx) } } + if (mpeg12->mpeg.q_scale_type == 1) { + if (avctx->qmax > 28) { + av_log(avctx, AV_LOG_ERROR, + "non linear quant only supports qmax <= 28 currently\n"); + return AVERROR_PATCHWELCOME; + } + } + if (avctx->profile == AV_PROFILE_UNKNOWN) { if (avctx->level != AV_LEVEL_UNKNOWN) { av_log(avctx, AV_LOG_ERROR, "Set profile and level\n"); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 5eea676dd4..da9247ec25 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -705,14 +705,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) } } - if (s->q_scale_type == 1) { - if (avctx->qmax > 28) { - av_log(avctx, AV_LOG_ERROR, - "non linear quant only supports qmax <= 28 currently\n"); - return AVERROR_PATCHWELCOME; - } - } - if (avctx->slices > 1 && !(avctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS)) { av_log(avctx, AV_LOG_ERROR, "Multiple slices are not supported by this codec\n"); -- 2.45.2