diff mbox series

[FFmpeg-devel,v2,127/162] avcodec/intrax8: Remove VLC offsets table

Message ID 20201120073327.820745-28-andreas.rheinhardt@gmail.com
State New
Headers show
Series VLC, esp. init_vlc patches
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 20, 2020, 7:32 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/intrax8.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 390c10272e..2a93e5efd7 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -50,18 +50,6 @@  static av_cold void x8_vlc_init(void)
 {
     int i;
     int offset = 0;
-    int sizeidx = 0;
-    static const uint16_t sizes[8 * 4 + 8 * 2 + 2 + 4] = {
-        576, 548, 582, 618, 546, 616, 560, 642,
-        584, 582, 704, 664, 512, 544, 656, 640,
-        512, 648, 582, 566, 532, 614, 596, 648,
-        586, 552, 584, 590, 544, 578, 584, 624,
-
-        528, 528, 526, 528, 536, 528, 526, 544,
-        544, 512, 512, 528, 528, 544, 512, 544,
-
-        128, 128, 128, 128, 128, 128,
-    };
 
     static VLC_TYPE table[28150][2];
 
@@ -69,10 +57,10 @@  static av_cold void x8_vlc_init(void)
 #define init_ac_vlc(dst, src)                                                 \
     do {                                                                      \
         dst.table           = &table[offset];                                 \
-        dst.table_allocated = sizes[sizeidx];                                 \
-        offset             += sizes[sizeidx++];                               \
+        dst.table_allocated = FF_ARRAY_ELEMS(table) - offset;                 \
         init_vlc(&dst, AC_VLC_BITS, 77, &src[1], 4, 2, &src[0], 4, 2,         \
-                 INIT_VLC_USE_NEW_STATIC);                                    \
+                 INIT_VLC_STATIC_OVERLONG);                                   \
+        offset             += dst.table_size;                                 \
     } while(0)
 
     for (i = 0; i < 8; i++) {
@@ -87,10 +75,10 @@  static av_cold void x8_vlc_init(void)
 #define init_dc_vlc(dst, src)                                                 \
     do {                                                                      \
         dst.table           = &table[offset];                                 \
-        dst.table_allocated = sizes[sizeidx];                                 \
-        offset             += sizes[sizeidx++];                               \
+        dst.table_allocated = FF_ARRAY_ELEMS(table) - offset;                 \
         init_vlc(&dst, DC_VLC_BITS, 34, &src[1], 4, 2, &src[0], 4, 2,         \
-                 INIT_VLC_USE_NEW_STATIC);                                    \
+                 INIT_VLC_STATIC_OVERLONG);                                   \
+        offset             += dst.table_size;                                 \
     } while(0)
 
     for (i = 0; i < 8; i++) {
@@ -103,10 +91,10 @@  static av_cold void x8_vlc_init(void)
 #define init_or_vlc(dst, src)                                                 \
     do {                                                                      \
         dst.table           = &table[offset];                                 \
-        dst.table_allocated = sizes[sizeidx];                                 \
-        offset             += sizes[sizeidx++];                               \
+        dst.table_allocated = FF_ARRAY_ELEMS(table) - offset;                 \
         init_vlc(&dst, OR_VLC_BITS, 12, &src[1], 4, 2, &src[0], 4, 2,         \
-                 INIT_VLC_USE_NEW_STATIC);                                    \
+                 INIT_VLC_STATIC_OVERLONG);                                   \
+        offset             += dst.table_size;                                 \
     } while(0)
 
     for (i = 0; i < 2; i++)