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

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 24 15:21:06 2023 +0200| [b60a3f70bed6e498c93255d21d8e14983b2945f6] | committer: Andreas Rheinhardt

avcodec/wnv1: 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=b60a3f70bed6e498c93255d21d8e14983b2945f6
---

 libavcodec/wnv1.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index ffc9174ab2..0e8dae598f 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -39,12 +39,12 @@ static const uint8_t code_tab[16][2] = {
 };
 
 #define CODE_VLC_BITS 9
-static VLC code_vlc;
+static VLCElem code_vlc[1 << CODE_VLC_BITS];
 
 /* returns modified base_value */
 static inline int wnv1_get_code(GetBitContext *gb, int shift, int base_value)
 {
-    int v = get_vlc2(gb, code_vlc.table, CODE_VLC_BITS, 1);
+    int v = get_vlc2(gb, code_vlc, CODE_VLC_BITS, 1);
 
     if (v == 8)
         return get_bits(gb, 8 - shift) << shift;
@@ -115,10 +115,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
 
 static av_cold void wnv1_init_static(void)
 {
-    VLC_INIT_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16,
-                                 &code_tab[0][1], 2,
-                                 &code_tab[0][0], 2, 1,
-                                 -7, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS);
+    VLC_INIT_STATIC_TABLE_FROM_LENGTHS(code_vlc, CODE_VLC_BITS, 16,
+                                       &code_tab[0][1], 2,
+                                       &code_tab[0][0], 2, 1,
+                                       -7, VLC_INIT_OUTPUT_LE);
 }
 
 static av_cold int decode_init(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list