[FFmpeg-cvslog] avcodec/mpeg_er: Don't use MpegEncContext.block

Andreas Rheinhardt git at videolan.org
Thu Jul 3 21:55:21 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jun 15 22:31:58 2025 +0200| [4fc874ef0813d39983f9b634cec42798aa94b57a] | committer: Andreas Rheinhardt

avcodec/mpeg_er: Don't use MpegEncContext.block

It is unused (because unquantizing/the idct has been disabled)
apart from FF_DEBUG_DCT_COEFF debug code which makes no sense
when this function is called via error resilience. So pass a NULL
as block when calling ff_mpv_reconstruct_mb() from mpeg_er_decode_mb()
and disable the debug code in this scenario.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fc874ef0813d39983f9b634cec42798aa94b57a
---

 libavcodec/mpeg_er.c       | 4 ++--
 libavcodec/mpegvideo_dec.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c
index 6ac3e7b3e7..951167a478 100644
--- a/libavcodec/mpeg_er.c
+++ b/libavcodec/mpeg_er.c
@@ -76,7 +76,7 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
     s->mcsel      = 0;
     memcpy(s->mv, mv, sizeof(*mv));
 
-    // The following disables the IDCT.
+    // The following disables unquantizing and the IDCT.
     for (size_t i = 0; i < FF_ARRAY_ELEMS(s->block_last_index); i++)
         s->block_last_index[i] = -1;
 
@@ -93,7 +93,7 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
     if (ref)
         av_log(s->avctx, AV_LOG_DEBUG,
                "Interlaced error concealment is not fully implemented\n");
-    ff_mpv_reconstruct_mb(s, s->block);
+    ff_mpv_reconstruct_mb(s, NULL);
 }
 
 av_cold int ff_mpeg_er_init(MpegEncContext *s)
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 903d435e8c..928464d6c1 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -1066,6 +1066,9 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64],
 
 static av_cold void debug_dct_coeffs(MPVContext *s, const int16_t block[][64])
 {
+    if (!block) // happens when called via error resilience
+        return;
+
     void *const logctx = s->avctx;
     const uint8_t *const idct_permutation = s->idsp.idct_permutation;
 



More information about the ffmpeg-cvslog mailing list