FFmpeg
wmaprodata.h
Go to the documentation of this file.
1 /*
2  * WMA 9/3/PRO compatible decoder
3  * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
4  * Copyright (c) 2008 - 2009 Sascha Sommer
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * @brief tables for wmapro decoding
26  */
27 
28 #ifndef AVCODEC_WMAPRODATA_H
29 #define AVCODEC_WMAPRODATA_H
30 
31 #include <stddef.h>
32 #include <stdint.h>
33 
34 /**
35  * @brief frequencies to divide the frequency spectrum into scale factor bands
36  */
37 static const uint16_t critical_freq[] = {
38  100, 200, 300, 400, 510, 630, 770,
39  920, 1080, 1270, 1480, 1720, 2000, 2320,
40  2700, 3150, 3700, 4400, 5300, 6400, 7700,
41  9500, 12000, 15500, 20675, 28575, 41375, 63875,
42 };
43 
44 
45 /**
46  * @name Huffman tables for DPCM-coded scale factors
47  * @{
48  */
49 #define HUFF_SCALE_SIZE 121
50 #define HUFF_SCALE_MAXBITS 19
51 static const uint8_t scale_table[HUFF_SCALE_SIZE][2] = {
52  { 58, 5 }, { 64, 6 }, { 66, 7 }, { 65, 7 }, { 62, 5 },
53  { 63, 6 }, { 68, 9 }, { 69, 10 }, { 54, 15 }, { 19, 19 },
54  { 20, 19 }, { 21, 19 }, { 22, 19 }, { 23, 19 }, { 24, 19 },
55  { 25, 19 }, { 26, 19 }, { 27, 19 }, { 28, 19 }, { 29, 19 },
56  { 30, 19 }, { 31, 19 }, { 32, 19 }, { 33, 19 }, { 34, 19 },
57  { 17, 19 }, { 36, 19 }, { 37, 19 }, { 38, 19 }, { 39, 19 },
58  { 40, 19 }, { 41, 19 }, { 42, 19 }, { 43, 19 }, { 44, 19 },
59  { 45, 19 }, { 46, 19 }, { 47, 19 }, { 48, 19 }, { 49, 19 },
60  { 50, 19 }, { 51, 19 }, { 52, 19 }, { 15, 19 }, { 16, 19 },
61  { 14, 19 }, { 13, 19 }, { 12, 19 }, { 11, 19 }, { 10, 19 },
62  { 0, 19 }, { 9, 19 }, { 8, 19 }, { 7, 19 }, { 6, 19 },
63  { 5, 19 }, { 4, 19 }, { 55, 13 }, { 70, 13 }, { 3, 19 },
64  { 2, 19 }, { 1, 19 }, { 35, 19 }, { 71, 19 }, { 72, 19 },
65  { 73, 19 }, { 74, 19 }, { 75, 19 }, { 76, 19 }, { 77, 19 },
66  { 78, 19 }, { 79, 19 }, { 80, 19 }, { 81, 19 }, { 82, 19 },
67  { 83, 19 }, { 84, 19 }, { 85, 19 }, { 86, 19 }, { 87, 19 },
68  { 88, 19 }, { 89, 19 }, { 90, 19 }, { 91, 19 }, { 92, 19 },
69  { 93, 19 }, { 94, 19 }, { 95, 19 }, { 96, 19 }, { 97, 19 },
70  { 98, 19 }, { 99, 19 }, { 100, 19 }, { 101, 19 }, { 102, 19 },
71  { 103, 19 }, { 104, 19 }, { 105, 19 }, { 106, 19 }, { 107, 19 },
72  { 108, 19 }, { 109, 19 }, { 110, 19 }, { 111, 19 }, { 112, 19 },
73  { 113, 19 }, { 114, 19 }, { 115, 19 }, { 116, 19 }, { 117, 19 },
74  { 118, 19 }, { 119, 19 }, { 120, 19 }, { 18, 18 }, { 53, 16 },
75  { 56, 11 }, { 57, 8 }, { 67, 7 }, { 61, 3 }, { 59, 2 },
76  { 60, 1 },
77 };
78 /** @} */
79 
80 
81 /**
82  * @name Huffman, run and level tables for runlevel-coded scale factors
83  * @{
84  */
85 #define HUFF_SCALE_RL_SIZE 120
86 #define HUFF_SCALE_RL_MAXBITS 21
87 static const uint8_t scale_rl_table[HUFF_SCALE_RL_SIZE][2] = {
88  { 103, 7 }, { 80, 11 }, { 60, 11 }, { 18, 10 }, { 56, 10 },
89  { 21, 12 }, { 90, 12 }, { 58, 11 }, { 27, 11 }, { 69, 12 },
90  { 84, 15 }, { 48, 15 }, { 86, 14 }, { 47, 13 }, { 19, 10 },
91  { 32, 9 }, { 78, 6 }, { 5, 5 }, { 28, 4 }, { 53, 5 },
92  { 9, 7 }, { 31, 8 }, { 38, 8 }, { 10, 7 }, { 88, 11 },
93  { 25, 12 }, { 105, 12 }, { 118, 11 }, { 23, 12 }, { 82, 14 },
94  { 98, 16 }, { 110, 16 }, { 108, 15 }, { 93, 13 }, { 68, 10 },
95  { 72, 12 }, { 97, 12 }, { 81, 12 }, { 42, 12 }, { 64, 8 },
96  { 4, 4 }, { 1, 2 }, { 7, 6 }, { 14, 7 }, { 0, 9 },
97  { 55, 9 }, { 61, 9 }, { 117, 10 }, { 24, 12 }, { 44, 12 },
98  { 67, 12 }, { 70, 16 }, { 99, 18 }, { 96, 21 }, { 95, 21 },
99  { 2, 21 }, { 77, 21 }, { 52, 21 }, { 111, 21 }, { 102, 20 },
100  { 101, 17 }, { 46, 15 }, { 73, 15 }, { 109, 15 }, { 51, 14 },
101  { 92, 14 }, { 30, 7 }, { 11, 7 }, { 66, 7 }, { 15, 8 },
102  { 16, 8 }, { 116, 9 }, { 65, 9 }, { 57, 10 }, { 59, 10 },
103  { 115, 9 }, { 12, 7 }, { 35, 9 }, { 17, 9 }, { 41, 9 },
104  { 20, 11 }, { 91, 11 }, { 26, 12 }, { 75, 15 }, { 45, 15 },
105  { 107, 14 }, { 83, 14 }, { 100, 15 }, { 89, 15 }, { 43, 11 },
106  { 62, 9 }, { 37, 9 }, { 104, 8 }, { 6, 5 }, { 39, 8 },
107  { 40, 9 }, { 34, 9 }, { 79, 7 }, { 8, 6 }, { 63, 6 },
108  { 87, 12 }, { 94, 14 }, { 49, 14 }, { 50, 13 }, { 22, 11 },
109  { 119, 10 }, { 33, 9 }, { 36, 9 }, { 113, 11 }, { 106, 12 },
110  { 112, 13 }, { 71, 15 }, { 85, 15 }, { 74, 14 }, { 76, 10 },
111  { 114, 7 }, { 29, 5 }, { 54, 6 }, { 13, 6 }, { 3, 2 },
112 };
113 
114 
115 static const uint8_t scale_rl_run[HUFF_SCALE_RL_SIZE] = {
116  0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
117  16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
118  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3,
119  4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
120  23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
121  17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
122  0, 1, 0, 1, 0, 1,
123 };
124 
125 static const uint8_t scale_rl_level[HUFF_SCALE_RL_SIZE] = {
126  0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127  2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
128  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
129  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
130  4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
131  5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
132  7, 7, 8, 8, 9, 9,
133 };
134 /** @} */
135 
136 
137 /**
138  * @name Huffman, run and level codes for runlevel-coded coefficients
139  * @{
140  */
141 #define HUFF_COEF0_SIZE 272
142 #define HUFF_COEF0_MAXBITS 21
143 static const uint8_t coef0_lens[HUFF_COEF0_SIZE] = {
144  2, 9, 14, 14, 13, 12, 13, 14, 15, 15, 12, 10, 10, 10, 13, 14, 15, 15, 12,
145  11, 13, 14, 14, 13, 15, 15, 14, 12, 12, 8, 10, 10, 15, 15, 14, 13, 14, 14,
146  13, 15, 20, 20, 19, 21, 21, 20, 19, 17, 17, 18, 18, 15, 15, 13, 12, 14, 15,
147  15, 14, 15, 15, 12, 11, 6, 7, 8, 9, 13, 13, 13, 14, 14, 11, 10, 7, 8,
148  14, 14, 14, 14, 12, 13, 13, 12, 12, 12, 11, 9, 13, 14, 14, 12, 11, 11, 11,
149  9, 8, 7, 14, 15, 15, 14, 14, 12, 13, 15, 16, 17, 17, 14, 12, 12, 12, 15,
150  15, 14, 14, 14, 13, 13, 9, 9, 11, 11, 10, 7, 6, 13, 15, 15, 14, 14, 14,
151  13, 14, 15, 15, 13, 14, 14, 14, 14, 10, 9, 10, 10, 11, 11, 10, 8, 9, 13,
152  14, 14, 12, 11, 14, 15, 15, 13, 12, 14, 14, 14, 14, 13, 14, 14, 3, 5, 8,
153  10, 10, 15, 15, 14, 14, 16, 16, 15, 12, 11, 11, 11, 7, 8, 8, 9, 12, 13,
154  13, 12, 14, 15, 15, 13, 10, 11, 11, 13, 14, 14, 13, 14, 14, 11, 10, 13, 15,
155  15, 14, 12, 11, 4, 6, 6, 8, 12, 12, 12, 13, 13, 12, 13, 13, 14, 14, 13,
156  13, 13, 9, 7, 9, 11, 14, 14, 13, 14, 14, 13, 10, 8, 7, 5, 9, 12, 13,
157  14, 15, 15, 12, 12, 10, 14, 14, 13, 12, 13, 14, 14, 12, 13, 13, 12, 12, 12,
158  9, 7, 6, 3, 4, 4,
159 };
160 
161 static const uint16_t coef0_syms[HUFF_COEF0_SIZE] = {
162  2, 25, 111, 94, 69, 58, 87, 93, 136, 135, 59, 37, 34, 36, 82,
163  182, 120, 138, 195, 45, 168, 216, 178, 86, 140, 219, 186, 162, 239, 18,
164  156, 35, 127, 236, 109, 85, 180, 253, 88, 147, 268, 264, 256, 266, 270,
165  262, 260, 248, 246, 252, 258, 137, 189, 230, 64, 179, 146, 208, 101, 118,
166  238, 163, 46, 9, 153, 0, 26, 247, 169, 76, 202, 131, 194, 38, 13,
167  19, 132, 106, 191, 97, 65, 198, 77, 62, 66, 164, 48, 27, 81, 183,
168  102, 60, 47, 49, 159, 227, 20, 14, 112, 263, 144, 217, 104, 63, 79,
169  209, 269, 250, 254, 203, 241, 196, 61, 220, 148, 124, 185, 100, 80, 78,
170  193, 28, 50, 235, 41, 1, 10, 171, 226, 150, 103, 114, 115, 170, 105,
171  211, 149, 249, 108, 188, 107, 255, 231, 155, 42, 40, 55, 160, 39, 21,
172  29, 215, 234, 184, 228, 51, 116, 142, 145, 172, 165, 181, 130, 113, 117,
173  89, 128, 204, 3, 7, 154, 157, 43, 141, 265, 133, 225, 271, 244, 221,
174  74, 54, 56, 52, 15, 222, 22, 30, 83, 199, 173, 73, 123, 210, 143,
175  175, 44, 53, 237, 174, 139, 134, 110, 218, 129, 161, 213, 177, 267, 151,
176  125, 67, 223, 5, 11, 192, 23, 214, 243, 166, 200, 176, 68, 224, 187,
177  257, 261, 232, 96, 251, 31, 16, 32, 57, 207, 121, 91, 126, 119, 99,
178  158, 24, 212, 8, 33, 70, 92, 205, 240, 242, 75, 197, 233, 259, 190,
179  98, 71, 201, 122, 206, 72, 90, 95, 84, 167, 245, 229, 17, 12, 4,
180  152, 6,
181 };
182 
183 
184 #define HUFF_COEF1_SIZE 244
185 #define HUFF_COEF1_MAXBITS 22
186 static const uint8_t coef1_table[HUFF_COEF1_SIZE][2] = {
187  { 2, 2 }, { 3, 3 }, { 102, 3 }, { 4, 4 }, { 148, 6 },
188  { 134, 9 }, { 171, 10 }, { 18, 10 }, { 11, 8 }, { 159, 8 },
189  { 14, 9 }, { 156, 14 }, { 235, 15 }, { 61, 15 }, { 38, 13 },
190  { 153, 13 }, { 48, 14 }, { 49, 14 }, { 23, 11 }, { 203, 13 },
191  { 208, 19 }, { 204, 19 }, { 129, 18 }, { 94, 17 }, { 87, 16 },
192  { 62, 15 }, { 174, 15 }, { 147, 15 }, { 29, 12 }, { 191, 12 },
193  { 64, 15 }, { 65, 15 }, { 146, 14 }, { 164, 13 }, { 142, 5 },
194  { 132, 4 }, { 103, 5 }, { 154, 7 }, { 165, 9 }, { 181, 11 },
195  { 109, 12 }, { 30, 12 }, { 86, 16 }, { 92, 16 }, { 239, 15 },
196  { 138, 14 }, { 39, 13 }, { 50, 14 }, { 115, 15 }, { 238, 21 },
197  { 228, 21 }, { 236, 21 }, { 222, 21 }, { 216, 20 }, { 226, 20 },
198  { 196, 18 }, { 192, 17 }, { 120, 16 }, { 221, 14 }, { 51, 14 },
199  { 24, 11 }, { 143, 8 }, { 7, 6 }, { 9, 7 }, { 152, 10 },
200  { 136, 12 }, { 160, 12 }, { 241, 15 }, { 66, 15 }, { 168, 14 },
201  { 219, 14 }, { 113, 14 }, { 193, 12 }, { 19, 10 }, { 173, 10 },
202  { 105, 8 }, { 149, 9 }, { 15, 9 }, { 205, 13 }, { 207, 13 },
203  { 125, 17 }, { 190, 17 }, { 182, 16 }, { 68, 15 }, { 70, 15 },
204  { 67, 15 }, { 137, 13 }, { 31, 12 }, { 223, 14 }, { 116, 15 },
205  { 210, 19 }, { 220, 19 }, { 198, 18 }, { 126, 17 }, { 88, 16 },
206  { 41, 13 }, { 25, 11 }, { 40, 13 }, { 73, 15 }, { 243, 15 },
207  { 53, 14 }, { 195, 12 }, { 183, 11 }, { 225, 14 }, { 52, 14 },
208  { 71, 15 }, { 121, 16 }, { 89, 16 }, { 170, 14 }, { 55, 14 },
209  { 69, 15 }, { 83, 15 }, { 209, 13 }, { 108, 11 }, { 32, 12 },
210  { 54, 14 }, { 122, 16 }, { 184, 16 }, { 176, 15 }, { 42, 13 },
211  { 12, 8 }, { 161, 8 }, { 6, 5 }, { 167, 9 }, { 106, 9 },
212  { 20, 10 }, { 145, 12 }, { 111, 13 }, { 43, 13 }, { 26, 11 },
213  { 175, 10 }, { 107, 10 }, { 34, 12 }, { 33, 12 }, { 197, 12 },
214  { 74, 15 }, { 128, 17 }, { 232, 20 }, { 212, 20 }, { 224, 19 },
215  { 202, 18 }, { 90, 16 }, { 57, 14 }, { 227, 14 }, { 97, 16 },
216  { 93, 16 }, { 140, 15 }, { 185, 11 }, { 27, 11 }, { 16, 9 },
217  { 158, 11 }, { 211, 13 }, { 56, 14 }, { 117, 15 }, { 72, 15 },
218  { 166, 13 }, { 91, 16 }, { 95, 16 }, { 80, 15 }, { 101, 16 },
219  { 194, 17 }, { 127, 17 }, { 82, 15 }, { 21, 10 }, { 144, 10 },
220  { 177, 10 }, { 151, 6 }, { 10, 7 }, { 157, 7 }, { 8, 6 },
221  { 5, 4 }, { 13, 8 }, { 0, 9 }, { 213, 13 }, { 46, 13 },
222  { 199, 12 }, { 35, 12 }, { 162, 12 }, { 135, 10 }, { 169, 9 },
223  { 45, 13 }, { 59, 14 }, { 114, 14 }, { 44, 13 }, { 188, 16 },
224  { 186, 16 }, { 75, 15 }, { 79, 15 }, { 118, 15 }, { 187, 11 },
225  { 112, 13 }, { 139, 14 }, { 178, 15 }, { 81, 15 }, { 110, 12 },
226  { 28, 11 }, { 163, 8 }, { 133, 6 }, { 104, 6 }, { 17, 9 },
227  { 22, 10 }, { 229, 14 }, { 172, 14 }, { 217, 13 }, { 201, 12 },
228  { 36, 12 }, { 218, 20 }, { 242, 22 }, { 240, 22 }, { 234, 21 },
229  { 230, 19 }, { 206, 18 }, { 200, 18 }, { 214, 18 }, { 130, 17 },
230  { 131, 17 }, { 141, 15 }, { 84, 15 }, { 76, 15 }, { 215, 13 },
231  { 58, 14 }, { 231, 14 }, { 233, 14 }, { 180, 15 }, { 77, 15 },
232  { 37, 12 }, { 189, 11 }, { 179, 10 }, { 155, 10 }, { 47, 13 },
233  { 96, 16 }, { 99, 16 }, { 119, 15 }, { 63, 14 }, { 237, 14 },
234  { 78, 15 }, { 85, 15 }, { 60, 14 }, { 98, 16 }, { 100, 16 },
235  { 124, 16 }, { 123, 16 }, { 150, 11 }, { 1, 7 },
236 };
237 
238 
239 static const uint16_t coef0_run[HUFF_COEF0_SIZE] = {
240  0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
241  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
242  26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
243  40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
244  54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
245  68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
246  82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
247  96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
248  110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
249  124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
250  138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 1,
251  2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
252  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
253  30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3,
254  4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
255  18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
256  2, 3, 4, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
257  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
258  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
259  1, 0, 1, 0, 1, 0,
260 };
261 
262 static const float coef0_level[HUFF_COEF0_SIZE] = {
263  0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
264  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
265  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
266  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
267  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
268  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
269  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
270  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
271  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
272  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
273  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
274  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
275  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
276  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
277  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
278  3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,
279  5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11,
280  11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18,
281  18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25,
282  25, 26, 26, 27, 27, 28,
283 };
284 
285 
286 static const uint16_t coef1_run[HUFF_COEF1_SIZE] = {
287  0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
288  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
289  34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
290  52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
291  70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
292  88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5,
293  6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
294  24, 25, 26, 27, 28, 29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
295  2, 3, 4, 5, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 0, 1, 0,
296  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
297  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
298  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
299  1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
300  1, 0, 1, 0, 1, 0, 1, 0, 0, 0,
301 };
302 
303 static const float coef1_level[HUFF_COEF1_SIZE] = {
304  0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
305  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
306  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
307  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
308  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
310  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
311  2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
312  4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10,
313  10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19,
314  19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28,
315  28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37,
316  37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46,
317  46, 47, 47, 48, 48, 49, 49, 50, 51, 52,
318 };
319 /** @} */
320 
321 
322 /**
323  * @name Huffman and vector lookup tables for vector-coded coefficients
324  * @{
325  */
326 #define HUFF_VEC4_SIZE 127
327 #define HUFF_VEC4_MAXBITS 14
328 static const uint8_t vec4_lens[HUFF_VEC4_SIZE] = {
329  1, 6, 8, 10, 10, 10, 10, 8, 8, 10, 10, 9, 8, 8, 9, 12, 12, 11,
330  12, 12, 11, 9, 9, 8, 8, 9, 9, 8, 8, 9, 9, 12, 12, 12, 14, 14,
331  13, 11, 11, 9, 8, 9, 9, 11, 11, 10, 9, 8, 6, 6, 6, 6, 6, 6,
332  11, 11, 10, 11, 11, 10, 10, 11, 11, 9, 7, 6, 7, 7, 6, 6, 6, 5,
333  7, 11, 11, 10, 9, 8, 6, 9, 9, 10, 10, 9, 8, 8, 6, 6, 6, 8,
334  8, 9, 12, 12, 11, 10, 8, 8, 8, 10, 10, 10, 10, 9, 9, 8, 10, 11,
335  11, 9, 8, 8, 8, 9, 9, 10, 11, 12, 12, 9, 9, 9, 8, 8, 7, 7,
336  7,
337 };
338 
339 /* The entry in the following table with symbol zero indicates
340  * that four further entries are coded explicitly; all other
341  * entries encode four numbers in the 0..15 range via
342  * the four nibbles of (symbol - 1). */
343 static const uint16_t vec4_syms[HUFF_VEC4_SIZE] = {
344  0, 4370, 275, 8195, 4146, 12545, 8225, 290, 4625, 515,
345  20, 8706, 8210, 4355, 4131, 16385, 5121, 8961, 321, 1041,
346  51, 4641, 546, 4610, 530, 513, 8451, 4385, 4130, 33,
347  8211, 5, 66, 4161, 1281, 81, 6, 801, 8196, 8481,
348  8449, 4611, 531, 561, 769, 12290, 8226, 19, 4097, 2,
349  4369, 274, 4354, 4114, 12291, 16641, 12305, 49, 12321, 260,
350  4100, 516, 21, 12546, 8466, 4353, 4371, 4626, 257, 18,
351  17, 1, 4386, 8241, 771, 4865, 8705, 8194, 4098, 12561,
352  276, 50, 785, 4116, 8209, 4099, 273, 4113, 258, 259,
353  4609, 35, 1026, 1025, 16401, 305, 34, 529, 289, 770,
354  12289, 4, 4145, 4356, 12306, 8193, 12801, 261, 16386, 4881,
355  3, 514, 4129, 545, 306, 36, 4101, 65, 20481, 786,
356  4401, 4866, 8721, 291, 8450, 8465, 4115,
357 };
358 
359 
360 #define HUFF_VEC2_SIZE 137
361 #define HUFF_VEC2_MAXBITS 12
362 /* The entry in the following table with symbol zero indicates
363  * that two further entries are coded explicitly; all other
364  * entries encode two numbers in the 0..15 range via
365  * (symbol - 1) & 0xF and (symbol - 1) >> 4. */
366 static const uint8_t vec2_table[HUFF_VEC2_SIZE][2] = {
367  { 19, 5 }, { 165, 10 }, { 211, 11 }, { 46, 11 }, { 75, 10 },
368  { 177, 11 }, { 12, 11 }, { 86, 8 }, { 83, 7 }, { 38, 7 },
369  { 133, 9 }, { 178, 10 }, { 28, 10 }, { 104, 9 }, { 73, 9 },
370  { 35, 5 }, { 52, 6 }, { 113, 9 }, { 8, 9 }, { 101, 8 },
371  { 69, 7 }, { 0, 3 }, { 71, 8 }, { 119, 9 }, { 91, 10 },
372  { 179, 10 }, { 114, 8 }, { 166, 10 }, { 10, 10 }, { 44, 10 },
373  { 145, 10 }, { 66, 6 }, { 21, 6 }, { 24, 8 }, { 146, 9 },
374  { 26, 9 }, { 65, 7 }, { 5, 7 }, { 226, 11 }, { 225, 12 },
375  { 15, 12 }, { 180, 10 }, { 147, 9 }, { 115, 8 }, { 40, 8 },
376  { 89, 9 }, { 134, 9 }, { 84, 7 }, { 54, 7 }, { 42, 9 },
377  { 60, 10 }, { 31, 11 }, { 193, 11 }, { 181, 10 }, { 76, 10 },
378  { 148, 9 }, { 37, 6 }, { 67, 6 }, { 33, 6 }, { 3, 6 },
379  { 17, 6 }, { 2, 6 }, { 102, 8 }, { 87, 8 }, { 116, 8 },
380  { 56, 8 }, { 50, 5 }, { 20, 5 }, { 120, 9 }, { 58, 9 },
381  { 29, 10 }, { 194, 10 }, { 135, 9 }, { 97, 8 }, { 7, 8 },
382  { 105, 9 }, { 13, 11 }, { 241, 12 }, { 16, 12 }, { 45, 10 },
383  { 149, 9 }, { 74, 9 }, { 98, 7 }, { 23, 7 }, { 85, 7 },
384  { 70, 7 }, { 195, 10 }, { 161, 10 }, { 129, 9 }, { 72, 8 },
385  { 51, 5 }, { 36, 5 }, { 117, 8 }, { 61, 10 }, { 11, 10 },
386  { 162, 9 }, { 1, 7 }, { 4, 6 }, { 49, 6 }, { 68, 6 },
387  { 9, 9 }, { 27, 9 }, { 130, 8 }, { 39, 7 }, { 53, 6 },
388  { 99, 7 }, { 25, 8 }, { 150, 9 }, { 90, 9 }, { 103, 8 },
389  { 163, 9 }, { 196, 10 }, { 210, 10 }, { 136, 9 }, { 121, 9 },
390  { 41, 8 }, { 131, 8 }, { 43, 9 }, { 164, 9 }, { 118, 8 },
391  { 88, 8 }, { 81, 7 }, { 6, 7 }, { 55, 7 }, { 59, 9 },
392  { 30, 10 }, { 209, 11 }, { 14, 11 }, { 151, 9 }, { 106, 9 },
393  { 82, 6 }, { 22, 6 }, { 100, 7 }, { 132, 8 }, { 57, 8 },
394  { 18, 4 }, { 34, 4 },
395 };
396 
397 
398 #define HUFF_VEC1_SIZE 101
399 #define HUFF_VEC1_MAXBITS 11
400 static const uint8_t vec1_table[HUFF_VEC1_SIZE][2] = {
401  { 7, 5 }, { 32, 8 }, { 59, 10 }, { 60, 10 }, { 83, 11 },
402  { 82, 11 }, { 62, 10 }, { 33, 8 }, { 45, 9 }, { 61, 10 },
403  { 84, 11 }, { 85, 11 }, { 1, 6 }, { 13, 5 }, { 19, 6 },
404  { 25, 7 }, { 34, 8 }, { 46, 9 }, { 47, 9 }, { 14, 5 },
405  { 6, 5 }, { 64, 10 }, { 87, 11 }, { 86, 11 }, { 63, 10 },
406  { 88, 11 }, { 90, 11 }, { 35, 8 }, { 26, 7 }, { 0, 7 },
407  { 48, 9 }, { 65, 10 }, { 66, 10 }, { 36, 8 }, { 15, 5 },
408  { 20, 6 }, { 91, 11 }, { 89, 11 }, { 67, 10 }, { 49, 9 },
409  { 50, 9 }, { 69, 10 }, { 92, 11 }, { 93, 11 }, { 27, 7 },
410  { 5, 5 }, { 37, 8 }, { 68, 10 }, { 71, 10 }, { 51, 9 },
411  { 52, 9 }, { 70, 10 }, { 94, 11 }, { 96, 11 }, { 38, 8 },
412  { 21, 6 }, { 16, 5 }, { 4, 5 }, { 28, 7 }, { 53, 9 },
413  { 95, 11 }, { 97, 11 }, { 73, 10 }, { 39, 8 }, { 29, 7 },
414  { 72, 10 }, { 98, 11 }, { 99, 11 }, { 54, 9 }, { 40, 8 },
415  { 22, 6 }, { 30, 7 }, { 55, 9 }, { 74, 10 }, { 76, 10 },
416  { 56, 9 }, { 75, 10 }, { 77, 10 }, { 17, 5 }, { 3, 5 },
417  { 23, 6 }, { 41, 8 }, { 57, 9 }, { 78, 10 }, { 79, 10 },
418  { 31, 7 }, { 10, 4 }, { 9, 4 }, { 100, 5 }, { 2, 5 },
419  { 11, 4 }, { 8, 4 }, { 18, 5 }, { 42, 8 }, { 58, 9 },
420  { 80, 10 }, { 81, 10 }, { 43, 8 }, { 44, 8 }, { 24, 6 },
421  { 12, 4 },
422 };
423 /** @} */
424 
425 
426 /**
427  * @brief decorrelation matrix for multichannel streams
428  **/
429 static const float default_decorrelation_matrices[] = {
430  1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031,
431  0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406,
432  0.500000, 0.652344, 0.500000, 0.269531, 0.500000, 0.269531, -0.500000,
433  -0.652344, 0.500000, -0.269531, -0.500000, 0.652344, 0.500000, -0.652344,
434  0.500000, -0.269531, 0.445312, 0.601562, 0.511719, 0.371094, 0.195312,
435  0.445312, 0.371094, -0.195312, -0.601562, -0.511719, 0.445312, 0.000000,
436  -0.632812, 0.000000, 0.632812, 0.445312, -0.371094, -0.195312, 0.601562,
437  -0.511719, 0.445312, -0.601562, 0.511719, -0.371094, 0.195312, 0.410156,
438  0.558594, 0.500000, 0.410156, 0.289062, 0.148438, 0.410156, 0.410156,
439  0.000000, -0.410156, -0.578125, -0.410156, 0.410156, 0.148438, -0.500000,
440  -0.410156, 0.289062, 0.558594, 0.410156, -0.148438, -0.500000, 0.410156,
441  0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125,
442  0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438,
443 };
444 
445 /**
446  * @brief default decorrelation matrix offsets
447  */
448 static const float * const default_decorrelation[] = {
449  NULL,
456 };
457 
458 #endif /* AVCODEC_WMAPRODATA_H */
default_decorrelation
static const float *const default_decorrelation[]
default decorrelation matrix offsets
Definition: wmaprodata.h:448
vec4_lens
static const uint8_t vec4_lens[HUFF_VEC4_SIZE]
Definition: wmaprodata.h:328
HUFF_SCALE_SIZE
#define HUFF_SCALE_SIZE
Definition: wmaprodata.h:49
vec2_table
static const uint8_t vec2_table[HUFF_VEC2_SIZE][2]
Definition: wmaprodata.h:366
scale_table
static const uint8_t scale_table[HUFF_SCALE_SIZE][2]
Definition: wmaprodata.h:51
coef0_run
static const uint16_t coef0_run[HUFF_COEF0_SIZE]
Definition: wmaprodata.h:239
HUFF_SCALE_RL_SIZE
#define HUFF_SCALE_RL_SIZE
Definition: wmaprodata.h:85
coef0_syms
static const uint16_t coef0_syms[HUFF_COEF0_SIZE]
Definition: wmaprodata.h:161
HUFF_COEF1_SIZE
#define HUFF_COEF1_SIZE
Definition: wmaprodata.h:184
NULL
#define NULL
Definition: coverity.c:32
vec1_table
static const uint8_t vec1_table[HUFF_VEC1_SIZE][2]
Definition: wmaprodata.h:400
HUFF_VEC1_SIZE
#define HUFF_VEC1_SIZE
Definition: wmaprodata.h:398
scale_rl_level
static const uint8_t scale_rl_level[HUFF_SCALE_RL_SIZE]
Definition: wmaprodata.h:125
HUFF_COEF0_SIZE
#define HUFF_COEF0_SIZE
Definition: wmaprodata.h:141
critical_freq
static const uint16_t critical_freq[]
frequencies to divide the frequency spectrum into scale factor bands
Definition: wmaprodata.h:37
scale_rl_run
static const uint8_t scale_rl_run[HUFF_SCALE_RL_SIZE]
Definition: wmaprodata.h:115
HUFF_VEC2_SIZE
#define HUFF_VEC2_SIZE
Definition: wmaprodata.h:360
coef1_level
static const float coef1_level[HUFF_COEF1_SIZE]
Definition: wmaprodata.h:303
coef1_run
static const uint16_t coef1_run[HUFF_COEF1_SIZE]
Definition: wmaprodata.h:286
HUFF_VEC4_SIZE
#define HUFF_VEC4_SIZE
Definition: wmaprodata.h:326
scale_rl_table
static const uint8_t scale_rl_table[HUFF_SCALE_RL_SIZE][2]
Definition: wmaprodata.h:87
vec4_syms
static const uint16_t vec4_syms[HUFF_VEC4_SIZE]
Definition: wmaprodata.h:343
coef0_lens
static const uint8_t coef0_lens[HUFF_COEF0_SIZE]
Definition: wmaprodata.h:143
coef0_level
static const float coef0_level[HUFF_COEF0_SIZE]
Definition: wmaprodata.h:262
default_decorrelation_matrices
static const float default_decorrelation_matrices[]
decorrelation matrix for multichannel streams
Definition: wmaprodata.h:429
coef1_table
static const uint8_t coef1_table[HUFF_COEF1_SIZE][2]
Definition: wmaprodata.h:186