[FFmpeg-cvslog] avcodec/mpeg12dec: Don't store block_last_index unnecessarily

Andreas Rheinhardt git at videolan.org
Sat Jun 21 23:20:18 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun May 25 17:21:53 2025 +0200| [c2e5f7466db0b55d3fbb3b0ed0f133ddad0ad69a] | committer: Andreas Rheinhardt

avcodec/mpeg12dec: Don't store block_last_index unnecessarily

Given that the MPEG-1/2 decoders unquantize the blocks
on their own, block_last_index is only used to signal
to ff_mpv_reconstruct_mb() whether a block is skipped
or not; but this is only checked for inter macroblocks,
so it is unnecessary to set block_last_index for intra
macroblocks.

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

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

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

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3056c53c7c..62a77b6806 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -276,7 +276,7 @@ end:
     }
 
     if (i > MAX_INDEX)
-        i = AVERROR_INVALIDDATA;
+        return AVERROR_INVALIDDATA;
 
-    return i;
+    return 0;
 }
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9cf1bb9b28..5d2719d0f0 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -377,7 +377,6 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
 
     check_scantable_index(s, i);
 
-    s->block_last_index[n] = i;
     return 0;
 }
 
@@ -518,8 +517,6 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
                            s->mb_x, s->mb_y);
                     return ret;
                 }
-
-                s->block_last_index[i] = ret;
             }
         }
     } else {



More information about the ffmpeg-cvslog mailing list