diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-04 20:41:35 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:46 +0100 |
commit | b52e0d9504d1b45bc64489262facc8e48adb9bc2 (patch) | |
tree | 44b498e0d3987bd6dfca02c73eeeeb2d81440fc6 /libavcodec | |
parent | 5ac9d78dd2977e9e9021749e215d7208c2a56f39 (diff) | |
download | ffmpeg-b52e0d9504d1b45bc64489262facc8e48adb9bc2.tar.gz |
avcodec/atrac9tab: Unify tables used to initialize VLCs
Using separate tables has the downside that one needs a big number of
pointers to the separate tables (currently 77); unifying them avoids
this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/atrac9dec.c | 19 | ||||
-rw-r--r-- | libavcodec/atrac9tab.h | 310 |
2 files changed, 120 insertions, 209 deletions
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index 5a78958059..b7a46784fb 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -848,6 +848,7 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx) GetBitContext gb; ATRAC9Context *s = avctx->priv_data; int version, block_config_idx, superframe_idx, alloc_c_len; + const uint8_t (*tab)[2]; int ret; s->avctx = avctx; @@ -932,17 +933,20 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx) s->alloc_curve[i - 1][j] = at9_tab_b_dist[(j * alloc_c_len) / i]; /* Unsigned scalefactor VLCs */ + tab = at9_sfb_a_tab; for (int i = 1; i < 7; i++) { const HuffmanCodebook *hf = &at9_huffman_sf_unsigned[i]; ret = ff_init_vlc_from_lengths(&s->sf_vlc[0][i], ATRAC9_SF_VLC_BITS, - hf->size, &hf->tab[0][1], 2, - &hf->tab[0][0], 2, 1, 0, 0, avctx); + hf->size, &tab[0][1], 2, + &tab[0][0], 2, 1, 0, 0, avctx); if (ret < 0) return ret; + tab += hf->size; } /* Signed scalefactor VLCs */ + tab = at9_sfb_b_tab; for (int i = 2; i < 6; i++) { const HuffmanCodebook *hf = &at9_huffman_sf_signed[i]; @@ -950,22 +954,25 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx) * the values in the source table are offset by 16 to make * them fit into an uint8_t; the -16 reverses this shift. */ ret = ff_init_vlc_from_lengths(&s->sf_vlc[1][i], ATRAC9_SF_VLC_BITS, - hf->size, &hf->tab[0][1], 2, - &hf->tab[0][0], 2, 1, -16, 0, avctx); + hf->size, &tab[0][1], 2, + &tab[0][0], 2, 1, -16, 0, avctx); if (ret < 0) return ret; + tab += hf->size; } /* Coefficient VLCs */ + tab = at9_coeffs_tab; for (int i = 0; i < 2; i++) { for (int j = 0; j < 8; j++) { for (int k = 0; k < 4; k++) { const HuffmanCodebook *hf = &at9_huffman_coeffs[i][j][k]; ret = ff_init_vlc_from_lengths(&s->coeff_vlc[i][j][k], 9, - hf->size, &hf->tab[0][1], 2, - &hf->tab[0][0], 2, 1, 0, 0, avctx); + hf->size, &tab[0][1], 2, + &tab[0][0], 2, 1, 0, 0, avctx); if (ret < 0) return ret; + tab += hf->size; } } } diff --git a/libavcodec/atrac9tab.h b/libavcodec/atrac9tab.h index 1cc0b0ce3a..b169035aad 100644 --- a/libavcodec/atrac9tab.h +++ b/libavcodec/atrac9tab.h @@ -373,34 +373,25 @@ static const uint8_t at9_tab_b_dist[] = { 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, }; -static const uint8_t huff_sfb_a1_tab[2][2] = { +static const uint8_t at9_sfb_a_tab[][2] = { + /* Unsigned scalefactor table 1 - 2 entries */ { 0, 1 }, { 1, 1 }, -}; - -static const uint8_t huff_sfb_a2_tab[4][2] = { + /* Unsigned scalefactor table 2 - 4 entries */ { 0, 1 }, { 3, 2 }, { 1, 3 }, { 2, 3 }, -}; - -static const uint8_t huff_sfb_a3_tab[8][2] = { + /* Unsigned scalefactor table 3 - 8 entries */ { 0, 2 }, { 1, 2 }, { 7, 2 }, { 6, 3 }, { 2, 4 }, { 5, 5 }, { 3, 6 }, { 4, 6 }, -}; - -static const uint8_t huff_sfb_a4_tab[16][2] = { + /* Unsigned scalefactor table 4 - 16 entries */ { 2, 4 }, { 14, 4 }, { 11, 8 }, { 10, 8 }, { 9, 8 }, { 6, 8 }, { 7, 8 }, { 8, 8 }, { 5, 7 }, { 13, 5 }, { 3, 5 }, { 12, 6 }, { 4, 6 }, { 0, 2 }, { 1, 2 }, { 15, 2 }, -}; - -static const uint8_t huff_sfb_a5_tab[32][2] = { + /* Unsigned scalefactor table 5 - 32 entries */ { 31, 3 }, { 1, 3 }, { 26, 7 }, { 7, 7 }, { 20, 8 }, { 21, 8 }, { 23, 8 }, { 22, 8 }, { 29, 5 }, { 30, 4 }, { 4, 5 }, { 11, 8 }, { 24, 8 }, { 9, 8 }, { 10, 8 }, { 6, 6 }, { 25, 7 }, { 19, 8 }, { 12, 8 }, { 27, 6 }, { 18, 8 }, { 13, 8 }, { 16, 8 }, { 17, 8 }, { 14, 8 }, { 15, 8 }, { 8, 7 }, { 0, 2 }, { 5, 5 }, { 28, 5 }, { 3, 4 }, { 2, 3 }, -}; - -static const uint8_t huff_sfb_a6_tab[64][2] = { + /* Unsigned scalefactor table 6 - 64 entries */ { 0, 3 }, { 1, 3 }, { 2, 4 }, { 3, 4 }, { 61, 4 }, { 62, 4 }, { 63, 4 }, { 4, 5 }, { 5, 5 }, { 58, 5 }, { 59, 5 }, { 60, 5 }, { 6, 6 }, { 7, 6 }, { 8, 6 }, { 56, 6 }, { 57, 6 }, { 9, 7 }, { 10, 7 }, { 53, 7 }, { 54, 7 }, @@ -413,21 +404,16 @@ static const uint8_t huff_sfb_a6_tab[64][2] = { { 52, 8 }, }; -static const uint8_t huff_sfb_b2_tab[3][2] = { +static const uint8_t at9_sfb_b_tab[][2] = { + /* Signed scalefactor table 2 - 3 entries */ { 16, 1 }, { 15, 2 }, { 17, 2 }, -}; - -static const uint8_t huff_sfb_b3_tab[7][2] = { + /* Signed scalefactor table 3 - 7 entries */ { 17, 3 }, { 18, 5 }, { 13, 6 }, { 19, 6 }, { 14, 4 }, { 15, 2 }, { 16, 1 }, -}; - -static const uint8_t huff_sfb_b4_tab[15][2] = { + /* Signed scalefactor table 4 - 15 entries */ { 15, 3 }, { 17, 3 }, { 18, 4 }, { 13, 6 }, { 12, 6 }, { 21, 7 }, { 22, 8 }, { 10, 8 }, { 9, 8 }, { 23, 8 }, { 11, 7 }, { 14, 4 }, { 19, 5 }, { 20, 5 }, { 16, 1 }, -}; - -static const uint8_t huff_sfb_b5_tab[32][2] = { + /* Signed scalefactor table 5 - 32 entries */ { 16, 3 }, { 21, 4 }, { 22, 4 }, { 20, 4 }, { 23, 4 }, { 30, 8 }, { 1, 8 }, { 0, 8 }, { 2, 8 }, { 3, 8 }, { 31, 8 }, { 27, 7 }, { 14, 6 }, { 28, 7 }, { 13, 7 }, { 18, 4 }, { 25, 5 }, { 12, 7 }, { 11, 7 }, { 26, 6 }, { 24, 4 }, @@ -436,7 +422,6 @@ static const uint8_t huff_sfb_b5_tab[32][2] = { }; typedef struct HuffmanCodebook { - const uint8_t (*tab)[2]; const int size; const int value_cnt; const int value_cnt_pow; @@ -445,29 +430,28 @@ typedef struct HuffmanCodebook { static const HuffmanCodebook at9_huffman_sf_unsigned[] = { { 0 }, - { huff_sfb_a1_tab, 2, 1, 0, 1 }, - { huff_sfb_a2_tab, 4, 1, 0, 2 }, - { huff_sfb_a3_tab, 8, 1, 0, 3 }, - { huff_sfb_a4_tab, 16, 1, 0, 4 }, - { huff_sfb_a5_tab, 32, 1, 0, 5 }, - { huff_sfb_a6_tab, 64, 1, 0, 6 }, + { 2, 1, 0, 1 }, + { 4, 1, 0, 2 }, + { 8, 1, 0, 3 }, + { 16, 1, 0, 4 }, + { 32, 1, 0, 5 }, + { 64, 1, 0, 6 }, }; static const HuffmanCodebook at9_huffman_sf_signed[] = { { 0 }, { 0 }, - { huff_sfb_b2_tab, 3, 1, 0, 2 }, - { huff_sfb_b3_tab, 7, 1, 0, 3 }, - { huff_sfb_b4_tab, 15, 1, 0, 4 }, - { huff_sfb_b5_tab, 32, 1, 0, 5 }, + { 3, 1, 0, 2 }, + { 7, 1, 0, 3 }, + { 15, 1, 0, 4 }, + { 32, 1, 0, 5 }, }; -static const uint8_t huff_spec_a21_tab[8][2] = { +static const uint8_t at9_coeffs_tab[][2] = { + /* Coefficient table A.2.1 - 8 entries */ { 1, 3 }, { 3, 3 }, { 12, 3 }, { 4, 3 }, { 7, 3 }, { 13, 3 }, { 15, 3 }, { 5, 3 }, -}; - -static const uint8_t huff_spec_a22_tab[80][2] = { + /* Coefficient table A.2.2 - 80 entries */ { 17, 6 }, { 51, 6 }, { 81, 7 }, { 243, 7 }, { 69, 7 }, { 207, 7 }, { 205, 7 }, { 71, 7 }, { 209, 7 }, { 115, 7 }, { 245, 7 }, { 95, 7 }, { 125, 7 }, { 215, 7 }, { 1, 4 }, @@ -484,9 +468,7 @@ static const uint8_t huff_spec_a22_tab[80][2] = { { 76, 6 }, { 53, 7 }, { 31, 7 }, { 197, 7 }, { 79, 7 }, { 49, 6 }, { 19, 6 }, { 61, 7 }, { 23, 7 }, { 68, 7 }, { 204, 7 }, { 5, 6 }, { 15, 6 }, { 13, 6 }, { 7, 6 }, -}; - -static const uint8_t huff_spec_a23_tab[81][2] = { + /* Coefficient table A.2.3 - 81 entries */ { 65, 6 }, { 195, 6 }, { 193, 6 }, { 67, 6 }, { 197, 7 }, { 79, 7 }, { 77, 7 }, { 199, 7 }, { 241, 7 }, { 83, 7 }, { 244, 7 }, { 92, 7 }, { 1, 4 }, { 3, 4 }, { 20, 6 }, @@ -504,9 +486,7 @@ static const uint8_t huff_spec_a23_tab[81][2] = { { 85, 9 }, { 255, 9 }, { 113, 8 }, { 211, 8 }, { 4, 5 }, { 12, 5 }, { 0, 3 }, { 16, 5 }, { 48, 5 }, { 64, 5 }, { 192, 5 }, -}; - -static const uint8_t huff_spec_a24_tab[81][2] = { + /* Coefficient table A.2.4 - 81 entries */ { 20, 6 }, { 60, 6 }, { 52, 6 }, { 28, 6 }, { 80, 6 }, { 240, 6 }, { 208, 6 }, { 112, 6 }, { 1, 4 }, { 3, 4 }, { 5, 6 }, { 15, 6 }, { 13, 6 }, { 7, 6 }, { 84, 8 }, @@ -524,9 +504,7 @@ static const uint8_t huff_spec_a24_tab[81][2] = { { 247, 10 }, { 85, 10 }, { 255, 10 }, { 116, 9 }, { 220, 9 }, { 16, 5 }, { 48, 5 }, { 64, 5 }, { 192, 5 }, { 4, 5 }, { 12, 5 }, -}; - -static const uint8_t huff_spec_a31_tab[40][2] = { + /* Coefficient table A.3.1 - 40 entries */ { 50, 5 }, { 22, 5 }, { 11, 5 }, { 61, 5 }, { 2, 4 }, { 6, 4 }, { 59, 5 }, { 13, 5 }, { 17, 5 }, { 55, 5 }, { 49, 5 }, { 23, 5 }, { 24, 5 }, { 40, 5 }, { 26, 6 }, @@ -535,9 +513,7 @@ static const uint8_t huff_spec_a31_tab[40][2] = { { 21, 6 }, { 3, 5 }, { 5, 5 }, { 16, 5 }, { 48, 5 }, { 25, 6 }, { 47, 6 }, { 41, 6 }, { 31, 6 }, { 27, 7 }, { 45, 7 }, { 43, 7 }, { 29, 7 }, { 18, 6 }, { 54, 6 }, -}; - -static const uint8_t huff_spec_a32_tab[49][2] = { + /* Coefficient table A.3.2 - 49 entries */ { 57, 5 }, { 15, 5 }, { 17, 5 }, { 55, 5 }, { 49, 5 }, { 23, 5 }, { 58, 5 }, { 14, 5 }, { 10, 5 }, { 62, 5 }, { 43, 7 }, { 29, 7 }, { 27, 7 }, { 45, 7 }, { 25, 6 }, @@ -548,9 +524,7 @@ static const uint8_t huff_spec_a32_tab[49][2] = { { 7, 5 }, { 0, 4 }, { 42, 7 }, { 30, 7 }, { 26, 7 }, { 46, 7 }, { 3, 6 }, { 5, 6 }, { 19, 7 }, { 53, 7 }, { 51, 7 }, { 21, 7 }, { 9, 6 }, { 63, 6 }, -}; - -static const uint8_t huff_spec_a33_tab[49][2] = { + /* Coefficient table A.3.3 - 49 entries */ { 51, 7 }, { 21, 7 }, { 19, 7 }, { 53, 7 }, { 24, 6 }, { 40, 6 }, { 50, 6 }, { 22, 6 }, { 18, 6 }, { 54, 6 }, { 3, 6 }, { 5, 6 }, { 43, 8 }, { 29, 8 }, { 27, 8 }, @@ -561,9 +535,7 @@ static const uint8_t huff_spec_a33_tab[49][2] = { { 59, 7 }, { 13, 7 }, { 26, 8 }, { 46, 8 }, { 42, 8 }, { 30, 8 }, { 49, 6 }, { 23, 6 }, { 17, 6 }, { 55, 6 }, { 58, 6 }, { 14, 6 }, { 10, 6 }, { 62, 6 }, -}; - -static const uint8_t huff_spec_a34_tab[49][2] = { + /* Coefficient table A.3.4 - 49 entries */ { 0, 2 }, { 16, 5 }, { 48, 5 }, { 2, 5 }, { 6, 5 }, { 26, 8 }, { 46, 8 }, { 51, 8 }, { 21, 8 }, { 24, 7 }, { 40, 7 }, { 3, 7 }, { 5, 7 }, { 19, 8 }, { 53, 8 }, @@ -574,9 +546,7 @@ static const uint8_t huff_spec_a34_tab[49][2] = { { 11, 8 }, { 61, 8 }, { 59, 8 }, { 13, 8 }, { 43, 10 }, { 29, 10 }, { 27, 10 }, { 45, 10 }, { 42, 9 }, { 30, 9 }, { 9, 5 }, { 63, 5 }, { 57, 5 }, { 15, 5 }, -}; - -static const uint8_t huff_spec_a41_tab[176][2] = { + /* Coefficient table A.4.1 - 176 entries */ { 83, 7 }, { 189, 7 }, { 68, 7 }, { 204, 7 }, { 23, 7 }, { 249, 7 }, { 166, 8 }, { 106, 8 }, { 183, 8 }, { 89, 8 }, { 52, 7 }, { 220, 7 }, { 161, 7 }, { 111, 7 }, { 179, 7 }, @@ -613,9 +583,7 @@ static const uint8_t huff_spec_a41_tab[176][2] = { { 185, 9 }, { 112, 8 }, { 144, 8 }, { 245, 7 }, { 27, 7 }, { 64, 7 }, { 192, 7 }, { 67, 8 }, { 205, 8 }, { 195, 8 }, { 77, 8 }, -}; - -static const uint8_t huff_spec_a42_tab[225][2] = { + /* Coefficient table A.4.2 - 225 entries */ { 3, 7 }, { 13, 7 }, { 113, 8 }, { 159, 8 }, { 163, 8 }, { 109, 8 }, { 16, 6 }, { 240, 6 }, { 81, 7 }, { 191, 7 }, { 177, 7 }, { 95, 7 }, { 0, 5 }, { 112, 8 }, { 144, 8 }, @@ -661,9 +629,7 @@ static const uint8_t huff_spec_a42_tab[225][2] = { { 41, 9 }, { 229, 8 }, { 43, 8 }, { 48, 8 }, { 208, 8 }, { 37, 8 }, { 235, 8 }, { 34, 8 }, { 238, 8 }, { 226, 8 }, { 46, 8 }, { 39, 9 }, { 233, 9 }, { 145, 9 }, { 127, 9 }, -}; - -static const uint8_t huff_spec_a43_tab[225][2] = { + /* Coefficient table A.4.3 - 225 entries */ { 246, 8 }, { 26, 8 }, { 22, 8 }, { 250, 8 }, { 210, 7 }, { 62, 7 }, { 50, 7 }, { 222, 7 }, { 53, 8 }, { 219, 8 }, { 231, 9 }, { 41, 9 }, { 39, 9 }, { 233, 9 }, { 16, 5 }, @@ -709,9 +675,7 @@ static const uint8_t huff_spec_a43_tab[225][2] = { { 93, 9 }, { 70, 10 }, { 202, 10 }, { 146, 10 }, { 126, 10 }, { 213, 9 }, { 59, 9 }, { 18, 7 }, { 254, 7 }, { 225, 7 }, { 47, 7 }, { 242, 7 }, { 30, 7 }, { 1, 6 }, { 15, 6 }, -}; - -static const uint8_t huff_spec_a44_tab[225][2] = { + /* Coefficient table A.4.4 - 225 entries */ { 193, 7 }, { 79, 7 }, { 20, 7 }, { 252, 7 }, { 151, 10 }, { 121, 10 }, { 119, 10 }, { 153, 10 }, { 118, 10 }, { 154, 10 }, { 150, 10 }, { 122, 10 }, { 167, 10 }, { 105, 10 }, { 103, 10 }, @@ -757,9 +721,7 @@ static const uint8_t huff_spec_a44_tab[225][2] = { { 238, 7 }, { 226, 7 }, { 46, 7 }, { 229, 9 }, { 43, 9 }, { 38, 10 }, { 234, 10 }, { 230, 10 }, { 42, 10 }, { 65, 8 }, { 207, 8 }, { 17, 6 }, { 255, 6 }, { 241, 6 }, { 31, 6 }, -}; - -static const uint8_t huff_spec_a51_tab[31][2] = { + /* Coefficient table A.5.1 - 31 entries */ { 8, 4 }, { 24, 4 }, { 15, 5 }, { 17, 5 }, { 4, 5 }, { 28, 5 }, { 9, 4 }, { 23, 4 }, { 14, 5 }, { 18, 5 }, { 3, 5 }, { 29, 5 }, { 13, 5 }, { 19, 5 }, { 2, 5 }, @@ -767,9 +729,7 @@ static const uint8_t huff_spec_a51_tab[31][2] = { { 7, 6 }, { 25, 6 }, { 0, 5 }, { 11, 5 }, { 21, 5 }, { 6, 6 }, { 26, 6 }, { 5, 6 }, { 27, 6 }, { 10, 5 }, { 22, 5 }, -}; - -static const uint8_t huff_spec_a52_tab[31][2] = { + /* Coefficient table A.5.2 - 31 entries */ { 2, 4 }, { 30, 4 }, { 11, 5 }, { 21, 5 }, { 7, 5 }, { 25, 5 }, { 1, 4 }, { 31, 4 }, { 6, 5 }, { 26, 5 }, { 10, 5 }, { 22, 5 }, { 15, 6 }, { 17, 6 }, { 14, 6 }, @@ -777,9 +737,7 @@ static const uint8_t huff_spec_a52_tab[31][2] = { { 23, 5 }, { 8, 5 }, { 24, 5 }, { 4, 5 }, { 28, 5 }, { 13, 6 }, { 19, 6 }, { 12, 6 }, { 20, 6 }, { 3, 5 }, { 29, 5 }, -}; - -static const uint8_t huff_spec_a53_tab[31][2] = { + /* Coefficient table A.5.3 - 31 entries */ { 0, 3 }, { 9, 5 }, { 23, 5 }, { 7, 5 }, { 25, 5 }, { 3, 4 }, { 29, 4 }, { 8, 5 }, { 24, 5 }, { 15, 7 }, { 17, 7 }, { 14, 7 }, { 18, 7 }, { 11, 6 }, { 21, 6 }, @@ -787,9 +745,7 @@ static const uint8_t huff_spec_a53_tab[31][2] = { { 27, 5 }, { 1, 4 }, { 31, 4 }, { 10, 6 }, { 22, 6 }, { 13, 7 }, { 19, 7 }, { 12, 7 }, { 20, 7 }, { 4, 5 }, { 28, 5 }, -}; - -static const uint8_t huff_spec_a54_tab[31][2] = { + /* Coefficient table A.5.4 - 31 entries */ { 8, 5 }, { 24, 5 }, { 7, 5 }, { 25, 5 }, { 4, 4 }, { 28, 4 }, { 0, 3 }, { 10, 6 }, { 22, 6 }, { 13, 7 }, { 19, 7 }, { 12, 7 }, { 20, 7 }, { 6, 5 }, { 26, 5 }, @@ -797,9 +753,7 @@ static const uint8_t huff_spec_a54_tab[31][2] = { { 23, 6 }, { 15, 8 }, { 17, 8 }, { 14, 8 }, { 18, 8 }, { 11, 7 }, { 21, 7 }, { 5, 5 }, { 27, 5 }, { 1, 4 }, { 31, 4 }, -}; - -static const uint8_t huff_spec_a61_tab[63][2] = { + /* Coefficient table A.6.1 - 63 entries */ { 19, 5 }, { 45, 5 }, { 31, 6 }, { 33, 6 }, { 30, 6 }, { 34, 6 }, { 16, 5 }, { 48, 5 }, { 8, 6 }, { 56, 6 }, { 7, 6 }, { 57, 6 }, { 18, 5 }, { 46, 5 }, { 29, 6 }, @@ -813,9 +767,7 @@ static const uint8_t huff_spec_a61_tab[63][2] = { { 42, 6 }, { 12, 7 }, { 52, 7 }, { 11, 7 }, { 53, 7 }, { 21, 6 }, { 43, 6 }, { 20, 6 }, { 44, 6 }, { 10, 7 }, { 54, 7 }, { 9, 7 }, { 55, 7 }, -}; - -static const uint8_t huff_spec_a62_tab[63][2] = { + /* Coefficient table A.6.2 - 63 entries */ { 23, 6 }, { 41, 6 }, { 15, 6 }, { 49, 6 }, { 4, 5 }, { 60, 5 }, { 3, 5 }, { 61, 5 }, { 22, 6 }, { 42, 6 }, { 14, 6 }, { 50, 6 }, { 2, 5 }, { 62, 5 }, { 31, 7 }, @@ -829,9 +781,7 @@ static const uint8_t huff_spec_a62_tab[63][2] = { { 56, 6 }, { 17, 6 }, { 47, 6 }, { 7, 6 }, { 57, 6 }, { 25, 7 }, { 39, 7 }, { 24, 7 }, { 40, 7 }, { 6, 6 }, { 58, 6 }, { 5, 6 }, { 59, 6 }, -}; - -static const uint8_t huff_spec_a63_tab[63][2] = { + /* Coefficient table A.6.3 - 63 entries */ { 0, 4 }, { 7, 5 }, { 57, 5 }, { 15, 6 }, { 49, 6 }, { 25, 7 }, { 39, 7 }, { 24, 7 }, { 40, 7 }, { 18, 6 }, { 46, 6 }, { 14, 6 }, { 50, 6 }, { 6, 5 }, { 58, 5 }, @@ -845,9 +795,7 @@ static const uint8_t huff_spec_a63_tab[63][2] = { { 44, 7 }, { 9, 6 }, { 55, 6 }, { 1, 5 }, { 63, 5 }, { 27, 8 }, { 37, 8 }, { 26, 8 }, { 38, 8 }, { 19, 7 }, { 45, 7 }, { 8, 6 }, { 56, 6 }, -}; - -static const uint8_t huff_spec_a64_tab[63][2] = { + /* Coefficient table A.6.4 - 63 entries */ { 16, 6 }, { 48, 6 }, { 27, 8 }, { 37, 8 }, { 26, 8 }, { 38, 8 }, { 21, 7 }, { 43, 7 }, { 8, 5 }, { 56, 5 }, { 1, 4 }, { 63, 4 }, { 14, 6 }, { 50, 6 }, { 20, 7 }, @@ -861,9 +809,7 @@ static const uint8_t huff_spec_a64_tab[63][2] = { { 42, 8 }, { 10, 6 }, { 54, 6 }, { 3, 5 }, { 61, 5 }, { 2, 5 }, { 62, 5 }, { 17, 7 }, { 47, 7 }, { 15, 7 }, { 49, 7 }, { 9, 6 }, { 55, 6 }, -}; - -static const uint8_t huff_spec_a71_tab[127][2] = { + /* Coefficient table A.7.1 - 127 entries */ { 18, 7 }, { 110, 7 }, { 63, 7 }, { 65, 7 }, { 38, 6 }, { 90, 6 }, { 17, 7 }, { 111, 7 }, { 62, 7 }, { 66, 7 }, { 61, 7 }, { 67, 7 }, { 16, 7 }, { 112, 7 }, { 37, 6 }, @@ -890,9 +836,7 @@ static const uint8_t huff_spec_a71_tab[127][2] = { { 21, 8 }, { 107, 8 }, { 41, 7 }, { 87, 7 }, { 20, 8 }, { 108, 8 }, { 19, 8 }, { 109, 8 }, { 40, 7 }, { 88, 7 }, { 39, 7 }, { 89, 7 }, -}; - -static const uint8_t huff_spec_a72_tab[127][2] = { + /* Coefficient table A.7.2 - 127 entries */ { 47, 7 }, { 81, 7 }, { 46, 7 }, { 82, 7 }, { 8, 6 }, { 120, 6 }, { 31, 7 }, { 97, 7 }, { 45, 7 }, { 83, 7 }, { 7, 6 }, { 121, 6 }, { 30, 7 }, { 98, 7 }, { 29, 7 }, @@ -919,9 +863,7 @@ static const uint8_t huff_spec_a72_tab[127][2] = { { 12, 7 }, { 116, 7 }, { 49, 8 }, { 79, 8 }, { 48, 8 }, { 80, 8 }, { 11, 7 }, { 117, 7 }, { 10, 7 }, { 118, 7 }, { 9, 7 }, { 119, 7 }, -}; - -static const uint8_t huff_spec_a73_tab[127][2] = { + /* Coefficient table A.7.3 - 127 entries */ { 15, 6 }, { 113, 6 }, { 31, 7 }, { 97, 7 }, { 51, 8 }, { 77, 8 }, { 50, 8 }, { 78, 8 }, { 14, 6 }, { 114, 6 }, { 0, 5 }, { 37, 7 }, { 91, 7 }, { 30, 7 }, { 98, 7 }, @@ -948,9 +890,7 @@ static const uint8_t huff_spec_a73_tab[127][2] = { { 52, 9 }, { 76, 9 }, { 17, 7 }, { 111, 7 }, { 39, 8 }, { 89, 8 }, { 38, 8 }, { 90, 8 }, { 16, 7 }, { 112, 7 }, { 1, 6 }, { 127, 6 }, -}; - -static const uint8_t huff_spec_a74_tab[127][2] = { + /* Coefficient table A.7.4 - 127 entries */ { 3, 5 }, { 125, 5 }, { 32, 7 }, { 96, 7 }, { 29, 7 }, { 99, 7 }, { 16, 6 }, { 112, 6 }, { 2, 5 }, { 126, 5 }, { 53, 9 }, { 75, 9 }, { 52, 9 }, { 76, 9 }, { 42, 8 }, @@ -977,9 +917,7 @@ static const uint8_t huff_spec_a74_tab[127][2] = { { 54, 10 }, { 74, 10 }, { 43, 9 }, { 85, 9 }, { 18, 7 }, { 110, 7 }, { 30, 8 }, { 98, 8 }, { 33, 8 }, { 95, 8 }, { 17, 7 }, { 111, 7 }, -}; - -static const uint8_t huff_spec_b22_tab[80][2] = { + /* Coefficient table B.2.2 - 80 entries */ { 80, 5 }, { 240, 5 }, { 253, 10 }, { 87, 10 }, { 117, 10 }, { 223, 10 }, { 93, 10 }, { 247, 10 }, { 221, 10 }, { 119, 10 }, { 213, 10 }, { 127, 10 }, { 85, 10 }, { 255, 10 }, { 245, 10 }, @@ -996,9 +934,7 @@ static const uint8_t huff_spec_b22_tab[80][2] = { { 211, 9 }, { 29, 9 }, { 55, 9 }, { 209, 10 }, { 115, 10 }, { 125, 10 }, { 215, 10 }, { 65, 8 }, { 195, 8 }, { 193, 8 }, { 67, 8 }, { 64, 4 }, { 192, 4 }, { 1, 4 }, { 3, 4 }, -}; - -static const uint8_t huff_spec_b23_tab[81][2] = { + /* Coefficient table B.2.3 - 81 entries */ { 16, 4 }, { 48, 4 }, { 4, 4 }, { 12, 4 }, { 64, 4 }, { 192, 4 }, { 5, 6 }, { 15, 6 }, { 13, 6 }, { 7, 6 }, { 212, 8 }, { 124, 8 }, { 213, 10 }, { 127, 10 }, { 93, 10 }, @@ -1016,9 +952,7 @@ static const uint8_t huff_spec_b23_tab[81][2] = { { 113, 10 }, { 211, 10 }, { 197, 10 }, { 79, 10 }, { 68, 9 }, { 204, 9 }, { 17, 9 }, { 51, 9 }, { 244, 9 }, { 92, 9 }, { 0, 2 }, -}; - -static const uint8_t huff_spec_b24_tab[81][2] = { + /* Coefficient table B.2.4 - 81 entries */ { 1, 4 }, { 3, 4 }, { 52, 7 }, { 28, 7 }, { 193, 8 }, { 67, 8 }, { 213, 10 }, { 127, 10 }, { 253, 10 }, { 87, 10 }, { 93, 10 }, { 247, 10 }, { 117, 10 }, { 223, 10 }, { 80, 7 }, @@ -1036,9 +970,7 @@ static const uint8_t huff_spec_b24_tab[81][2] = { { 61, 9 }, { 23, 9 }, { 17, 9 }, { 51, 9 }, { 65, 9 }, { 195, 9 }, { 20, 8 }, { 60, 8 }, { 64, 5 }, { 192, 5 }, { 0, 1 }, -}; - -static const uint8_t huff_spec_b32_tab[49][2] = { + /* Coefficient table B.3.2 - 49 entries */ { 58, 5 }, { 14, 5 }, { 59, 6 }, { 13, 6 }, { 19, 7 }, { 53, 7 }, { 25, 7 }, { 47, 7 }, { 1, 4 }, { 7, 4 }, { 0, 2 }, { 9, 6 }, { 63, 6 }, { 57, 6 }, { 15, 6 }, @@ -1049,9 +981,7 @@ static const uint8_t huff_spec_b32_tab[49][2] = { { 26, 8 }, { 46, 8 }, { 51, 8 }, { 21, 8 }, { 16, 5 }, { 48, 5 }, { 18, 7 }, { 54, 7 }, { 50, 7 }, { 22, 7 }, { 10, 6 }, { 62, 6 }, { 2, 5 }, { 6, 5 }, -}; - -static const uint8_t huff_spec_b33_tab[49][2] = { + /* Coefficient table B.3.3 - 49 entries */ { 57, 5 }, { 15, 5 }, { 9, 5 }, { 63, 5 }, { 59, 7 }, { 13, 7 }, { 50, 7 }, { 22, 7 }, { 18, 7 }, { 54, 7 }, { 51, 8 }, { 21, 8 }, { 27, 10 }, { 45, 10 }, { 43, 10 }, @@ -1062,9 +992,7 @@ static const uint8_t huff_spec_b33_tab[49][2] = { { 47, 8 }, { 42, 9 }, { 30, 9 }, { 19, 9 }, { 53, 9 }, { 24, 7 }, { 40, 7 }, { 41, 8 }, { 31, 8 }, { 11, 8 }, { 61, 8 }, { 3, 7 }, { 5, 7 }, { 0, 2 }, -}; - -static const uint8_t huff_spec_b34_tab[49][2] = { + /* Coefficient table B.3.4 - 49 entries */ { 0, 1 }, { 8, 4 }, { 56, 4 }, { 1, 4 }, { 7, 4 }, { 59, 8 }, { 13, 8 }, { 27, 10 }, { 45, 10 }, { 43, 10 }, { 29, 10 }, { 26, 10 }, { 46, 10 }, { 51, 10 }, { 21, 10 }, @@ -1075,9 +1003,7 @@ static const uint8_t huff_spec_b34_tab[49][2] = { { 2, 6 }, { 6, 6 }, { 58, 7 }, { 14, 7 }, { 11, 9 }, { 61, 9 }, { 41, 9 }, { 31, 9 }, { 3, 8 }, { 5, 8 }, { 9, 6 }, { 63, 6 }, { 57, 6 }, { 15, 6 }, -}; - -static const uint8_t huff_spec_b42_tab[225][2] = { + /* Coefficient table B.4.2 - 225 entries */ { 33, 7 }, { 239, 7 }, { 36, 7 }, { 236, 7 }, { 119, 10 }, { 153, 10 }, { 151, 10 }, { 121, 10 }, { 118, 10 }, { 154, 10 }, { 167, 10 }, { 105, 10 }, { 247, 8 }, { 25, 8 }, { 112, 8 }, @@ -1123,9 +1049,7 @@ static const uint8_t huff_spec_b42_tab[225][2] = { { 10, 8 }, { 66, 8 }, { 206, 8 }, { 179, 9 }, { 93, 9 }, { 70, 10 }, { 202, 10 }, { 85, 10 }, { 187, 10 }, { 194, 8 }, { 78, 8 }, { 196, 9 }, { 76, 9 }, { 49, 9 }, { 223, 9 }, -}; - -static const uint8_t huff_spec_b43_tab[225][2] = { + /* Coefficient table B.4.3 - 225 entries */ { 193, 7 }, { 79, 7 }, { 48, 7 }, { 208, 7 }, { 6, 8 }, { 10, 8 }, { 151, 10 }, { 121, 10 }, { 119, 10 }, { 153, 10 }, { 167, 10 }, { 105, 10 }, { 118, 10 }, { 154, 10 }, { 103, 10 }, @@ -1171,9 +1095,7 @@ static const uint8_t huff_spec_b43_tab[225][2] = { { 31, 6 }, { 227, 9 }, { 45, 9 }, { 210, 9 }, { 62, 9 }, { 50, 9 }, { 222, 9 }, { 96, 9 }, { 160, 9 }, { 5, 8 }, { 11, 8 }, { 65, 8 }, { 207, 8 }, { 1, 5 }, { 15, 5 }, -}; - -static const uint8_t huff_spec_b44_tab[225][2] = { + /* Coefficient table B.4.4 - 225 entries */ { 3, 7 }, { 13, 7 }, { 4, 7 }, { 12, 7 }, { 151, 10 }, { 121, 10 }, { 119, 10 }, { 153, 10 }, { 103, 10 }, { 169, 10 }, { 167, 10 }, { 105, 10 }, { 150, 10 }, { 122, 10 }, { 118, 10 }, @@ -1219,9 +1141,7 @@ static const uint8_t huff_spec_b44_tab[225][2] = { { 254, 7 }, { 242, 7 }, { 30, 7 }, { 48, 8 }, { 208, 8 }, { 226, 8 }, { 46, 8 }, { 34, 8 }, { 238, 8 }, { 227, 9 }, { 45, 9 }, { 35, 9 }, { 237, 9 }, { 16, 5 }, { 240, 5 }, -}; - -static const uint8_t huff_spec_b52_tab[31][2] = { + /* Coefficient table B.5.2 - 31 entries */ { 3, 4 }, { 29, 4 }, { 5, 5 }, { 27, 5 }, { 10, 5 }, { 22, 5 }, { 13, 6 }, { 19, 6 }, { 7, 6 }, { 25, 6 }, { 4, 5 }, { 28, 5 }, { 2, 4 }, { 30, 4 }, { 9, 5 }, @@ -1229,9 +1149,7 @@ static const uint8_t huff_spec_b52_tab[31][2] = { { 14, 7 }, { 18, 7 }, { 8, 5 }, { 24, 5 }, { 6, 6 }, { 26, 6 }, { 11, 6 }, { 21, 6 }, { 0, 3 }, { 1, 4 }, { 31, 4 }, -}; - -static const uint8_t huff_spec_b53_tab[31][2] = { + /* Coefficient table B.5.3 - 31 entries */ { 1, 3 }, { 31, 3 }, { 7, 6 }, { 25, 6 }, { 13, 7 }, { 19, 7 }, { 12, 7 }, { 20, 7 }, { 10, 6 }, { 22, 6 }, { 6, 6 }, { 26, 6 }, { 2, 4 }, { 30, 4 }, { 0, 2 }, @@ -1239,9 +1157,7 @@ static const uint8_t huff_spec_b53_tab[31][2] = { { 18, 8 }, { 11, 7 }, { 21, 7 }, { 9, 6 }, { 23, 6 }, { 3, 5 }, { 29, 5 }, { 8, 6 }, { 24, 6 }, { 5, 6 }, { 27, 6 }, -}; - -static const uint8_t huff_spec_b54_tab[31][2] = { + /* Coefficient table B.5.4 - 31 entries */ { 3, 4 }, { 29, 4 }, { 9, 6 }, { 23, 6 }, { 8, 6 }, { 24, 6 }, { 13, 8 }, { 19, 8 }, { 12, 8 }, { 20, 8 }, { 10, 7 }, { 22, 7 }, { 6, 6 }, { 26, 6 }, { 1, 3 }, @@ -1249,9 +1165,7 @@ static const uint8_t huff_spec_b54_tab[31][2] = { { 15, 9 }, { 17, 9 }, { 14, 9 }, { 18, 9 }, { 11, 8 }, { 21, 8 }, { 7, 7 }, { 25, 7 }, { 5, 6 }, { 27, 6 }, { 0, 2 }, -}; - -static const uint8_t huff_spec_b62_tab[63][2] = { + /* Coefficient table B.6.2 - 63 entries */ { 11, 6 }, { 53, 6 }, { 21, 6 }, { 43, 6 }, { 27, 7 }, { 37, 7 }, { 26, 7 }, { 38, 7 }, { 10, 6 }, { 54, 6 }, { 5, 5 }, { 59, 5 }, { 20, 6 }, { 44, 6 }, { 9, 6 }, @@ -1265,9 +1179,7 @@ static const uint8_t huff_spec_b62_tab[63][2] = { { 17, 6 }, { 47, 6 }, { 0, 4 }, { 2, 5 }, { 62, 5 }, { 22, 7 }, { 42, 7 }, { 29, 8 }, { 35, 8 }, { 28, 8 }, { 36, 8 }, { 6, 6 }, { 58, 6 }, -}; - -static const uint8_t huff_spec_b63_tab[63][2] = { + /* Coefficient table B.6.3 - 63 entries */ { 6, 5 }, { 58, 5 }, { 10, 6 }, { 54, 6 }, { 16, 6 }, { 48, 6 }, { 17, 6 }, { 47, 6 }, { 21, 7 }, { 43, 7 }, { 14, 7 }, { 50, 7 }, { 5, 5 }, { 59, 5 }, { 2, 4 }, @@ -1281,9 +1193,7 @@ static const uint8_t huff_spec_b63_tab[63][2] = { { 22, 8 }, { 42, 8 }, { 11, 7 }, { 53, 7 }, { 15, 8 }, { 49, 8 }, { 27, 9 }, { 37, 9 }, { 26, 9 }, { 38, 9 }, { 0, 3 }, { 1, 4 }, { 63, 4 }, -}; - -static const uint8_t huff_spec_b64_tab[63][2] = { + /* Coefficient table B.6.4 - 63 entries */ { 1, 3 }, { 63, 3 }, { 14, 7 }, { 50, 7 }, { 18, 7 }, { 46, 7 }, { 27, 9 }, { 37, 9 }, { 26, 9 }, { 38, 9 }, { 21, 8 }, { 43, 8 }, { 13, 7 }, { 51, 7 }, { 9, 6 }, @@ -1297,9 +1207,7 @@ static const uint8_t huff_spec_b64_tab[63][2] = { { 19, 8 }, { 45, 8 }, { 23, 9 }, { 41, 9 }, { 22, 9 }, { 42, 9 }, { 10, 7 }, { 54, 7 }, { 6, 6 }, { 58, 6 }, { 3, 5 }, { 61, 5 }, { 0, 3 }, -}; - -static const uint8_t huff_spec_b72_tab[127][2] = { + /* Coefficient table B.7.2 - 127 entries */ { 3, 5 }, { 125, 5 }, { 42, 7 }, { 86, 7 }, { 21, 7 }, { 107, 7 }, { 11, 6 }, { 117, 6 }, { 41, 7 }, { 87, 7 }, { 20, 7 }, { 108, 7 }, { 53, 8 }, { 75, 8 }, { 31, 8 }, @@ -1326,9 +1234,7 @@ static const uint8_t huff_spec_b72_tab[127][2] = { { 85, 8 }, { 12, 7 }, { 116, 7 }, { 0, 5 }, { 33, 7 }, { 95, 7 }, { 22, 8 }, { 106, 8 }, { 55, 9 }, { 73, 9 }, { 54, 9 }, { 74, 9 }, -}; - -static const uint8_t huff_spec_b73_tab[127][2] = { + /* Coefficient table B.7.3 - 127 entries */ { 0, 3 }, { 4, 5 }, { 124, 5 }, { 19, 7 }, { 109, 7 }, { 29, 8 }, { 99, 8 }, { 51, 9 }, { 77, 9 }, { 62, 10 }, { 66, 10 }, { 63, 10 }, { 65, 10 }, { 28, 8 }, { 100, 8 }, @@ -1355,9 +1261,7 @@ static const uint8_t huff_spec_b73_tab[127][2] = { { 53, 10 }, { 75, 10 }, { 52, 10 }, { 76, 10 }, { 42, 9 }, { 86, 9 }, { 34, 8 }, { 94, 8 }, { 32, 8 }, { 96, 8 }, { 11, 7 }, { 117, 7 }, -}; - -static const uint8_t huff_spec_b74_tab[127][2] = { + /* Coefficient table B.7.4 - 127 entries */ { 28, 8 }, { 100, 8 }, { 27, 8 }, { 101, 8 }, { 36, 8 }, { 92, 8 }, { 63, 10 }, { 65, 10 }, { 61, 10 }, { 67, 10 }, { 62, 10 }, { 66, 10 }, { 60, 10 }, { 68, 10 }, { 19, 7 }, @@ -1391,40 +1295,40 @@ static const HuffmanCodebook at9_huffman_coeffs[][8][4] = { { { 0 } }, { { 0 } }, { - { huff_spec_a21_tab, 8, 2, 1, 2 }, - { huff_spec_a22_tab, 80, 4, 2, 2 }, - { huff_spec_a23_tab, 81, 4, 2, 2 }, - { huff_spec_a24_tab, 81, 4, 2, 2 }, + { 8, 2, 1, 2 }, + { 80, 4, 2, 2 }, + { 81, 4, 2, 2 }, + { 81, 4, 2, 2 }, }, { - { huff_spec_a31_tab, 40, 2, 1, 3 }, - { huff_spec_a32_tab, 49, 2, 1, 3 }, - { huff_spec_a33_tab, 49, 2, 1, 3 }, - { huff_spec_a34_tab, 49, 2, 1, 3 }, + { 40, 2, 1, 3 }, + { 49, 2, 1, 3 }, + { 49, 2, 1, 3 }, + { 49, 2, 1, 3 }, }, { - { huff_spec_a41_tab, 176, 2, 1, 4 }, - { huff_spec_a42_tab, 225, 2, 1, 4 }, - { huff_spec_a43_tab, 225, 2, 1, 4 }, - { huff_spec_a44_tab, 225, 2, 1, 4 }, + { 176, 2, 1, 4 }, + { 225, 2, 1, 4 }, + { 225, 2, 1, 4 }, + { 225, 2, 1, 4 }, }, { - { huff_spec_a51_tab, 31, 1, 0, 5 }, - { huff_spec_a52_tab, 31, 1, 0, 5 }, - { huff_spec_a53_tab, 31, 1, 0, 5 }, - { huff_spec_a54_tab, 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, }, { - { huff_spec_a61_tab, 63, 1, 0, 6 }, - { huff_spec_a62_tab, 63, 1, 0, 6 }, - { huff_spec_a63_tab, 63, 1, 0, 6 }, - { huff_spec_a64_tab, 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, }, { - { huff_spec_a71_tab, 127, 1, 0, 7 }, - { huff_spec_a72_tab, 127, 1, 0, 7 }, - { huff_spec_a73_tab, 127, 1, 0, 7 }, - { huff_spec_a74_tab, 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, }, }, { @@ -1432,39 +1336,39 @@ static const HuffmanCodebook at9_huffman_coeffs[][8][4] = { { { 0 } }, { { 0 }, - { huff_spec_b22_tab, 80, 4, 2, 2 }, - { huff_spec_b23_tab, 81, 4, 2, 2 }, - { huff_spec_b24_tab, 81, 4, 2, 2 }, + { 80, 4, 2, 2 }, + { 81, 4, 2, 2 }, + { 81, 4, 2, 2 }, }, { { 0 }, - { huff_spec_b32_tab, 49, 2, 1, 3 }, - { huff_spec_b33_tab, 49, 2, 1, 3 }, - { huff_spec_b34_tab, 49, 2, 1, 3 }, + { 49, 2, 1, 3 }, + { 49, 2, 1, 3 }, + { 49, 2, 1, 3 }, }, { { 0 }, - { huff_spec_b42_tab, 225, 2, 1, 4 }, - { huff_spec_b43_tab, 225, 2, 1, 4 }, - { huff_spec_b44_tab, 225, 2, 1, 4 }, + { 225, 2, 1, 4 }, + { 225, 2, 1, 4 }, + { 225, 2, 1, 4 }, }, { { 0 }, - { huff_spec_b52_tab, 31, 1, 0, 5 }, - { huff_spec_b53_tab, 31, 1, 0, 5 }, - { huff_spec_b54_tab, 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, + { 31, 1, 0, 5 }, }, { { 0 }, - { huff_spec_b62_tab, 63, 1, 0, 6 }, - { huff_spec_b63_tab, 63, 1, 0, 6 }, - { huff_spec_b64_tab, 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, + { 63, 1, 0, 6 }, }, { { 0 }, - { huff_spec_b72_tab, 127, 1, 0, 7 }, - { huff_spec_b73_tab, 127, 1, 0, 7 }, - { huff_spec_b74_tab, 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, + { 127, 1, 0, 7 }, }, }, }; |