[FFmpeg-cvslog] avcodec/mpeg12dec: Don't initialize unused parts of ScanTable

Andreas Rheinhardt git at videolan.org
Tue Mar 4 14:35:35 EET 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Feb 24 20:43:46 2025 +0100| [79d6657e138ac4a0f52ec4eaa4f4a2fcea0a7abb] | committer: Andreas Rheinhardt

avcodec/mpeg12dec: Don't initialize unused parts of ScanTable

The MPEG-1/2 decoders don't need ScanTable.raster_end
(as the coefficients are unquantized as they are parsed).

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

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

 libavcodec/mpeg12dec.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 48b35ed794..abef0a6155 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1228,10 +1228,10 @@ static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
     s->chroma_420_type            = get_bits1(&s->gb);
     s->progressive_frame          = get_bits1(&s->gb);
 
-    // We only initialize intra_scantable, as both scantables always coincide
-    // and all code therefore only uses the intra one.
-    ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
-                      s->alternate_scan ? ff_alternate_vertical_scan : ff_zigzag_direct);
+    // We only initialize intra_scantable.permutated, as this is all we use.
+    ff_permute_scantable(s->intra_scantable.permutated,
+                         s->alternate_scan ? ff_alternate_vertical_scan : ff_zigzag_direct,
+                         s->idsp.idct_permutation);
 
     /* composite display not parsed */
     ff_dlog(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
@@ -2803,8 +2803,9 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     m->intra_vlc_format = !!(s->flags & 0x20);
     m->alternate_scan = !!(s->flags & 0x10);
 
-    ff_init_scantable(m->idsp.idct_permutation, &m->intra_scantable,
-                      s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct);
+    ff_permute_scantable(m->intra_scantable.permutated,
+                         s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct,
+                         m->idsp.idct_permutation);
 
     m->last_dc[0] = m->last_dc[1] = m->last_dc[2] = 1 << (7 + (s->flags & 3));
     m->qscale = 1;



More information about the ffmpeg-cvslog mailing list