[FFmpeg-devel] [PATCH 058/114] avcodec/rv40: Avoid code duplication when initializing VLCs

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Nov 10 12:47:55 EET 2020


Besides removing code duplication the method for determining the offset
of each VLC table in the VLC_TYPE buffer also has the advantage of not
wasting space for skipped AIC mode 1 VLCs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/rv40.c     |  52 +++---
 libavcodec/rv40vlc2.h | 383 +++++++++++++++++++-----------------------
 2 files changed, 200 insertions(+), 235 deletions(-)

diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index 7ed599cd69..15e00c2694 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -41,31 +41,35 @@ static VLC aic_top_vlc;
 static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM];
 static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS];
 
+static av_cold void rv40_init_table(VLC *vlc, unsigned *offset, int nb_bits,
+                                    int nb_codes, const uint8_t (*tab)[2])
+{
+    static VLC_TYPE vlc_buf[11776][2];
+
+    vlc->table           = &vlc_buf[*offset];
+    vlc->table_allocated = 1 << nb_bits;
+    *offset             += 1 << nb_bits;
+
+    ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes,
+                             &tab[0][1], 2, &tab[0][0], 2, 1,
+                             0, INIT_VLC_USE_NEW_STATIC);
+}
+
 /**
  * Initialize all tables.
  */
 static av_cold void rv40_init_tables(void)
 {
-    int i;
-    static VLC_TYPE aic_table[1 << AIC_TOP_BITS][2];
-    static VLC_TYPE aic_mode1_table[AIC_MODE1_NUM << AIC_MODE1_BITS][2];
+    int i, offset = 0;
     static VLC_TYPE aic_mode2_table[11814][2];
-    static VLC_TYPE ptype_table[NUM_PTYPE_VLCS << PTYPE_VLC_BITS][2];
-    static VLC_TYPE btype_table[NUM_BTYPE_VLCS << BTYPE_VLC_BITS][2];
-
-    aic_top_vlc.table = aic_table;
-    aic_top_vlc.table_allocated = 1 << AIC_TOP_BITS;
-    init_vlc(&aic_top_vlc, AIC_TOP_BITS, AIC_TOP_SIZE,
-             rv40_aic_top_vlc_bits,  1, 1,
-             rv40_aic_top_vlc_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
+
+    rv40_init_table(&aic_top_vlc, &offset, AIC_TOP_BITS, AIC_TOP_SIZE,
+                    rv40_aic_top_vlc_tab);
     for(i = 0; i < AIC_MODE1_NUM; i++){
         // Every tenth VLC table is empty
         if((i % 10) == 9) continue;
-        aic_mode1_vlc[i].table = &aic_mode1_table[i << AIC_MODE1_BITS];
-        aic_mode1_vlc[i].table_allocated = 1 << AIC_MODE1_BITS;
-        init_vlc(&aic_mode1_vlc[i], AIC_MODE1_BITS, AIC_MODE1_SIZE,
-                 aic_mode1_vlc_bits[i],  1, 1,
-                 aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        rv40_init_table(&aic_mode1_vlc[i], &offset, AIC_MODE1_BITS,
+                        AIC_MODE1_SIZE, aic_mode1_vlc_tabs[i]);
     }
     for (unsigned i = 0, offset = 0; i < AIC_MODE2_NUM; i++){
         uint16_t syms[AIC_MODE2_SIZE];
@@ -86,20 +90,12 @@ static av_cold void rv40_init_tables(void)
         offset += aic_mode2_vlc[i].table_size;
     }
     for(i = 0; i < NUM_PTYPE_VLCS; i++){
-        ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS];
-        ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS;
-        ff_init_vlc_from_lengths(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
-                                 &ptype_vlc_tabs[i][0][1], 2,
-                                 &ptype_vlc_tabs[i][0][0], 2, 1,
-                                 0, INIT_VLC_USE_NEW_STATIC);
+        rv40_init_table(&ptype_vlc[i], &offset, PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
+                        ptype_vlc_tabs[i]);
     }
     for(i = 0; i < NUM_BTYPE_VLCS; i++){
-        btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS];
-        btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS;
-        ff_init_vlc_from_lengths(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
-                                 &btype_vlc_tabs[i][0][1], 2,
-                                 &btype_vlc_tabs[i][0][0], 2, 1,
-                                 0, INIT_VLC_USE_NEW_STATIC);
+        rv40_init_table(&btype_vlc[i], &offset, BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
+                        btype_vlc_tabs[i]);
     }
 }
 
