[FFmpeg-devel] [PATCH 041/114] avcodec/mpc8: Reduce size of tables used to initialize VLCs

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


By switching to ff_init_vlc_from_lengths() one can make a table of
codes of type uint8_t superfluous, saving space.

Other VLCs (for which there was no dedicated symbols table and where the
codes where already of type uint8_t) have been made to use
ff_init_vlc_from_lengths(), too, because it reduces codesize
(ff_init_vlc_from_lengths() has three parameters less than
ff_init_vlc_sparse()) and because it allows to use the offset parameter
in future commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/mpc8.c     | 133 ++++------
 libavcodec/mpc8huff.h | 575 ++++++++++++++----------------------------
 2 files changed, 240 insertions(+), 468 deletions(-)

diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 631bac2753..339ee515b8 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -101,15 +101,6 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
     static int vlc_initialized = 0;
     int channels;
 
-    static VLC_TYPE band_table[542][2];
-    static VLC_TYPE q1_table[520][2];
-    static VLC_TYPE q9up_table[524][2];
-    static VLC_TYPE scfi0_table[1 << MPC8_SCFI0_BITS][2];
-    static VLC_TYPE scfi1_table[1 << MPC8_SCFI1_BITS][2];
-    static VLC_TYPE dscf0_table[560][2];
-    static VLC_TYPE dscf1_table[598][2];
-    static VLC_TYPE q3_0_table[512][2];
-    static VLC_TYPE q3_1_table[516][2];
     static VLC_TYPE codes_table[5708][2];
 
     if(avctx->extradata_size < 2){
@@ -145,91 +136,77 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
     if(vlc_initialized) return 0;
     av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
 
-    band_vlc.table = band_table;
-    band_vlc.table_allocated = 542;
-    init_vlc(&band_vlc, MPC8_BANDS_BITS, MPC8_BANDS_SIZE,
-             mpc8_bands_bits,  1, 1,
-             mpc8_bands_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    q1_vlc.table = q1_table;
-    q1_vlc.table_allocated = 520;
-    init_vlc(&q1_vlc, MPC8_Q1_BITS, MPC8_Q1_SIZE,
-             mpc8_q1_bits,  1, 1,
-             mpc8_q1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    q9up_vlc.table = q9up_table;
-    q9up_vlc.table_allocated = 524;
-    init_vlc(&q9up_vlc, MPC8_Q9UP_BITS, MPC8_Q9UP_SIZE,
-             mpc8_q9up_bits,  1, 1,
-             mpc8_q9up_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    scfi_vlc[0].table = scfi0_table;
-    scfi_vlc[0].table_allocated = 1 << MPC8_SCFI0_BITS;
-    init_vlc(&scfi_vlc[0], MPC8_SCFI0_BITS, MPC8_SCFI0_SIZE,
-             mpc8_scfi0_bits,  1, 1,
-             mpc8_scfi0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    scfi_vlc[1].table = scfi1_table;
-    scfi_vlc[1].table_allocated = 1 << MPC8_SCFI1_BITS;
-    init_vlc(&scfi_vlc[1], MPC8_SCFI1_BITS, MPC8_SCFI1_SIZE,
-             mpc8_scfi1_bits,  1, 1,
-             mpc8_scfi1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    dscf_vlc[0].table = dscf0_table;
-    dscf_vlc[0].table_allocated = 560;
-    init_vlc(&dscf_vlc[0], MPC8_DSCF0_BITS, MPC8_DSCF0_SIZE,
-             mpc8_dscf0_bits,  1, 1,
-             mpc8_dscf0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    dscf_vlc[1].table = dscf1_table;
-    dscf_vlc[1].table_allocated = 598;
-    init_vlc(&dscf_vlc[1], MPC8_DSCF1_BITS, MPC8_DSCF1_SIZE,
-             mpc8_dscf1_bits,  1, 1,
-             mpc8_dscf1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    q3_vlc[0].table = q3_0_table;
-    q3_vlc[0].table_allocated = 512;
-    ff_init_vlc_sparse(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE,
-             mpc8_q3_bits,  1, 1,
-             mpc8_q3_codes, 1, 1,
-             mpc8_q3_syms,  1, 1, INIT_VLC_USE_NEW_STATIC);
-    q3_vlc[1].table = q3_1_table;
-    q3_vlc[1].table_allocated = 516;
-    ff_init_vlc_sparse(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE,
-             mpc8_q4_bits,  1, 1,
-             mpc8_q4_codes, 1, 1,
-             mpc8_q4_syms,  1, 1, INIT_VLC_USE_NEW_STATIC);
+    INIT_VLC_STATIC_FROM_LENGTHS(&band_vlc, MPC8_BANDS_BITS, MPC8_BANDS_SIZE,
+                                 mpc8_bands_bits, 1,
+                                 mpc8_bands_syms, 1, 1, 0, 0, 542);
+
+    INIT_VLC_STATIC_FROM_LENGTHS(&q1_vlc, MPC8_Q1_BITS, MPC8_Q1_SIZE,
+                                 mpc8_q1_bits, 1,
+                                 mpc8_q1_syms, 1, 1, 0, 0, 520);
+    INIT_VLC_STATIC_FROM_LENGTHS(&q9up_vlc, MPC8_Q9UP_BITS, MPC8_Q9UP_SIZE,
+                                 mpc8_q9up_bits, 1,
+                                 mpc8_q9up_syms, 1, 1, 0, 0, 524);
+
+    INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc[0], MPC8_SCFI0_BITS, MPC8_SCFI0_SIZE,
+                                 mpc8_scfi0_bits, 1,
+                                 mpc8_scfi0_syms, 1, 1, 0, 0, 1 << MPC8_SCFI0_BITS);
+    INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc[1], MPC8_SCFI1_BITS, MPC8_SCFI1_SIZE,
+                                 mpc8_scfi1_bits, 1,
+                                 mpc8_scfi1_syms, 1, 1, 0, 0, 1 << MPC8_SCFI1_BITS);
+
+    INIT_VLC_STATIC_FROM_LENGTHS(&dscf_vlc[0], MPC8_DSCF0_BITS, MPC8_DSCF0_SIZE,
+                                 mpc8_dscf0_bits, 1,
+                                 mpc8_dscf0_syms, 1, 1, 0, 0, 560);
+    INIT_VLC_STATIC_FROM_LENGTHS(&dscf_vlc[1], MPC8_DSCF1_BITS, MPC8_DSCF1_SIZE,
+                                 mpc8_dscf1_bits, 1,
+                                 mpc8_dscf1_syms, 1, 1, 0, 0, 598);
+
+    INIT_VLC_STATIC_FROM_LENGTHS(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE,
+                                 mpc8_q3_bits, 1,
+                                 mpc8_q3_syms, 1, 1, 0, 0, 512);
+    INIT_VLC_STATIC_FROM_LENGTHS(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE,
+                                 mpc8_q4_bits, 1,
+                                 mpc8_q4_syms, 1, 1, 0, 0, 516);
 
     for(i = 0; i < 2; i++){
         res_vlc[i].table = &codes_table[vlc_offsets[0+i]];
         res_vlc[i].table_allocated = vlc_offsets[1+i] - vlc_offsets[0+i];
-        init_vlc(&res_vlc[i], MPC8_RES_BITS, MPC8_RES_SIZE,
-                 &mpc8_res_bits[i],  1, 1,
-                 &mpc8_res_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&res_vlc[i], MPC8_RES_BITS, MPC8_RES_SIZE,
+                                 mpc8_res_bits[i], 1,
+                                 mpc8_res_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
 
         q2_vlc[i].table = &codes_table[vlc_offsets[2+i]];
         q2_vlc[i].table_allocated = vlc_offsets[3+i] - vlc_offsets[2+i];
-        init_vlc(&q2_vlc[i], MPC8_Q2_BITS, MPC8_Q2_SIZE,
-                 &mpc8_q2_bits[i],  1, 1,
-                 &mpc8_q2_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&q2_vlc[i], MPC8_Q2_BITS, MPC8_Q2_SIZE,
+                                 mpc8_q2_bits[i], 1,
+                                 mpc8_q2_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
 
         quant_vlc[0][i].table = &codes_table[vlc_offsets[4+i]];
         quant_vlc[0][i].table_allocated = vlc_offsets[5+i] - vlc_offsets[4+i];
-        init_vlc(&quant_vlc[0][i], MPC8_Q5_BITS, MPC8_Q5_SIZE,
-                 &mpc8_q5_bits[i],  1, 1,
-                 &mpc8_q5_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&quant_vlc[0][i], MPC8_Q5_BITS, MPC8_Q5_SIZE,
+                                 mpc8_q5_bits[i], 1,
+                                 mpc8_q5_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
         quant_vlc[1][i].table = &codes_table[vlc_offsets[6+i]];
         quant_vlc[1][i].table_allocated = vlc_offsets[7+i] - vlc_offsets[6+i];
-        init_vlc(&quant_vlc[1][i], MPC8_Q6_BITS, MPC8_Q6_SIZE,
-                 &mpc8_q6_bits[i],  1, 1,
-                 &mpc8_q6_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&quant_vlc[1][i], MPC8_Q6_BITS, MPC8_Q6_SIZE,
+                                 mpc8_q6_bits[i], 1,
+                                 mpc8_q6_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
         quant_vlc[2][i].table = &codes_table[vlc_offsets[8+i]];
         quant_vlc[2][i].table_allocated = vlc_offsets[9+i] - vlc_offsets[8+i];
-        init_vlc(&quant_vlc[2][i], MPC8_Q7_BITS, MPC8_Q7_SIZE,
-                 &mpc8_q7_bits[i],  1, 1,
-                 &mpc8_q7_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&quant_vlc[2][i], MPC8_Q7_BITS, MPC8_Q7_SIZE,
+                                 mpc8_q7_bits[i], 1,
+                                 mpc8_q7_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
         quant_vlc[3][i].table = &codes_table[vlc_offsets[10+i]];
         quant_vlc[3][i].table_allocated = vlc_offsets[11+i] - vlc_offsets[10+i];
-        init_vlc(&quant_vlc[3][i], MPC8_Q8_BITS, MPC8_Q8_SIZE,
-                 &mpc8_q8_bits[i],  1, 1,
-                 &mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+        ff_init_vlc_from_lengths(&quant_vlc[3][i], MPC8_Q8_BITS, MPC8_Q8_SIZE,
+                                 mpc8_q8_bits[i], 1,
+                                 mpc8_q8_syms[i], 1, 1,
+                                 0, INIT_VLC_USE_NEW_STATIC);
     }
     vlc_initialized = 1;
 
diff --git a/libavcodec/mpc8huff.h b/libavcodec/mpc8huff.h
index 0566c910ca..687c9f7e98 100644
--- a/libavcodec/mpc8huff.h
+++ b/libavcodec/mpc8huff.h
@@ -27,287 +27,182 @@
 #define MPC8_BANDS_SIZE 33
 #define MPC8_BANDS_BITS 9
 
-static const uint8_t mpc8_bands_codes[MPC8_BANDS_SIZE] = {
- 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04,
- 0x05, 0x06, 0x01, 0x02, 0x03, 0x00, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x01, 0x09, 0x0A, 0x0B, 0x07,
- 0x08, 0x09, 0x06, 0x07, 0x05, 0x05, 0x03, 0x03,
- 0x01,
+static const uint8_t mpc8_bands_syms[MPC8_BANDS_SIZE] = {
+    13, 19, 10, 11, 12, 14, 15, 16, 17, 18, 20, 21, 22,  9, 23, 24, 25,  8, 26,
+    27,  7, 28,  5,  6, 29,  4,  3, 30,  2, 31,  1, 32,  0
 };
 static const uint8_t mpc8_bands_bits[MPC8_BANDS_SIZE] = {
-  1,  3,  5,  6,  7,  8,  8,  9,
- 10, 11, 12, 12, 12, 13, 12, 12,
- 12, 12, 12, 13, 12, 12, 12, 11,
- 11, 11, 10, 10,  9,  8,  6,  5,
-  2,
+    13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10,
+    10,  9,  9,  8,  8,  8,  7,  6,  6,  5,  5,  3,  2,  1
 };
 
 #define MPC8_SCFI0_SIZE 4
 #define MPC8_SCFI0_BITS 3
 
-static const uint8_t mpc8_scfi0_codes[MPC8_SCFI0_SIZE] = {
- 0x00, 0x01, 0x01, 0x01,
+static const uint8_t mpc8_scfi0_syms[MPC8_SCFI0_SIZE] = {
+     0,  1,  3,  2
 };
 static const uint8_t mpc8_scfi0_bits[MPC8_SCFI0_SIZE] = {
-  3,  3,  1,  2,
+     3,  3,  2,  1
 };
 
 #define MPC8_SCFI1_SIZE 16
 #define MPC8_SCFI1_BITS 7
 
-static const uint8_t mpc8_scfi1_codes[MPC8_SCFI1_SIZE] = {
- 0x01, 0x00, 0x02, 0x03, 0x01, 0x03, 0x04, 0x05,
- 0x04, 0x06, 0x02, 0x02, 0x05, 0x07, 0x03, 0x03,
-
+static const uint8_t mpc8_scfi1_syms[MPC8_SCFI1_SIZE] = {
+     1,  4,  0,  2,  3,  8, 12,  5,  6,  7,  9, 13, 11, 14, 10, 15
 };
 static const uint8_t mpc8_scfi1_bits[MPC8_SCFI1_SIZE] = {
-  6,  7,  6,  6,  7,  5,  5,  5,
-  6,  5,  2,  3,  6,  5,  3,  2,
-
+     7,  7,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  3,  3,  2,  2
 };
 
 #define MPC8_DSCF0_SIZE 64
 #define MPC8_DSCF0_BITS 9
 
-static const uint8_t mpc8_dscf0_codes[MPC8_DSCF0_SIZE] = {
- 0x03, 0x04, 0x05, 0x04, 0x05, 0x06, 0x05, 0x06,
- 0x07, 0x08, 0x09, 0x07, 0x08, 0x09, 0x0A, 0x07,
- 0x08, 0x09, 0x0A, 0x07, 0x08, 0x09, 0x0A, 0x06,
- 0x07, 0x05, 0x04, 0x05, 0x06, 0x06, 0x07, 0x0A,
- 0x08, 0x05, 0x06, 0x07, 0x09, 0x07, 0x08, 0x09,
- 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C, 0x0D, 0x0B,
- 0x0C, 0x0D, 0x07, 0x08, 0x09, 0x06, 0x07, 0x03,
- 0x04, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+static const uint8_t mpc8_dscf0_syms[MPC8_DSCF0_SIZE] = {
+    58, 59, 60, 61, 62, 63, 55, 56, 57,  0,  1,  2, 53, 54,  3,  4,  5, 50, 51,
+    52,  6,  7,  8,  9, 10, 31, 47, 48, 49, 11, 12, 13, 14, 44, 45, 46, 15, 16,
+    17, 18, 41, 42, 43, 19, 20, 21, 22, 40, 23, 24, 38, 39, 25, 28, 37, 26, 27,
+    29, 30, 32, 36, 33, 34, 35,
 };
 static const uint8_t mpc8_dscf0_bits[MPC8_DSCF0_SIZE] = {
- 12, 12, 12, 11, 11, 11, 10, 10,
- 10, 10, 10,  9,  9,  9,  9,  8,
-  8,  8,  8,  7,  7,  7,  7,  6,
-  6,  5,  4,  4,  5,  4,  4, 10,
-  4,  3,  3,  3,  4,  5,  6,  6,
-  7,  8,  8,  8,  9,  9,  9, 10,
- 10, 10, 11, 11, 11, 12, 12, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
-
+    14, 14, 14, 14, 14, 14, 13, 13, 13, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11,
+    11, 10, 10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  8,  8,
+     8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  6,  6,  6,  6,  5,  5,  5,  4,  4,
+     4,  4,  4,  4,  3,  3,  3
 };
 
 #define MPC8_DSCF1_SIZE 65
 #define MPC8_DSCF1_BITS 9
 
-static const uint8_t mpc8_dscf1_codes[MPC8_DSCF1_SIZE] = {
- 0x00, 0x03, 0x04, 0x04, 0x05, 0x06, 0x05, 0x06,
- 0x07, 0x08, 0x07, 0x08, 0x09, 0x0A, 0x07, 0x08,
- 0x09, 0x0A, 0x07, 0x08, 0x09, 0x06, 0x07, 0x05,
- 0x06, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x05, 0x04, 0x05, 0x05, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C,
- 0x0D, 0x09, 0x0A, 0x0B, 0x0C, 0x07, 0x08, 0x09,
- 0x05, 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x0D,
+static const uint8_t mpc8_dscf1_syms[MPC8_DSCF1_SIZE] = {
+     0, 59, 60, 61, 62, 63,  1,  2, 56, 57, 58,  3,  4,  5, 53, 54, 55,  6,  7,
+     8,  9, 49, 50, 51, 52, 64, 10, 11, 12, 13, 46, 47, 48, 14, 15, 16, 17, 43,
+    44, 45, 18, 19, 20, 41, 42, 21, 22, 39, 40, 23, 24, 38, 25, 37, 26, 35, 36,
+    27, 28, 34, 29, 30, 31, 32, 33,
 };
 static const uint8_t mpc8_dscf1_bits[MPC8_DSCF1_SIZE] = {
- 15, 14, 14, 13, 13, 13, 12, 12,
- 12, 12, 11, 11, 11, 11, 10, 10,
- 10, 10,  9,  9,  9,  8,  8,  7,
-  7,  6,  5,  4,  4,  3,  3,  3,
-  3,  3,  4,  5,  5,  6,  7,  8,
-  8,  9,  9, 10, 10, 10, 11, 11,
- 11, 12, 12, 12, 12, 13, 13, 13,
- 14, 14, 14, 15, 15, 15, 15, 15,
- 12,
+    15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12,
+    12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
+    10, 10,  9,  9,  9,  9,  9,  8,  8,  8,  8,  7,  7,  7,  6,  6,  5,  5,  5,
+     4,  4,  4,  3,  3,  3,  3,  3
 };
 
 #define MPC8_RES_SIZE 17
 #define MPC8_RES_BITS 9
 
-static const uint8_t mpc8_res_codes[2][MPC8_RES_SIZE] = {
+static const uint8_t mpc8_res_syms[2][MPC8_RES_SIZE] = {
   {
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
-    0x01,
+    13, 14, 12, 11, 10,  9,  8,  7,  6, 15,  5,  4,  3,  2, 16,  1,  0,
   },
   {
-    0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-    0x00, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01,
-    0x03,
+     8,  9, 10, 11,  7, 12,  6, 13,  5,  4, 14,  3, 15,  2,  0,  1, 16,
   }
 };
 static const uint8_t mpc8_res_bits[2][MPC8_RES_SIZE] = {
   {
-     1,  2,  4,  5,  6,  7,  9, 10,
-    11, 12, 13, 14, 15, 16, 16,  8,
-     3,
+    16, 16, 15, 14, 13, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  2,  1
   },
   {
-     2,  2,  3,  5,  7,  8, 10, 12,
-    14, 14, 14, 14, 11,  9,  6,  4,
-     2,
+    14, 14, 14, 14, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  2,  2,  2
   }
 };
 
 #define MPC8_Q1_SIZE 19
 #define MPC8_Q1_BITS 9
 
-static const uint8_t mpc8_q1_codes[MPC8_Q1_SIZE] = {
- 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x00, 0x01,
+static const uint8_t mpc8_q1_syms[MPC8_Q1_SIZE] = {
+     17, 18, 16, 15, 14, 13, 12,  0, 11,  1,  2,  8,  9, 10,  3,  4,  5,  6,  7,
 };
 static const uint8_t mpc8_q1_bits[MPC8_Q1_SIZE] = {
-  6,  4,  4,  3,  3,  3,  3,  3,
-  4,  4,  4,  5,  7,  8,  9, 10,
- 11, 12, 12,
+    12, 12, 11, 10,  9,  8,  7,  6,  5,  4,  4,  4,  4,  4,  3,  3,  3,  3,  3
 };
 
 #define MPC8_Q9UP_SIZE 256
 #define MPC8_Q9UP_BITS 9
 
-static const uint8_t mpc8_q9up_codes[MPC8_Q9UP_SIZE] = {
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x26, 0x27, 0x13, 0x14, 0x15,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
- 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
- 0x28, 0x26, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
- 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
- 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
- 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
- 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E,
- 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
- 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E,
- 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6A, 0x56, 0x57, 0x58, 0x59,
- 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x3E,
- 0x3F, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7A, 0x6B, 0x7B, 0x6C, 0x6D, 0x6E,
- 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E,
- 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,
- 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E,
- 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E,
- 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x27, 0x28, 0x29,
- 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4A, 0x4B, 0x06, 0x07, 0x08, 0x09, 0x00, 0x01,
+static const uint8_t mpc8_q9up_syms[MPC8_Q9UP_SIZE] = {
+    254, 255,   0,   1,   2,   3,   4, 250, 251, 252, 253,   5,   6,   7,   8,
+      9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  21,  22,  23,  24,  25,
+     26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  41,
+    213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
+    228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
+    243, 244, 245, 246, 247, 248, 249,  19,  20,  40,  42,  43,  44,  45,  46,
+     47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,
+     62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,
+     77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,
+     92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106,
+    107, 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
+    162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
+    177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
+    207, 208, 209, 210, 211, 212, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+    117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133,
+    134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 127,
+    128,
 };
 static const uint8_t mpc8_q9up_bits[MPC8_Q9UP_SIZE] = {
- 10, 10, 10, 10, 10,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  8,  9,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  6,
-  6,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  8,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9, 10, 10, 10, 10, 11, 11,
+    11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  7,  6,  6
 };
 
 #define MPC8_Q2_SIZE 125
 #define MPC8_Q2_BITS 9
 
-static const uint8_t mpc8_q2_codes[2][MPC8_Q2_SIZE] = {
+static const uint8_t mpc8_q2_syms[2][MPC8_Q2_SIZE] = {
 {
- 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x12,
- 0x0D, 0x06, 0x07, 0x13, 0x15, 0x14, 0x08, 0x09,
- 0x0E, 0x15, 0x0F, 0x0A, 0x03, 0x0B, 0x10, 0x0C,
- 0x01, 0x0D, 0x10, 0x16, 0x11, 0x0E, 0x12, 0x0F,
- 0x10, 0x16, 0x13, 0x17, 0x11, 0x08, 0x12, 0x18,
- 0x14, 0x13, 0x14, 0x17, 0x15, 0x0F, 0x16, 0x19,
- 0x17, 0x10, 0x11, 0x1A, 0x18, 0x1B, 0x12, 0x1C,
- 0x15, 0x09, 0x16, 0x1D, 0x19, 0x0A, 0x07, 0x0B,
- 0x1A, 0x1E, 0x17, 0x0C, 0x18, 0x1F, 0x13, 0x20,
- 0x1B, 0x21, 0x14, 0x11, 0x18, 0x22, 0x19, 0x12,
- 0x1A, 0x19, 0x1A, 0x1B, 0x1B, 0x23, 0x1C, 0x0D,
- 0x1D, 0x24, 0x1C, 0x1C, 0x1E, 0x1F, 0x1D, 0x13,
- 0x1E, 0x25, 0x1F, 0x14, 0x02, 0x15, 0x15, 0x16,
- 0x04, 0x17, 0x20, 0x26, 0x21, 0x18, 0x16, 0x27,
- 0x1D, 0x28, 0x19, 0x1A, 0x22, 0x29, 0x23, 0x1B,
- 0x03, 0x1C, 0x17, 0x1D, 0x05,
+      4,  24, 100, 120,   0,  20, 104, 124,   1,   3,   5,   9,  10,  14,  15,
+     19,  21,  23,  25,  29,  45,  49,  75,  79,  95,  99, 101, 103, 105, 109,
+    114, 115, 119, 121, 123,   2,  22,  50,  54,  70,  74, 102, 110, 122,   6,
+      8,  16,  18,  26,  28,  30,  34,  40,  44,  46,  48,  76,  78,  80,  84,
+     90,  94,  96,  98, 106, 108, 116, 118,   7,  11,  13,  17,  27,  35,  39,
+     47,  51,  53,  55,  59,  65,  69,  71,  73,  77,  85,  89,  97, 107, 111,
+    113, 117,  12,  33,  43,  52,  60,  64,  72,  91, 112,  31,  32,  36,  38,
+     41,  42,  56,  58,  66,  68,  81,  82,  83,  86,  88,  92,  93,  37,  57,
+     61,  63,  67,  87,  62,
 },
 {
- 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x0D,
- 0x0E, 0x06, 0x07, 0x0F, 0x1E, 0x10, 0x10, 0x08,
- 0x11, 0x12, 0x13, 0x09, 0x03, 0x0A, 0x11, 0x0B,
- 0x01, 0x0C, 0x14, 0x15, 0x16, 0x0D, 0x17, 0x12,
- 0x0E, 0x13, 0x18, 0x19, 0x14, 0x0F, 0x10, 0x1A,
- 0x1B, 0x15, 0x11, 0x16, 0x1C, 0x0E, 0x1D, 0x1E,
- 0x1F, 0x0F, 0x12, 0x20, 0x1F, 0x21, 0x13, 0x22,
- 0x12, 0x13, 0x14, 0x23, 0x20, 0x15, 0x0F, 0x16,
- 0x21, 0x24, 0x17, 0x18, 0x19, 0x25, 0x14, 0x26,
- 0x22, 0x27, 0x15, 0x10, 0x28, 0x29, 0x2A, 0x11,
- 0x2B, 0x17, 0x1A, 0x18, 0x2C, 0x2D, 0x1B, 0x1C,
- 0x19, 0x2E, 0x2F, 0x1A, 0x1D, 0x1B, 0x30, 0x12,
- 0x31, 0x32, 0x33, 0x13, 0x02, 0x14, 0x15, 0x16,
- 0x04, 0x17, 0x34, 0x35, 0x36, 0x18, 0x16, 0x37,
- 0x23, 0x38, 0x19, 0x1A, 0x39, 0x3A, 0x3B, 0x1B,
- 0x03, 0x1C, 0x17, 0x1D, 0x05,
+      4,  24, 100, 120,   0,  20, 104, 124,   1,   3,   5,   9,  10,  15,  19,
+     21,  23,  25,  29,  45,  49,  75,  79,  95,  99, 101, 102, 103, 105, 109,
+    114, 115, 119, 121, 123,   2,  14,  22,  50,  54,  70,  74, 110, 122,   6,
+      7,   8,  11,  13,  16,  17,  18,  26,  27,  28,  30,  34,  35,  39,  40,
+     44,  46,  47,  48,  51,  53,  55,  59,  65,  69,  71,  73,  76,  77,  78,
+     80,  84,  85,  89,  90,  94,  96,  97,  98, 106, 107, 108, 111, 113, 116,
+    117, 118,  12,  52,  60,  64,  72, 112,  31,  33,  36,  41,  43,  81,  83,
+     88,  91,  93,  32,  37,  38,  42,  56,  57,  58,  61,  63,  66,  67,  68,
+     82,  86,  87,  92,  62,
 }
 };
 static const uint8_t mpc8_q2_bits[2][MPC8_Q2_SIZE] = {
 {
- 12, 11, 10, 11, 13, 11,  9,  8,
-  9, 11, 11,  8,  7,  8, 11, 11,
-  9,  8,  9, 11, 12, 11, 10, 11,
- 13, 11,  9,  8,  9, 11,  9,  6,
-  6,  7,  9,  8,  6,  4,  6,  8,
-  9,  6,  6,  7,  9, 11,  9,  8,
-  9, 11, 10,  8,  7,  8, 10,  8,
-  6,  4,  6,  8,  7,  4,  3,  4,
-  7,  8,  6,  4,  6,  8, 10,  8,
-  7,  8, 10, 11,  9,  8,  9, 11,
-  9,  6,  6,  6,  9,  8,  6,  4,
-  6,  8,  9,  7,  6,  6,  9, 11,
-  9,  8,  9, 11, 13, 11, 10, 11,
- 12, 11,  9,  8,  9, 11, 10,  8,
-  7,  8, 11, 11,  9,  8,  9, 11,
- 13, 11, 10, 11, 12,
+    13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10,
+    10, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+     6,  6,  6,  6,  4,  4,  4,  4,  4,  4,  3
 },
 {
- 11, 10,  9, 10, 12, 10,  8,  8,
-  8, 10, 10,  8,  7,  8,  9, 10,
-  8,  8,  8, 10, 11, 10,  9, 10,
- 12, 10,  8,  8,  8, 10,  8,  6,
-  5,  6,  8,  8,  6,  5,  5,  8,
-  8,  6,  5,  6,  8, 10,  8,  8,
-  8, 10,  9,  8,  7,  8,  9,  8,
-  5,  5,  5,  8,  7,  5,  4,  5,
-  7,  8,  5,  5,  5,  8,  9,  8,
-  7,  8,  9, 10,  8,  8,  8, 10,
-  8,  6,  5,  6,  8,  8,  5,  5,
-  6,  8,  8,  6,  5,  6,  8, 10,
-  8,  8,  8, 10, 12, 10, 10, 10,
- 11, 10,  8,  8,  8, 10,  9,  8,
-  7,  8, 10, 10,  8,  8,  8, 10,
- 12, 10,  9, 10, 11,
+    12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,
+     7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,
+     5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  4
 }
 };
 
@@ -315,100 +210,56 @@ static const uint8_t mpc8_q2_bits[2][MPC8_Q2_SIZE] = {
 #define MPC8_Q3_BITS 9
 #define MPC8_Q3_OFFSET -48
 
-static const uint8_t mpc8_q3_codes[MPC8_Q3_SIZE] = {
- 0x07, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x0F,
- 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x13, 0x12, 0x11,
- 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09,
- 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
- 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
- 0x00,
-};
 static const uint8_t mpc8_q3_bits[MPC8_Q3_SIZE] = {
-  3,  4,  4,  4,  4,  4,  4,  5,
-  5,  5,  5,  5,  5,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,
+    9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,
+    7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,
+    5,  5,  5,  5,  4,  4,  4,  4,  4,  4,  3,
 };
 static const uint8_t mpc8_q3_syms[MPC8_Q3_SIZE] = {
-   48,    65,    64,    49,    63,    32,    47,    80,
-   79,    50,    62,    33,    16,    82,    81,    95,
-   94,    66,    78,    34,    46,    17,    31,    30,
-   97,    96,   111,    67,    77,    51,    61,    35,
-   45,    18,     1,     0,    15,    98,   110,    83,
-   93,    19,    29,     2,    14,    99,   109,     3,
-   13,
+     13,   3, 109,  99,  14,   2,  29,  19,  93,  83, 110,  98,  15,   0,   1,
+     18,  45,  35,  61,  51,  77,  67, 111,  96,  97,  30,  31,  17,  46,  34,
+     78,  66,  94,  95,  81,  82,  16,  33,  62,  50,  79,  80,  47,  32,  63,
+     49,  64,  65,  48,
 };
 
 #define MPC8_Q4_SIZE 81
 #define MPC8_Q4_BITS 9
 #define MPC8_Q4_OFFSET -64
 
-static const uint8_t mpc8_q4_codes[MPC8_Q4_SIZE] = {
- 0x0F, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17,
- 0x16, 0x15, 0x14, 0x13, 0x12, 0x23, 0x22, 0x21,
- 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19,
- 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11,
- 0x10, 0x0F, 0x0E, 0x0D, 0x19, 0x18, 0x17, 0x16,
- 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0F, 0x0E,
- 0x0D, 0x0C, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12,
- 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
- 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
- 0x00,
-};
 static const uint8_t mpc8_q4_bits[MPC8_Q4_SIZE] = {
-  4,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  5,  5,  5,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10,
+    10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,  5,
+     5,  5,  5,  5,  4,
 };
 static const uint8_t mpc8_q4_syms[MPC8_Q4_SIZE] = {
-   64,    96,    81,    80,    95,    66,    65,    79,
-   78,    49,    48,    63,    32,   113,   112,    98,
-   97,   111,   110,    83,    82,    94,    93,    67,
-   77,    51,    50,    62,    61,    34,    33,    47,
-   46,    17,    16,    31,   128,   114,   127,   126,
-   99,   109,    68,    76,    35,    45,    18,    30,
-    0,    15,   130,   129,   143,   142,   115,   125,
-  100,   108,    84,    92,    52,    60,    36,    44,
-   19,    29,     2,     1,    14,   131,   141,   116,
-  124,    20,    28,     3,    13,   132,   140,     4,
-   12,
+     12,   4, 140, 132,  13,   3,  28,  20, 124, 116, 141, 131,  14,   1,   2,
+     29,  19,  44,  36,  60,  52,  92,  84, 108, 100, 125, 115, 142, 143, 129,
+    130,  15,   0,  30,  18,  45,  35,  76,  68, 109,  99, 126, 127, 114, 128,
+     31,  16,  17,  46,  47,  33,  34,  61,  62,  50,  51,  77,  67,  93,  94,
+     82,  83, 110, 111,  97,  98, 112, 113,  32,  63,  48,  49,  78,  79,  65,
+     66,  95,  80,  81,  96,  64,
 };
 
 #define MPC8_Q5_SIZE 15
 #define MPC8_Q5_BITS 7
 #define MPC8_Q5_OFFSET -7
 
-static const uint8_t mpc8_q5_codes[2][MPC8_Q5_SIZE] = {
+static const uint8_t mpc8_q5_syms[2][MPC8_Q5_SIZE] = {
 {
- 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03,
- 0x04, 0x05, 0x03, 0x03, 0x03, 0x02, 0x03,
+     0,  1, 13, 14,  2, 12,  3, 11,  4, 10,  5,  6,  8,  9,  7,
 },
 {
- 0x00, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x04, 0x05, 0x03, 0x02, 0x03,
+     0,  1, 13, 14,  2, 12,  3,  4, 10, 11,  5,  6,  7,  8,  9,
 }
 };
 static const uint8_t mpc8_q5_bits[2][MPC8_Q5_SIZE] = {
 {
-  7,  7,  6,  5,  4,  3,  3,  2,
-  3,  3,  4,  5,  6,  7,  7,
+    7,  7,  7,  7,  6,  6,  5,  5,  4,  4,  3,  3,  3,  3,  2
 },
 {
-  6,  6,  5,  4,  4,  3,  3,  3,
-  3,  3,  4,  4,  5,  6,  6,
+    6,  6,  6,  6,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  3
 }
 };
 
@@ -416,32 +267,24 @@ static const uint8_t mpc8_q5_bits[2][MPC8_Q5_SIZE] = {
 #define MPC8_Q6_BITS 9
 #define MPC8_Q6_OFFSET -15
 
-static const uint8_t mpc8_q6_codes[2][MPC8_Q6_SIZE] = {
+static const uint8_t mpc8_q6_syms[2][MPC8_Q6_SIZE] = {
 {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x04, 0x03,
- 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x04, 0x03,
- 0x05, 0x06, 0x07, 0x07, 0x06, 0x07, 0x08, 0x09,
- 0x05, 0x06, 0x07, 0x04, 0x05, 0x06, 0x07,
+      0,  1,  2,  3, 27, 28, 29, 30,  4,  5, 25, 26,  6, 24,  7,  8,  9, 20, 21,
+     22, 23, 10, 11, 19, 12, 13, 17, 18, 14, 16, 15,
 },
 {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x04, 0x05, 0x04,
- 0x05, 0x06, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x07, 0x08, 0x09,
- 0x06, 0x07, 0x05, 0x06, 0x07, 0x02, 0x03,
+      0,  1, 29, 30,  2,  3,  4, 26, 27, 28,  5,  6, 24, 25,  7,  8,  9, 21, 22,
+     23, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
 }
 };
 static const uint8_t mpc8_q6_bits[2][MPC8_Q6_SIZE] = {
 {
-  9,  9,  9,  9,  8,  8,  7,  6,
-  6,  6,  5,  5,  4,  4,  3,  2,
-  3,  4,  4,  5,  6,  6,  6,  6,
-  7,  8,  8,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  7,  7,  6,  6,  6,  6,  6,
+    6,  6,  5,  5,  5,  4,  4,  4,  4,  3,  3,  2
 },
 {
-  8,  8,  7,  7,  7,  6,  6,  5,
-  5,  5,  4,  4,  4,  4,  4,  4,
-  4,  4,  4,  4,  4,  5,  5,  5,
-  6,  6,  7,  7,  7,  8,  8,
+    8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  5,  5,  5,  5,  5,
+    5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4
 }
 };
 
@@ -449,48 +292,32 @@ static const uint8_t mpc8_q6_bits[2][MPC8_Q6_SIZE] = {
 #define MPC8_Q7_BITS 9
 #define MPC8_Q7_OFFSET -31
 
-static const uint8_t mpc8_q7_codes[2][MPC8_Q7_SIZE] = {
+static const uint8_t mpc8_q7_syms[2][MPC8_Q7_SIZE] = {
 {
- 0x00, 0x01, 0x02, 0x08, 0x09, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x0A, 0x0B, 0x0C, 0x0D, 0x0A, 0x0B,
- 0x0C, 0x0D, 0x0E, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0A, 0x0B, 0x0C, 0x08, 0x09, 0x06, 0x04, 0x03,
- 0x05, 0x07, 0x0A, 0x0B, 0x0D, 0x0E, 0x0F, 0x0F,
- 0x10, 0x11, 0x12, 0x0F, 0x13, 0x10, 0x11, 0x12,
- 0x13, 0x0E, 0x0F, 0x10, 0x11, 0x08, 0x09, 0x0A,
- 0x0B, 0x0C, 0x12, 0x13, 0x0D, 0x0E, 0x0F,
+      0,  1,  2,  5,  6,  7,  8,  9, 53, 54, 55, 56, 57, 60, 61, 62,  3,  4, 10,
+     11, 12, 13, 49, 50, 51, 52, 58, 59, 14, 15, 16, 17, 18, 43, 45, 46, 47, 48,
+     19, 20, 21, 22, 23, 39, 40, 41, 42, 44, 24, 25, 26, 36, 37, 38, 27, 28, 34,
+     35, 29, 33, 30, 32, 31,
 },
 {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
- 0x1E, 0x1F, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
- 0x17, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x02, 0x03,
+      0,  1, 61, 62,  2,  3,  4,  5,  6,  7,  8, 54, 55, 56, 57, 58, 59, 60,  9,
+     10, 11, 12, 13, 49, 50, 51, 52, 53, 14, 15, 16, 17, 18, 19, 20, 21, 42, 43,
+     44, 45, 46, 47, 48, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+     36, 37, 38, 39, 40, 41,
 }
 };
 static const uint8_t mpc8_q7_bits[2][MPC8_Q7_SIZE] = {
 {
- 10, 10, 10,  9,  9, 10, 10, 10,
- 10, 10,  9,  9,  9,  9,  8,  8,
-  8,  8,  8,  7,  7,  7,  7,  7,
-  6,  6,  6,  5,  5,  4,  3,  2,
-  3,  4,  5,  5,  6,  6,  6,  7,
-  7,  7,  7,  8,  7,  8,  8,  8,
-  8,  9,  9,  9,  9, 10, 10, 10,
- 10, 10,  9,  9, 10, 10, 10,
+    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  5,  5,  5,
+     5,  4,  4,  3,  3,  2
 },
 {
-  9,  9,  8,  8,  8,  8,  8,  8,
-  8,  7,  7,  7,  7,  7,  6,  6,
-  6,  6,  6,  6,  6,  6,  5,  5,
-  5,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  6,  6,  6,  6,  6,  6,
-  6,  7,  7,  7,  7,  7,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,
+     9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,
+     7,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+     6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,
+     5,  5,  5,  5,  5,  5
 }
 };
 
@@ -498,80 +325,48 @@ static const uint8_t mpc8_q7_bits[2][MPC8_Q7_SIZE] = {
 #define MPC8_Q8_BITS 9
 #define MPC8_Q8_OFFSET -63
 
-static const uint8_t mpc8_q8_codes[2][MPC8_Q8_SIZE] = {
+static const uint8_t mpc8_q8_syms[2][MPC8_Q8_SIZE] = {
 {
- 0x03, 0x04, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x1A,
- 0x0F, 0x1B, 0x10, 0x00, 0x01, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x11, 0x0C, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1C, 0x1A,
- 0x1B, 0x1C, 0x1D, 0x1E, 0x1D, 0x1E, 0x1F, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x19, 0x25, 0x1A, 0x1B,
- 0x1C, 0x1D, 0x1E, 0x1F, 0x14, 0x15, 0x16, 0x17,
- 0x0E, 0x0F, 0x10, 0x11, 0x0B, 0x07, 0x04, 0x03,
- 0x05, 0x0C, 0x0D, 0x12, 0x13, 0x14, 0x15, 0x18,
- 0x19, 0x1A, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24,
- 0x25, 0x26, 0x27, 0x26, 0x27, 0x28, 0x29, 0x2A,
- 0x2B, 0x2C, 0x2D, 0x2E, 0x1F, 0x20, 0x2F, 0x21,
- 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
- 0x0D, 0x0E, 0x2A, 0x0F, 0x10, 0x11, 0x12, 0x02,
- 0x13, 0x03, 0x04, 0x05, 0x2B, 0x2C, 0x30, 0x31,
- 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
+     11,  12, 111, 113, 114, 115,   0,   1,  13,  14,  15,  16,  17,  18,  19,
+     21, 104, 105, 107, 108, 109, 110, 112,   2,   3,   4,   5,   6,   8,  10,
+     20,  22,  23,  24,  25,  26,  27,  28,  29,  31,  32,  33,  34,  35,  92,
+     93,  95,  96,  97,  98,  99, 100, 101, 102, 103, 106, 116, 117, 120, 121,
+    122, 123, 124, 125, 126,   7,   9,  30,  36,  37,  38,  39,  40,  41,  42,
+     43,  45,  83,  84,  85,  86,  87,  88,  89,  90,  91,  94, 118, 119,  44,
+     46,  47,  48,  49,  50,  51,  75,  76,  77,  78,  79,  80,  81,  82,  52,
+     53,  54,  55,  71,  72,  73,  74,  56,  57,  58,  59,  67,  68,  69,  70,
+     60,  65,  66,  61,  62,  64,  63,
 },
 {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x15, 0x16,
- 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
- 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
- 0x2F, 0x30, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
- 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
- 0x3C, 0x3D, 0x3E, 0x31, 0x3F, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
- 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44,
- 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x16,
- 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
- 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x27, 0x28, 0x29, 0x04, 0x05, 0x06, 0x07,
+      0,   1,   2,   3, 123, 124, 125, 126,   4,   5,   6,   7,   8,   9,  10,
+     11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21, 103, 104, 105, 106,
+    107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+    122,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,
+     36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  75,
+     77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,
+     92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102,  50,  51,  52,  53,
+     54,  55,  56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,
+     69,  70,  71,  72,  73,  74,  76,
 }
 };
 static const uint8_t mpc8_q8_bits[2][MPC8_Q8_SIZE] = {
 {
- 11, 11, 10, 10, 10, 10, 10,  9,
- 10,  9, 10, 12, 12, 11, 11, 11,
- 11, 11, 11, 11, 10, 11, 10, 10,
- 10, 10, 10, 10, 10, 10,  9, 10,
- 10, 10, 10, 10,  9,  9,  9,  9,
-  9,  9,  9,  9,  8,  9,  8,  8,
-  8,  8,  8,  8,  7,  7,  7,  7,
-  6,  6,  6,  6,  5,  4,  3,  2,
-  3,  5,  5,  6,  6,  6,  6,  7,
-  7,  7,  7,  8,  8,  8,  8,  8,
-  8,  8,  8,  9,  9,  9,  9,  9,
-  9,  9,  9,  9, 10, 10,  9, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 10, 11, 11, 11, 11, 12,
- 11, 12, 12, 12, 10, 10,  9,  9,
- 10, 10, 10, 10, 10, 10, 10,
+    12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+    11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+    10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,
+     6,  6,  6,  6,  6,  6,  5,  5,  5,  4,  3,  3,  2
 },
 {
-  9,  9,  9,  9,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  7,  6,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  9,  9,  9,  9,
+     9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+     8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
+     7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6
 }
 };
 
-- 
2.25.1



More information about the ffmpeg-devel mailing list