diff mbox series

[FFmpeg-devel,28/61] avcodec/vqcdec: Avoid unnecessary VLC structure

Message ID GV1P250MB0737A4C73E14DA73FA40BE8F8FC3A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 36e7f9b3395d3be21fb77462f2c620487b92784d
Headers show
Series [FFmpeg-devel,01/61] avcodec/vlc: Add functions to init static VLCElem[] without VLC | expand

Commit Message

Andreas Rheinhardt Sept. 26, 2023, 10:16 p.m. UTC
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@outlook.com>
---
 libavcodec/vqcdec.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 462d810a2f..dc9248d99f 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -49,14 +49,15 @@  static const int8_t vector_symbols[] = {
     2, 3, 4, SIGNED_8BIT, -2, -3, -4, SIGNED_6BIT
 };
 
-static VLC vector_vlc;
+static VLCElem vector_vlc[1 << VECTOR_VLC_BITS];
 
 static av_cold void vqc_init_static_data(void)
 {
-    VLC_INIT_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits),
-                             vector_nbits, 1,
-                             vector_symbols, 1, 1,
-                             0, 0, 1 << VECTOR_VLC_BITS);
+    VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vector_vlc, VECTOR_VLC_BITS,
+                                       FF_ARRAY_ELEMS(vector_nbits),
+                                       vector_nbits, 1,
+                                       vector_symbols, 1, 1,
+                                       0, 0);
 }
 
 typedef struct VqcContext {
@@ -171,7 +172,7 @@  static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wid
                 continue;
             }
 
-            symbol = get_vlc2(&gb, vector_vlc.table, VECTOR_VLC_BITS, 1);
+            symbol = get_vlc2(&gb, vector_vlc, VECTOR_VLC_BITS, 1);
             switch(symbol) {
             case SKIP_3: dst += 3; break;
             case SKIP_4: dst += 4; break;