diff --git a/libavcodec/rv40vlc2.h b/libavcodec/rv40vlc2.h
index 783b93ba2e..fec47ff4ad 100644
--- a/libavcodec/rv40vlc2.h
+++ b/libavcodec/rv40vlc2.h
@@ -35,13 +35,10 @@
 //@{
 #define AIC_TOP_BITS  7
 #define AIC_TOP_SIZE 16
-static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] = {
- 0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
- 0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
-};
-
-static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
- 1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
+static const uint8_t rv40_aic_top_vlc_tab[AIC_TOP_SIZE][2] = {
+    { 0x3, 5 }, { 0x2, 5 }, { 0x7, 5 }, { 0x4, 5 }, { 0xF, 3 }, { 0x8, 4 },
+    { 0x1, 4 }, { 0xE, 5 }, { 0xC, 5 }, { 0xB, 6 }, { 0x6, 6 }, { 0x9, 7 },
+    { 0x5, 7 }, { 0xD, 7 }, { 0xA, 7 }, { 0x0, 1 },
 };
 //@}
 
@@ -388,206 +385,178 @@ static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
 #define AIC_MODE1_SIZE  9
 #define AIC_MODE1_BITS  7
 
-static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
- { 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
- { 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
- { 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
- { 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
- { 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
- { 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
- { 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
- { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
- { 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
- { 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
- { 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
- { 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
- { 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
- { 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
- { 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
- { 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
- { 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
- { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
- { 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
- { 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
- { 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
- { 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
- { 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
- { 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
- { 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
- { 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
- { 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
- { 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
- { 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
- { 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
- { 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
- { 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
- { 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
- { 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
- { 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
- { 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-};
-
-static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
- {  1,  4,  2,  7,  4,  6,  4,  7,  5,},
- {  5,  1,  3,  4,  6,  3,  3,  7,  7,},
- {  1,  4,  2,  7,  6,  7,  5,  4,  4,},
- {  1,  3,  3,  3,  7,  4,  5,  7,  6,},
- {  2,  4,  2,  6,  4,  5,  2,  4,  6,},
- {  7,  2,  3,  4,  7,  1,  5,  7,  7,},
- {  5,  1,  3,  6,  5,  5,  2,  7,  7,},
- {  2,  5,  1,  7,  3,  7,  5,  5,  6,},
- {  2,  4,  1,  4,  5,  7,  6,  7,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  1,  3,  6,  5,  5,  5,  7,  7,},
- {  5,  1,  3,  4,  6,  3,  3,  7,  7,},
- {  4,  1,  2,  6,  5,  5,  4,  5,  6,},
- {  3,  1,  3,  4,  6,  3,  5,  7,  7,},
- {  4,  1,  3,  6,  3,  5,  3,  7,  7,},
- {  6,  1,  4,  4,  5,  2,  4,  7,  7,},
- {  7,  1,  5,  7,  4,  3,  2,  7,  7,},
- {  5,  3,  2,  7,  5,  6,  1,  5,  7,},
- {  4,  1,  2,  6,  7,  5,  4,  7,  4,},
- {  1,  0,  1,  0,  0,  0,  0,  0,  0,},
-
- {  3,  3,  1,  5,  5,  6,  6,  5,  3,},
- {  6,  2,  1,  5,  6,  5,  4,  4,  5,},
- {  6,  4,  1,  7,  6,  7,  6,  3,  2,},
- {  4,  3,  1,  4,  6,  4,  6,  5,  3,},
- {  6,  5,  1,  7,  4,  7,  3,  3,  3,},
- {  7,  2,  2,  3,  7,  2,  4,  6,  5,},
- {  6,  2,  2,  6,  4,  5,  2,  4,  4,},
- {  4,  4,  1,  7,  6,  7,  5,  2,  4,},
- {  5,  4,  1,  5,  6,  6,  5,  4,  2,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  2,  2,  3,  5,  5,  6,  6,  5,},
- {  7,  1,  3,  3,  6,  3,  4,  7,  5,},
- {  2,  4,  1,  4,  6,  7,  7,  5,  4,},
- {  7,  4,  3,  1,  5,  3,  6,  7,  3,},
- {  4,  3,  3,  4,  1,  6,  4,  6,  5,},
- {  7,  4,  4,  2,  6,  1,  4,  7,  5,},
- {  5,  2,  3,  4,  4,  3,  2,  5,  4,},
- {  3,  5,  2,  3,  2,  5,  5,  5,  3,},
- {  6,  4,  4,  2,  5,  4,  7,  7,  1,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  2,  2,  7,  3,  7,  4,  5,  6,},
- {  4,  1,  3,  6,  4,  4,  3,  6,  5,},
- {  2,  4,  1,  7,  3,  7,  6,  6,  6,},
- {  3,  4,  3,  5,  1,  4,  4,  6,  6,},
- {  4,  5,  2,  7,  1,  7,  3,  7,  7,},
- {  6,  2,  3,  5,  3,  3,  2,  6,  4,},
- {  4,  4,  4,  7,  2,  5,  1,  6,  7,},
- {  4,  5,  2,  7,  1,  7,  4,  4,  6,},
- {  2,  4,  2,  6,  2,  4,  6,  5,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  1,  3,  3,  5,  6,  3,  5,  6,  5,},
- {  7,  1,  4,  4,  6,  2,  4,  7,  5,},
- {  2,  2,  2,  6,  5,  3,  5,  6,  5,},
- {  7,  4,  4,  2,  6,  1,  5,  7,  4,},
- {  3,  2,  2,  4,  4,  3,  4,  5,  5,},
- {  7,  2,  5,  3,  7,  1,  4,  7,  7,},
- {  6,  2,  3,  4,  5,  2,  2,  7,  7,},
- {  3,  2,  2,  5,  5,  4,  4,  4,  3,},
- {  3,  2,  2,  4,  6,  3,  5,  6,  3,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  1,  3,  3,  7,  4,  6,  3,  5,  7,},
- {  4,  1,  4,  7,  4,  5,  2,  6,  7,},
- {  2,  4,  1,  7,  5,  7,  3,  7,  7,},
- {  3,  2,  3,  5,  3,  4,  2,  6,  6,},
- {  3,  5,  4,  7,  2,  7,  1,  7,  7,},
- {  4,  1,  3,  6,  5,  3,  3,  7,  7,},
- {  4,  2,  5,  7,  3,  7,  1,  7,  7,},
- {  7,  4,  1,  7,  3,  7,  2,  5,  7,},
- {  4,  2,  2,  6,  4,  5,  2,  6,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  3,  4,  1,  7,  6,  7,  6,  2,  6,},
- {  4,  2,  2,  6,  6,  5,  4,  2,  4,},
- {  4,  4,  1,  7,  5,  7,  6,  2,  4,},
- {  3,  3,  2,  5,  4,  4,  5,  2,  4,},
- {  4,  5,  2,  7,  2,  7,  3,  2,  6,},
- {  4,  3,  2,  5,  5,  4,  3,  2,  4,},
- {  7,  4,  2,  7,  2,  5,  3,  2,  6,},
- {  4,  6,  2,  7,  3,  7,  6,  1,  6,},
- {  5,  5,  1,  6,  4,  6,  5,  2,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  3,  3,  2,  3,  5,  6,  6,  4,  2,},
- {  7,  1,  3,  3,  6,  5,  7,  4,  3,},
- {  5,  4,  1,  5,  5,  6,  6,  4,  2,},
- {  6,  4,  2,  2,  6,  3,  6,  6,  2,},
- {  6,  4,  2,  5,  3,  6,  3,  3,  2,},
- {  6,  3,  2,  3,  5,  2,  4,  6,  3,},
- {  6,  2,  2,  4,  3,  5,  3,  6,  3,},
- {  7,  5,  1,  7,  4,  7,  7,  3,  2,},
- {  5,  5,  2,  3,  6,  7,  7,  5,  1,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
+static const uint8_t aic_mode1_vlc_tabs[AIC_MODE1_NUM][AIC_MODE1_SIZE][2] = {
+    { { 4, 4 }, { 1, 4 }, { 7, 7 }, { 3, 7 }, { 5, 6 },
+      { 8, 5 }, { 6, 4 }, { 2, 2 }, { 0, 1 } },
+    { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
+      { 0, 5 }, { 3, 4 }, { 6, 3 }, { 1, 1 } },
+    { { 7, 4 }, { 1, 4 }, { 5, 7 }, { 3, 7 }, { 4, 6 },
+      { 6, 5 }, { 8, 4 }, { 2, 2 }, { 0, 1 } },
+    { { 2, 3 }, { 1, 3 }, { 7, 7 }, { 4, 7 }, { 8, 6 },
+      { 6, 5 }, { 5, 4 }, { 3, 3 }, { 0, 1 } },
+    { { 2, 2 }, { 0, 2 }, { 4, 4 }, { 1, 4 }, { 8, 6 },
+      { 3, 6 }, { 5, 5 }, { 7, 4 }, { 6, 2 } },
+    { { 4, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 6, 5 },
+      { 3, 4 }, { 2, 3 }, { 1, 2 }, { 5, 1 } },
+    { { 4, 5 }, { 0, 5 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
+      { 5, 5 }, { 2, 3 }, { 6, 2 }, { 1, 1 } },
+    { { 6, 5 }, { 1, 5 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 7, 5 }, { 4, 3 }, { 0, 2 }, { 2, 1 } },
+    { { 3, 4 }, { 1, 4 }, { 7, 7 }, { 5, 7 }, { 6, 6 },
+      { 4, 5 }, { 8, 4 }, { 0, 2 }, { 2, 1 } },
+    { { 0 } }, /* unused */
+    { { 5, 5 }, { 4, 5 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
+      { 6, 5 }, { 2, 3 }, { 0, 2 }, { 1, 1 } },
+    { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
+      { 0, 5 }, { 3, 4 }, { 6, 3 }, { 1, 1 } },
+    { { 6, 4 }, { 0, 4 }, { 5, 5 }, { 4, 5 }, { 8, 6 },
+      { 3, 6 }, { 7, 5 }, { 2, 2 }, { 1, 1 } },
+    { { 2, 3 }, { 0, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
+      { 6, 5 }, { 3, 4 }, { 5, 3 }, { 1, 1 } },
+    { { 4, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
+      { 5, 5 }, { 0, 4 }, { 6, 3 }, { 1, 1 } },
+    { { 3, 4 }, { 2, 4 }, { 8, 7 }, { 7, 7 }, { 0, 6 },
+      { 4, 5 }, { 6, 4 }, { 5, 2 }, { 1, 1 } },
+    { { 3, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
+      { 4, 4 }, { 5, 3 }, { 6, 2 }, { 1, 1 } },
+    { { 4, 5 }, { 0, 5 }, { 8, 7 }, { 3, 7 }, { 5, 6 },
+      { 7, 5 }, { 1, 3 }, { 2, 2 }, { 6, 1 } },
+    { { 6, 4 }, { 0, 4 }, { 7, 7 }, { 4, 7 }, { 3, 6 },
+      { 5, 5 }, { 8, 4 }, { 2, 2 }, { 1, 1 } },
+    { { 2, 1 }, { 0, 1 } }, /* Unused */
+    { { 1, 3 }, { 0, 3 }, { 4, 5 }, { 3, 5 }, { 6, 6 },
+      { 5, 6 }, { 7, 5 }, { 8, 3 }, { 2, 1 } },
+    { { 7, 4 }, { 6, 4 }, { 5, 5 }, { 3, 5 }, { 4, 6 },
+      { 0, 6 }, { 8, 5 }, { 1, 2 }, { 2, 1 } },
+    { { 4, 6 }, { 0, 6 }, { 5, 7 }, { 3, 7 }, { 6, 6 },
+      { 1, 4 }, { 7, 3 }, { 8, 2 }, { 2, 1 } },
+    { { 8, 3 }, { 1, 3 }, { 3, 4 }, { 0, 4 }, { 6, 6 },
+      { 4, 6 }, { 7, 5 }, { 5, 4 }, { 2, 1 } },
+    { { 7, 3 }, { 6, 3 }, { 5, 7 }, { 3, 7 }, { 0, 6 },
+      { 1, 5 }, { 4, 4 }, { 8, 3 }, { 2, 1 } },
+    { { 2, 2 }, { 1, 2 }, { 4, 7 }, { 0, 7 }, { 7, 6 },
+      { 8, 5 }, { 6, 4 }, { 3, 3 }, { 5, 2 } },
+    { { 2, 2 }, { 1, 2 }, { 7, 4 }, { 4, 4 }, { 3, 6 },
+      { 0, 6 }, { 5, 5 }, { 8, 4 }, { 6, 2 } },
+    { { 1, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 4, 6 },
+      { 6, 5 }, { 8, 4 }, { 7, 2 }, { 2, 1 } },
+    { { 7, 4 }, { 1, 4 }, { 3, 5 }, { 0, 5 }, { 5, 6 },
+      { 4, 6 }, { 6, 5 }, { 8, 2 }, { 2, 1 } },
+    { { 0 } }, /* unused */
+    { { 1, 2 }, { 0, 2 }, { 5, 5 }, { 4, 5 }, { 7, 6 },
+      { 6, 6 }, { 8, 5 }, { 3, 3 }, { 2, 2 } },
+    { { 3, 3 }, { 2, 3 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
+      { 8, 5 }, { 6, 4 }, { 5, 3 }, { 1, 1 } },
+    { { 3, 4 }, { 1, 4 }, { 6, 7 }, { 5, 7 }, { 4, 6 },
+      { 7, 5 }, { 8, 4 }, { 0, 2 }, { 2, 1 } },
+    { { 5, 3 }, { 2, 3 }, { 7, 7 }, { 0, 7 }, { 6, 6 },
+      { 4, 5 }, { 1, 4 }, { 8, 3 }, { 3, 1 } },
+    { { 2, 3 }, { 1, 3 }, { 3, 4 }, { 0, 4 }, { 7, 6 },
+      { 5, 6 }, { 8, 5 }, { 6, 4 }, { 4, 1 } },
+    { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
+      { 8, 5 }, { 6, 4 }, { 3, 2 }, { 5, 1 } },
+    { { 6, 2 }, { 1, 2 }, { 5, 3 }, { 2, 3 }, { 4, 4 },
+      { 3, 4 }, { 7, 5 }, { 0, 5 }, { 8, 4 } },
+    { { 4, 2 }, { 2, 2 }, { 3, 3 }, { 0, 3 }, { 5, 5 },
+      { 1, 5 }, { 7, 5 }, { 6, 5 }, { 8, 3 } },
+    { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 6, 7 }, { 0, 6 },
+      { 4, 5 }, { 5, 4 }, { 3, 2 }, { 8, 1 } },
+    { { 0 } }, /* unused */
+    { { 1, 2 }, { 0, 2 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 7, 5 }, { 6, 4 }, { 4, 3 }, { 2, 2 } },
+    { { 6, 3 }, { 2, 3 }, { 4, 4 }, { 0, 4 }, { 7, 6 },
+      { 3, 6 }, { 8, 5 }, { 5, 4 }, { 1, 1 } },
+    { { 7, 6 }, { 6, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 1, 4 }, { 4, 3 }, { 0, 2 }, { 2, 1 } },
+    { { 2, 3 }, { 0, 3 }, { 5, 4 }, { 1, 4 }, { 8, 6 },
+      { 7, 6 }, { 3, 5 }, { 6, 4 }, { 4, 1 } },
+    { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 1, 5 },
+      { 0, 4 }, { 6, 3 }, { 2, 2 }, { 4, 1 } },
+    { { 6, 2 }, { 1, 2 }, { 4, 3 }, { 2, 3 }, { 7, 6 },
+      { 0, 6 }, { 3, 5 }, { 8, 4 }, { 5, 3 } },
+    { { 1, 4 }, { 0, 4 }, { 8, 7 }, { 3, 7 }, { 7, 6 },
+      { 5, 5 }, { 2, 4 }, { 4, 2 }, { 6, 1 } },
+    { { 6, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 1, 5 }, { 7, 4 }, { 2, 2 }, { 4, 1 } },
+    { { 2, 2 }, { 0, 2 }, { 5, 4 }, { 1, 4 }, { 6, 6 },
+      { 3, 6 }, { 7, 5 }, { 8, 4 }, { 4, 2 } },
+    { { 0 } }, /* unused */
+    { { 2, 3 }, { 1, 3 }, { 6, 5 }, { 3, 5 }, { 7, 6 },
+      { 4, 6 }, { 8, 5 }, { 5, 3 }, { 0, 1 } },
+    { { 3, 4 }, { 2, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
+      { 8, 5 }, { 6, 4 }, { 5, 2 }, { 1, 1 } },
+    { { 1, 2 }, { 0, 2 }, { 6, 5 }, { 4, 5 }, { 7, 6 },
+      { 3, 6 }, { 8, 5 }, { 5, 3 }, { 2, 2 } },
+    { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
+      { 6, 5 }, { 8, 4 }, { 3, 2 }, { 5, 1 } },
+    { { 2, 2 }, { 1, 2 }, { 5, 3 }, { 0, 3 }, { 4, 4 },
+      { 3, 4 }, { 8, 5 }, { 7, 5 }, { 6, 4 } },
+    { { 4, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
+      { 6, 4 }, { 3, 3 }, { 1, 2 }, { 5, 1 } },
+    { { 5, 2 }, { 1, 2 }, { 8, 7 }, { 7, 7 }, { 0, 6 },
+      { 4, 5 }, { 3, 4 }, { 2, 3 }, { 6, 2 } },
+    { { 2, 2 }, { 1, 2 }, { 8, 3 }, { 0, 3 }, { 6, 4 },
+      { 5, 4 }, { 4, 5 }, { 3, 5 }, { 7, 4 } },
+    { { 2, 2 }, { 1, 2 }, { 5, 3 }, { 0, 3 }, { 7, 6 },
+      { 4, 6 }, { 6, 5 }, { 3, 4 }, { 8, 3 } },
+    { { 0 } }, /* unused */
+    { { 2, 3 }, { 1, 3 }, { 8, 7 }, { 3, 7 }, { 5, 6 },
+      { 7, 5 }, { 4, 4 }, { 6, 3 }, { 0, 1 } },
+    { { 2, 4 }, { 0, 4 }, { 8, 7 }, { 3, 7 }, { 7, 6 },
+      { 5, 5 }, { 4, 4 }, { 6, 2 }, { 1, 1 } },
+    { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 4, 5 },
+      { 1, 4 }, { 6, 3 }, { 0, 2 }, { 2, 1 } },
+    { { 6, 2 }, { 1, 2 }, { 2, 3 }, { 0, 3 }, { 8, 6 },
+      { 7, 6 }, { 3, 5 }, { 5, 4 }, { 4, 3 } },
+    { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 1, 5 },
+      { 2, 4 }, { 0, 3 }, { 4, 2 }, { 6, 1 } },
+    { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
+      { 4, 5 }, { 0, 4 }, { 6, 3 }, { 1, 1 } },
+    { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
+      { 0, 4 }, { 4, 3 }, { 1, 2 }, { 6, 1 } },
+    { { 3, 7 }, { 0, 7 }, { 8, 7 }, { 5, 7 }, { 7, 5 },
+      { 1, 4 }, { 4, 3 }, { 6, 2 }, { 2, 1 } },
+    { { 2, 2 }, { 1, 2 }, { 4, 4 }, { 0, 4 }, { 7, 6 },
+      { 3, 6 }, { 5, 5 }, { 8, 4 }, { 6, 2 } },
+    { { 0 } }, /* unused */
+    { { 6, 6 }, { 4, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 1, 4 }, { 0, 3 }, { 7, 2 }, { 2, 1 } },
+    { { 2, 2 }, { 1, 2 }, { 6, 4 }, { 0, 4 }, { 4, 6 },
+      { 3, 6 }, { 5, 5 }, { 8, 4 }, { 7, 2 } },
+    { { 1, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 6, 6 },
+      { 4, 5 }, { 8, 4 }, { 7, 2 }, { 2, 1 } },
+    { { 7, 2 }, { 2, 2 }, { 1, 3 }, { 0, 3 }, { 5, 4 },
+      { 4, 4 }, { 6, 5 }, { 3, 5 }, { 8, 4 } },
+    { { 4, 2 }, { 2, 2 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 1, 5 }, { 0, 4 }, { 6, 3 }, { 7, 2 } },
+    { { 7, 2 }, { 2, 2 }, { 6, 3 }, { 1, 3 }, { 5, 4 },
+      { 0, 4 }, { 4, 5 }, { 3, 5 }, { 8, 4 } },
+    { { 4, 2 }, { 2, 2 }, { 3, 7 }, { 0, 7 }, { 8, 6 },
+      { 5, 5 }, { 1, 4 }, { 6, 3 }, { 7, 2 } },
+    { { 6, 6 }, { 1, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
+      { 0, 4 }, { 4, 3 }, { 2, 2 }, { 7, 1 } },
+    { { 8, 4 }, { 4, 4 }, { 1, 5 }, { 0, 5 }, { 5, 6 },
+      { 3, 6 }, { 6, 5 }, { 7, 2 }, { 2, 1 } },
+    { { 0 } }, /* unused */
+    { { 8, 2 }, { 2, 2 }, { 1, 3 }, { 0, 3 }, { 6, 6 },
+      { 5, 6 }, { 4, 5 }, { 7, 4 }, { 3, 3 } },
+    { { 3, 3 }, { 2, 3 }, { 6, 7 }, { 0, 7 }, { 4, 6 },
+      { 5, 5 }, { 7, 4 }, { 8, 3 }, { 1, 1 } },
+    { { 7, 4 }, { 1, 4 }, { 3, 5 }, { 0, 5 }, { 6, 6 },
+      { 5, 6 }, { 4, 5 }, { 8, 2 }, { 2, 1 } },
+    { { 3, 2 }, { 2, 2 }, { 4, 6 }, { 0, 6 }, { 7, 6 },
+      { 6, 6 }, { 1, 4 }, { 5, 3 }, { 8, 2 } },
+    { { 8, 2 }, { 2, 2 }, { 6, 3 }, { 4, 3 }, { 5, 6 },
+      { 0, 6 }, { 3, 5 }, { 1, 4 }, { 7, 3 } },
+    { { 5, 2 }, { 2, 2 }, { 3, 3 }, { 1, 3 }, { 7, 6 },
+      { 0, 6 }, { 4, 5 }, { 6, 4 }, { 8, 3 } },
+    { { 2, 2 }, { 1, 2 }, { 6, 3 }, { 4, 3 }, { 7, 6 },
+      { 0, 6 }, { 5, 5 }, { 3, 4 }, { 8, 3 } },
+    { { 3, 7 }, { 0, 7 }, { 6, 7 }, { 5, 7 }, { 1, 5 },
+      { 4, 4 }, { 7, 3 }, { 8, 2 }, { 2, 1 } },
+    { { 1, 5 }, { 0, 5 }, { 6, 7 }, { 5, 7 }, { 4, 6 },
+      { 7, 5 }, { 3, 3 }, { 2, 2 }, { 8, 1 } },
+    { { 0 } }, /* unused */
 };
 
 //@}
-- 
2.25.1



More information about the ffmpeg-devel mailing list