[FFmpeg-cvslog] avcodec/mpegvideo: Don't set [bf]_code for non-MPEG-4 decoders
Andreas Rheinhardt
git at videolan.org
Sat Mar 29 03:06:59 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Mar 25 04:22:27 2025 +0100| [116fd73143e13b0bd7d696c7918503ad2ce3ae21] | committer: Andreas Rheinhardt
avcodec/mpegvideo: Don't set [bf]_code for non-MPEG-4 decoders
It is only used by encoders and the MPEG-4 decoder.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=116fd73143e13b0bd7d696c7918503ad2ce3ae21
---
libavcodec/flvdec.c | 2 --
libavcodec/intelh263dec.c | 1 -
libavcodec/ituh263dec.c | 1 -
libavcodec/mpeg4videodec.c | 8 ++++----
libavcodec/mpegvideo.c | 3 ---
libavcodec/mpegvideo_enc.c | 3 +++
libavcodec/rv10.c | 2 --
7 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index f4bfd99417..627538ef83 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -97,8 +97,6 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA;
- s->f_code = 1;
-
if (s->ehc_mode)
s->avctx->sample_aspect_ratio= (AVRational){1,2};
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index 4efae7938c..374dfdc0de 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -118,7 +118,6 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
/* PEI */
if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA;
- s->f_code = 1;
ff_h263_show_pict_info(s);
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index d451a35da8..6c9c2583e3 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -1353,7 +1353,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
return -1;
}
}
- s->f_code = 1;
if (s->pict_type == AV_PICTURE_TYPE_B)
s->low_delay = 0;
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index cb32f0e300..e21f1d24a2 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3329,6 +3329,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
}
}
+ s->f_code = 1;
+ s->b_code = 1;
if (ctx->shape != BIN_ONLY_SHAPE) {
s->chroma_qscale = s->qscale = get_bits(gb, ctx->quant_precision);
if (s->qscale == 0) {
@@ -3345,8 +3347,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
s->f_code = 1;
return AVERROR_INVALIDDATA; // makes no sense to continue, as there is nothing left from the image then
}
- } else
- s->f_code = 1;
+ }
if (s->pict_type == AV_PICTURE_TYPE_B) {
s->b_code = get_bits(gb, 3);
@@ -3356,8 +3357,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
s->b_code=1;
return AVERROR_INVALIDDATA; // makes no sense to continue, as the MV decoding will break very quickly
}
- } else
- s->b_code = 1;
+ }
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
av_log(s->avctx, AV_LOG_DEBUG,
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 794b2d0f66..d09eb1211d 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -236,9 +236,6 @@ av_cold void ff_mpv_common_defaults(MpegEncContext *s)
s->picture_number = 0;
- s->f_code = 1;
- s->b_code = 1;
-
s->slice_context_count = 1;
}
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 3d67df8d73..02255fdaed 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -285,6 +285,9 @@ static av_cold void mpv_encode_defaults(MPVMainEncContext *const m)
ff_mpv_common_defaults(&s->c);
+ s->c.f_code = 1;
+ s->c.b_code = 1;
+
if (!m->fcode_tab) {
m->fcode_tab = default_fcode_tab + MAX_MV;
ff_thread_once(&init_static_once, mpv_encode_init_static);
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 753c6c6cb3..d8df7e8612 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -150,7 +150,6 @@ static int rv10_decode_picture_header(MpegEncContext *s)
mb_count = s->mb_width * s->mb_height;
}
skip_bits(&s->gb, 3); /* ignored */
- s->f_code = 1;
return mb_count;
}
@@ -284,7 +283,6 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size)
// binary decoder reads 3+2 bits here but they don't seem to be used
skip_bits(&s->gb, 5);
- s->f_code = 1;
s->h263_aic = s->pict_type == AV_PICTURE_TYPE_I;
s->modified_quant = 1;
if (!s->avctx->lowres)
More information about the ffmpeg-cvslog
mailing list