[FFmpeg-cvslog] avcodec/indeo2: Avoid unnecessary VLC structure

Andreas Rheinhardt git at videolan.org
Tue Oct 31 22:15:53 EET 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 24 17:28:21 2023 +0200| [05577d2c7694f2879a23f72617cbbc7a0b75db33] | committer: Andreas Rheinhardt

avcodec/indeo2: Avoid unnecessary VLC structure

Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

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

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

 libavcodec/indeo2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 2f64320682..6878ab7cb6 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -42,12 +42,12 @@ typedef struct Ir2Context{
 } Ir2Context;
 
 #define CODE_VLC_BITS 14
-static VLC ir2_vlc;
+static VLCElem ir2_vlc[1 << CODE_VLC_BITS];
 
 /* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */
 static inline int ir2_get_code(GetBitContext *gb)
 {
-    return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1);
+    return get_vlc2(gb, ir2_vlc, CODE_VLC_BITS, 1);
 }
 
 static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
@@ -226,9 +226,9 @@ static int ir2_decode_frame(AVCodecContext *avctx, AVFrame *picture,
 
 static av_cold void ir2_init_static(void)
 {
-    VLC_INIT_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
-                                 &ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1,
-                                 0, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS);
+    VLC_INIT_STATIC_TABLE_FROM_LENGTHS(ir2_vlc, CODE_VLC_BITS, IR2_CODES,
+                                       &ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1,
+                                       0, VLC_INIT_OUTPUT_LE);
 }
 
 static av_cold int ir2_decode_init(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list