[FFmpeg-cvslog] avcodec/mpeg4videodec: Use union to save space

Andreas Rheinhardt git at videolan.org
Mon May 26 06:25:26 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed May 21 15:22:39 2025 +0200| [43a69886b2164ae9a6936d0df14f7a4c74121679] | committer: Andreas Rheinhardt

avcodec/mpeg4videodec: Use union to save space

At most one of block32 and dpcm_macroblock is used at any given time.

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

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

 libavcodec/mpeg4videodec.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
index 593c8ab290..ae8428fd2b 100644
--- a/libavcodec/mpeg4videodec.h
+++ b/libavcodec/mpeg4videodec.h
@@ -99,10 +99,12 @@ typedef struct Mpeg4DecContext {
     void (*dct_unquantize_h263_intra)(MpegEncContext *s,
                                       int16_t *block, int n, int qscale);
 
-    DECLARE_ALIGNED(8, int32_t, block32)[12][64];
+    union {
+        DECLARE_ALIGNED(8, int32_t, block32)[12][64];
+        int16_t dpcm_macroblock[3][256];
+    };
     // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
     int dpcm_direction;
-    int16_t dpcm_macroblock[3][256];
 } Mpeg4DecContext;
 
 int ff_mpeg4_decode_picture_header(MpegEncContext *s);



More information about the ffmpeg-cvslog mailing list