[FFmpeg-cvslog] avcodec/mpegvideo_enc: Move MPEG-4 specific check to mpeg4videoenc.c
Andreas Rheinhardt
git at videolan.org
Wed Mar 26 06:09:16 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Mar 2 02:20:03 2025 +0100| [d9dea7088dca4aa809bd8a717b55788371cd68cd] | committer: Andreas Rheinhardt
avcodec/mpegvideo_enc: Move MPEG-4 specific check to mpeg4videoenc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9dea7088dca4aa809bd8a717b55788371cd68cd
---
libavcodec/mpeg4videoenc.c | 9 +++++++++
libavcodec/mpegvideo_enc.c | 10 ----------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 18f97bb81d..c265316ed6 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1305,6 +1305,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
ff_thread_once(&init_static_once, mpeg4_encode_init_static);
+ if (avctx->time_base.den > (1 << 16) - 1) {
+ av_log(avctx, AV_LOG_ERROR,
+ "timebase %d/%d not supported by MPEG 4 standard, "
+ "the maximum admitted value for the timebase denominator "
+ "is %d\n", avctx->time_base.num, avctx->time_base.den,
+ (1 << 16) - 1);
+ return AVERROR(EINVAL);
+ }
+
m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
s->fcode_tab = fcode_tab + MAX_MV;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ab67f5444d..0a9c18ff79 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -737,16 +737,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "intra_quant_bias = %d inter_quant_bias = %d\n",s->intra_quant_bias,s->inter_quant_bias);
- if (avctx->codec_id == AV_CODEC_ID_MPEG4 &&
- avctx->time_base.den > (1 << 16) - 1) {
- av_log(avctx, AV_LOG_ERROR,
- "timebase %d/%d not supported by MPEG 4 standard, "
- "the maximum admitted value for the timebase denominator "
- "is %d\n", avctx->time_base.num, avctx->time_base.den,
- (1 << 16) - 1);
- return AVERROR(EINVAL);
- }
-
switch (avctx->codec->id) {
#if CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER
case AV_CODEC_ID_MPEG2VIDEO:
More information about the ffmpeg-cvslog
mailing list