ScummVM API documentation
qdm2data.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef AUDIO_QDM2DATA_H
23#define AUDIO_QDM2DATA_H
24
25#include "common/scummsys.h"
26
27namespace Audio {
28
30
31// values in this table range from -1..23; adjust retrieved value by -1
32static const uint16 vlc_tab_level_huffcodes[24] = {
33 0x037c, 0x0004, 0x003c, 0x004c, 0x003a, 0x002c, 0x001c, 0x001a,
34 0x0024, 0x0014, 0x0001, 0x0002, 0x0000, 0x0003, 0x0007, 0x0005,
35 0x0006, 0x0008, 0x0009, 0x000a, 0x000c, 0x00fc, 0x007c, 0x017c
36};
37
38static const byte vlc_tab_level_huffbits[24] = {
39 10, 6, 7, 7, 6, 6, 6, 6, 6, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 7, 8, 9, 10
40};
41
42// values in this table range from -1..36; adjust retrieved value by -1
43static const uint16 vlc_tab_diff_huffcodes[37] = {
44 0x1c57, 0x0004, 0x0000, 0x0001, 0x0003, 0x0002, 0x000f, 0x000e,
45 0x0007, 0x0016, 0x0037, 0x0027, 0x0026, 0x0066, 0x0006, 0x0097,
46 0x0046, 0x01c6, 0x0017, 0x0786, 0x0086, 0x0257, 0x00d7, 0x0357,
47 0x00c6, 0x0386, 0x0186, 0x0000, 0x0157, 0x0c57, 0x0057, 0x0000,
48 0x0b86, 0x0000, 0x1457, 0x0000, 0x0457
49};
50
51static const byte vlc_tab_diff_huffbits[37] = {
52 13, 3, 3, 2, 3, 3, 4, 4, 6, 5, 6, 6, 7, 7, 8, 8,
53 8, 9, 8, 11, 9, 10, 8, 10, 9, 12, 10, 0, 10, 13, 11, 0,
54 12, 0, 13, 0, 13
55};
56
57// values in this table range from -1..5; adjust retrieved value by -1
58static const byte vlc_tab_run_huffcodes[6] = {
59 0x1f, 0x00, 0x01, 0x03, 0x07, 0x0f
60};
61
62static const byte vlc_tab_run_huffbits[6] = {
63 5, 1, 2, 3, 4, 5
64};
65
66// values in this table range from -1..19; adjust retrieved value by -1
67static const uint16 vlc_tab_tone_level_idx_hi1_huffcodes[20] = {
68 0x5714, 0x000c, 0x0002, 0x0001, 0x0000, 0x0004, 0x0034, 0x0054,
69 0x0094, 0x0014, 0x0114, 0x0214, 0x0314, 0x0614, 0x0e14, 0x0f14,
70 0x2714, 0x0714, 0x1714, 0x3714
71};
72
73static const byte vlc_tab_tone_level_idx_hi1_huffbits[20] = {
74 15, 4, 2, 1, 3, 5, 6, 7, 8, 10, 10, 11, 11, 12, 12, 12, 14, 14, 15, 14
75};
76
77// values in this table range from -1..23; adjust retrieved value by -1
78static const uint16 vlc_tab_tone_level_idx_mid_huffcodes[24] = {
79 0x0fea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
80 0x0000, 0x0000, 0x0000, 0x0000, 0x03ea, 0x00ea, 0x002a, 0x001a,
81 0x0006, 0x0001, 0x0000, 0x0002, 0x000a, 0x006a, 0x01ea, 0x07ea
82};
83
84static const byte vlc_tab_tone_level_idx_mid_huffbits[24] = {
85 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12
86};
87
88// values in this table range from -1..23; adjust retrieved value by -1
89static const uint16 vlc_tab_tone_level_idx_hi2_huffcodes[24] = {
90 0x0664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0064, 0x00e4,
91 0x00a4, 0x0068, 0x0004, 0x0008, 0x0014, 0x0018, 0x0000, 0x0001,
92 0x0002, 0x0003, 0x000c, 0x0028, 0x0024, 0x0164, 0x0000, 0x0264
93};
94
95static const byte vlc_tab_tone_level_idx_hi2_huffbits[24] = {
96 11, 0, 0, 0, 0, 0, 10, 8, 8, 7, 6, 6, 5, 5, 4, 2, 2, 2, 4, 7, 8, 9, 0, 11
97};
98
99// values in this table range from -1..8; adjust retrieved value by -1
100static const byte vlc_tab_type30_huffcodes[9] = {
101 0x3c, 0x06, 0x00, 0x01, 0x03, 0x02, 0x04, 0x0c, 0x1c
102};
103
104static const byte vlc_tab_type30_huffbits[9] = {
105 6, 3, 3, 2, 2, 3, 4, 5, 6
106};
107
108// values in this table range from -1..9; adjust retrieved value by -1
109static const byte vlc_tab_type34_huffcodes[10] = {
110 0x18, 0x00, 0x01, 0x04, 0x05, 0x07, 0x03, 0x02, 0x06, 0x08
111};
112
113static const byte vlc_tab_type34_huffbits[10] = {
114 5, 4, 3, 3, 3, 3, 3, 3, 3, 5
115};
116
117// values in this table range from -1..22; adjust retrieved value by -1
118static const uint16 vlc_tab_fft_tone_offset_0_huffcodes[23] = {
119 0x038e, 0x0001, 0x0000, 0x0022, 0x000a, 0x0006, 0x0012, 0x0002,
120 0x001e, 0x003e, 0x0056, 0x0016, 0x000e, 0x0032, 0x0072, 0x0042,
121 0x008e, 0x004e, 0x00f2, 0x002e, 0x0036, 0x00c2, 0x018e
122};
123
124static const byte vlc_tab_fft_tone_offset_0_huffbits[23] = {
125 10, 1, 2, 6, 4, 5, 6, 7, 6, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 6, 6, 8, 10
126};
127
128// values in this table range from -1..27; adjust retrieved value by -1
129static const uint16 vlc_tab_fft_tone_offset_1_huffcodes[28] = {
130 0x07a4, 0x0001, 0x0020, 0x0012, 0x001c, 0x0008, 0x0006, 0x0010,
131 0x0000, 0x0014, 0x0004, 0x0032, 0x0070, 0x000c, 0x0002, 0x003a,
132 0x001a, 0x002c, 0x002a, 0x0022, 0x0024, 0x000a, 0x0064, 0x0030,
133 0x0062, 0x00a4, 0x01a4, 0x03a4
134};
135
136static const byte vlc_tab_fft_tone_offset_1_huffbits[28] = {
137 11, 1, 6, 6, 5, 4, 3, 6, 6, 5, 6, 6, 7, 6, 6, 6,
138 6, 6, 6, 7, 8, 6, 7, 7, 7, 9, 10, 11
139};
140
141// values in this table range from -1..31; adjust retrieved value by -1
142static const uint16 vlc_tab_fft_tone_offset_2_huffcodes[32] = {
143 0x1760, 0x0001, 0x0000, 0x0082, 0x000c, 0x0006, 0x0003, 0x0007,
144 0x0008, 0x0004, 0x0010, 0x0012, 0x0022, 0x001a, 0x0000, 0x0020,
145 0x000a, 0x0040, 0x004a, 0x006a, 0x002a, 0x0042, 0x0002, 0x0060,
146 0x00aa, 0x00e0, 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0760, 0x0f60
147};
148
149static const byte vlc_tab_fft_tone_offset_2_huffbits[32] = {
150 13, 2, 0, 8, 4, 3, 3, 3, 4, 4, 5, 5, 6, 5, 7, 7,
151 7, 7, 7, 7, 8, 8, 8, 9, 8, 8, 9, 9, 10, 11, 13, 12
152};
153
154// values in this table range from -1..34; adjust retrieved value by -1
155static const uint16 vlc_tab_fft_tone_offset_3_huffcodes[35] = {
156 0x33ea, 0x0005, 0x0000, 0x000c, 0x0000, 0x0006, 0x0003, 0x0008,
157 0x0002, 0x0001, 0x0004, 0x0007, 0x001a, 0x000f, 0x001c, 0x002c,
158 0x000a, 0x001d, 0x002d, 0x002a, 0x000d, 0x004c, 0x008c, 0x006a,
159 0x00cd, 0x004d, 0x00ea, 0x020c, 0x030c, 0x010c, 0x01ea, 0x07ea,
160 0x0bea, 0x03ea, 0x13ea
161};
162
163static const byte vlc_tab_fft_tone_offset_3_huffbits[35] = {
164 14, 4, 0, 10, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6,
165 6, 5, 6, 7, 7, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11,
166 12, 13, 14
167};
168
169// values in this table range from -1..37; adjust retrieved value by -1
170static const uint16 vlc_tab_fft_tone_offset_4_huffcodes[38] = {
171 0x5282, 0x0016, 0x0000, 0x0136, 0x0004, 0x0000, 0x0007, 0x000a,
172 0x000e, 0x0003, 0x0001, 0x000d, 0x0006, 0x0009, 0x0012, 0x0005,
173 0x0025, 0x0022, 0x0015, 0x0002, 0x0076, 0x0035, 0x0042, 0x00c2,
174 0x0182, 0x00b6, 0x0036, 0x03c2, 0x0482, 0x01c2, 0x0682, 0x0882,
175 0x0a82, 0x0082, 0x0282, 0x1282, 0x3282, 0x2282
176};
177
178static const byte vlc_tab_fft_tone_offset_4_huffbits[38] = {
179 15, 6, 0, 9, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6,
180 6, 6, 6, 8, 7, 6, 8, 9, 9, 8, 9, 10, 11, 10, 11, 12,
181 12, 12, 14, 15, 14, 14
182};
183
185
186// values in this table range from -1..27; adjust retrieved value by -1
187static const uint16 fft_level_exp_alt_huffcodes[28] = {
188 0x1ec6, 0x0006, 0x00c2, 0x0142, 0x0242, 0x0246, 0x00c6, 0x0046,
189 0x0042, 0x0146, 0x00a2, 0x0062, 0x0026, 0x0016, 0x000e, 0x0005,
190 0x0004, 0x0003, 0x0000, 0x0001, 0x000a, 0x0012, 0x0002, 0x0022,
191 0x01c6, 0x02c6, 0x06c6, 0x0ec6
192};
193
194static const byte fft_level_exp_alt_huffbits[28] = {
195 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3,
196 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13
197};
198
199// values in this table range from -1..19; adjust retrieved value by -1
200static const uint16 fft_level_exp_huffcodes[20] = {
201 0x0f24, 0x0001, 0x0002, 0x0000, 0x0006, 0x0005, 0x0007, 0x000c,
202 0x000b, 0x0014, 0x0013, 0x0004, 0x0003, 0x0023, 0x0064, 0x00a4,
203 0x0024, 0x0124, 0x0324, 0x0724
204};
205
206static const byte fft_level_exp_huffbits[20] = {
207 12, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12
208};
209
210// values in this table range from -1..6; adjust retrieved value by -1
211static const byte fft_stereo_exp_huffcodes[7] = {
212 0x3e, 0x01, 0x00, 0x02, 0x06, 0x0e, 0x1e
213};
214
215static const byte fft_stereo_exp_huffbits[7] = {
216 6, 1, 2, 3, 4, 5, 6
217};
218
219// values in this table range from -1..8; adjust retrieved value by -1
220static const byte fft_stereo_phase_huffcodes[9] = {
221 0x35, 0x02, 0x00, 0x01, 0x0d, 0x15, 0x05, 0x09, 0x03
222};
223
224static const byte fft_stereo_phase_huffbits[9] = {
225 6, 2, 2, 4, 4, 6, 5, 4, 2
226};
227
228static const int fft_cutoff_index_table[4][2] = {
229 { 1, 2 }, {-1, 0 }, {-1,-2 }, { 0, 0 }
230};
231
232static const int16 fft_level_index_table[256] = {
233 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
234 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
235 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
236 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
237 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
238 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
239 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
240 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
241 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
242 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
243 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
244 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
245 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
246 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
247 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
248 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
249};
250
251static const byte last_coeff[3] = {
252 4, 7, 10
253};
254
255static const byte coeff_per_sb_for_avg[3][30] = {
256 { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
257 { 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
258 { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9 }
259};
260
261static const uint32 dequant_table[3][10][30] = {
262 { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
263 { 0, 256, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
264 { 0, 0, 0, 51, 102, 154, 205, 256, 238, 219, 201, 183, 165, 146, 128, 110, 91, 73, 55, 37, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
265 { 0, 0, 0, 0, 0, 0, 0, 0, 18, 37, 55, 73, 91, 110, 128, 146, 165, 183, 201, 219, 238, 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 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
288 { 0, 0, 0, 0, 0, 0, 0, 85, 171, 256, 192, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
289 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 128, 192, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
290 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 102, 154, 205, 256, 213, 171, 128, 85, 43, 0, 0, 0, 0, 0, 0 },
291 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 85, 128, 171, 213, 256, 213, 171, 128, 85, 43 } }
292};
293
294static const byte coeff_per_sb_for_dequant[3][30] = {
295 { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
296 { 0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 },
297 { 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9 }
298};
299
300// first index is subband, 2nd index is 0, 1 or 3 (2 is unused)
301static const int8 tone_level_idx_offset_table[30][4] = {
302 { -50, -50, 0, -50 },
303 { -50, -50, 0, -50 },
304 { -50, -9, 0, -19 },
305 { -16, -6, 0, -12 },
306 { -11, -4, 0, -8 },
307 { -8, -3, 0, -6 },
308 { -7, -3, 0, -5 },
309 { -6, -2, 0, -4 },
310 { -5, -2, 0, -3 },
311 { -4, -1, 0, -3 },
312 { -4, -1, 0, -2 },
313 { -3, -1, 0, -2 },
314 { -3, -1, 0, -2 },
315 { -3, -1, 0, -2 },
316 { -2, -1, 0, -1 },
317 { -2, -1, 0, -1 },
318 { -2, -1, 0, -1 },
319 { -2, 0, 0, -1 },
320 { -2, 0, 0, -1 },
321 { -1, 0, 0, -1 },
322 { -1, 0, 0, -1 },
323 { -1, 0, 0, -1 },
324 { -1, 0, 0, -1 },
325 { -1, 0, 0, -1 },
326 { -1, 0, 0, -1 },
327 { -1, 0, 0, -1 },
328 { -1, 0, 0, 0 },
329 { -1, 0, 0, 0 },
330 { -1, 0, 0, 0 },
331 { -1, 0, 0, 0 }
332};
333
334/* all my samples have 1st index 0 or 1 */
335/* second index is subband, only indexes 0-29 seem to be used */
336static const int8 coding_method_table[5][30] = {
337 { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10,
338 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
339 },
340 { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10,
341 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
342 },
343 { 34, 30, 30, 30, 24, 24, 16, 16, 16, 16, 16, 16, 10, 10, 10,
344 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
345 },
346 { 34, 34, 30, 30, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16,
347 16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10
348 },
349 { 34, 34, 30, 30, 30, 30, 30, 30, 24, 24, 24, 24, 24, 24, 24,
350 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
351 },
352};
353
354static const int vlc_stage3_values[60] = {
355 0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24,
356 28, 36, 44, 52, 60, 76, 92, 108, 124, 156, 188, 220,
357 252, 316, 380, 444, 508, 636, 764, 892, 1020, 1276, 1532, 1788,
358 2044, 2556, 3068, 3580, 4092, 5116, 6140, 7164, 8188, 10236, 12284, 14332,
359 16380, 20476, 24572, 28668, 32764, 40956, 49148, 57340, 65532, 81916, 98300,114684
360};
361
362static const float fft_tone_sample_table[4][16][5] = {
363 { { .0100000000f,-.0037037037f,-.0020000000f,-.0069444444f,-.0018416207f },
364 { .0416666667f, .0000000000f, .0000000000f,-.0208333333f,-.0123456791f },
365 { .1250000000f, .0558035709f, .0330687836f,-.0164473690f,-.0097465888f },
366 { .1562500000f, .0625000000f, .0370370370f,-.0062500000f,-.0037037037f },
367 { .1996007860f, .0781250000f, .0462962948f, .0022727272f, .0013468013f },
368 { .2000000000f, .0625000000f, .0370370373f, .0208333333f, .0074074073f },
369 { .2127659619f, .0555555556f, .0329218097f, .0208333333f, .0123456791f },
370 { .2173913121f, .0473484844f, .0280583613f, .0347222239f, .0205761325f },
371 { .2173913121f, .0347222239f, .0205761325f, .0473484844f, .0280583613f },
372 { .2127659619f, .0208333333f, .0123456791f, .0555555556f, .0329218097f },
373 { .2000000000f, .0208333333f, .0074074073f, .0625000000f, .0370370370f },
374 { .1996007860f, .0022727272f, .0013468013f, .0781250000f, .0462962948f },
375 { .1562500000f,-.0062500000f,-.0037037037f, .0625000000f, .0370370370f },
376 { .1250000000f,-.0164473690f,-.0097465888f, .0558035709f, .0330687836f },
377 { .0416666667f,-.0208333333f,-.0123456791f, .0000000000f, .0000000000f },
378 { .0100000000f,-.0069444444f,-.0018416207f,-.0037037037f,-.0020000000f } },
379
380 { { .0050000000f,-.0200000000f, .0125000000f,-.3030303030f, .0020000000f },
381 { .1041666642f, .0400000000f,-.0250000000f, .0333333333f,-.0200000000f },
382 { .1250000000f, .0100000000f, .0142857144f,-.0500000007f,-.0200000000f },
383 { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f },
384 { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f },
385 { .1250000000f,-.0500000000f,-.0200000000f, .0100000000f, .0142857144f },
386 { .1041666667f, .0333333333f,-.0200000000f, .0400000000f,-.0250000000f },
387 { .0050000000f,-.3030303030f, .0020000001f,-.0200000000f, .0125000000f },
388 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
389 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
390 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
391 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
392 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
393 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
394 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
395 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } },
396
397 { { .1428571492f, .1250000000f,-.0285714287f,-.0357142873f, .0208333333f },
398 { .1818181818f, .0588235296f, .0333333333f, .0212765951f, .0100000000f },
399 { .1818181818f, .0212765951f, .0100000000f, .0588235296f, .0333333333f },
400 { .1428571492f,-.0357142873f, .0208333333f, .1250000000f,-.0285714287f },
401 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
402 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
403 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
404 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
405 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
406 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
407 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
408 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
409 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
410 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
411 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
412 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } },
413
414 { { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
415 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
416 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
417 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
418 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
419 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
420 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
421 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
422 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
423 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
424 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
425 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
426 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
427 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
428 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
429 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }
430};
431
432static const float fft_tone_level_table[2][64] = { {
433// pow ~ (i > 46) ? 0 : (((((i & 1) ? 431 : 304) << (i >> 1))) / 1024.0);
434 0.17677669f, 0.42677650f, 0.60355347f, 0.85355347f,
435 1.20710683f, 1.68359375f, 2.37500000f, 3.36718750f,
436 4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f,
437 19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f,
438 76.0000000f, 107.750000f, 152.000000f, 215.500000f,
439 304.000000f, 431.000000f, 608.000000f, 862.000000f,
440 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f,
441 4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f,
442 19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f,
443 77824.0000f, 110336.000f, 155648.000f, 220672.000f,
444 311296.000f, 441344.000f, 622592.000f, 882688.000f,
445 1245184.00f, 1765376.00f, 2490368.00f, 0.00000000f,
446 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
447 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
448 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
449 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
450 }, {
451// pow = (i > 45) ? 0 : ((((i & 1) ? 431 : 304) << (i >> 1)) / 512.0);
452 0.59375000f, 0.84179688f, 1.18750000f, 1.68359375f,
453 2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f,
454 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f,
455 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f,
456 152.000000f, 215.500000f, 304.000000f, 431.000000f,
457 608.000000f, 862.000000f, 1216.00000f, 1724.00000f,
458 2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f,
459 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f,
460 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f,
461 155648.000f, 220672.000f, 311296.000f, 441344.000f,
462 622592.000f, 882688.000f, 1245184.00f, 1765376.00f,
463 2490368.00f, 3530752.00f, 0.00000000f, 0.00000000f,
464 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
465 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
466 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
467 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f
468} };
469
470static const float fft_tone_envelope_table[4][31] = {
471 { .009607375f, .038060248f, .084265202f, .146446645f, .222214907f, .308658302f,
472 .402454883f, .500000060f, .597545207f, .691341758f, .777785182f, .853553414f,
473 .915734828f, .961939812f, .990392685f, 1.00000000f, .990392625f, .961939752f,
474 .915734768f, .853553295f, .777785063f, .691341639f, .597545087f, .500000000f,
475 .402454853f, .308658272f, .222214878f, .146446615f, .084265172f, .038060218f,
476 .009607345f },
477 { .038060248f, .146446645f, .308658302f, .500000060f, .691341758f, .853553414f,
478 .961939812f, 1.00000000f, .961939752f, .853553295f, .691341639f, .500000000f,
479 .308658272f, .146446615f, .038060218f, .000000000f, .000000000f, .000000000f,
480 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
481 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
482 .000000000f },
483 { .146446645f, .500000060f, .853553414f, 1.00000000f, .853553295f, .500000000f,
484 .146446615f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
485 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
486 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
487 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
488 .000000000f },
489 { .500000060f, 1.00000000f, .500000000f, .000000000f, .000000000f, .000000000f,
490 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
491 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
492 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
493 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
494 .000000000f }
495};
496
497static const float sb_noise_attenuation[32] = {
498 0.0f, 0.0f, 0.3f, 0.4f, 0.5f, 0.7f, 1.0f, 1.0f,
499 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
500 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
501 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
502};
503
504static const byte fft_subpackets[32] = {
505 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
506 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0
507};
508
509// first index is joined_stereo, second index is 0 or 2 (1 is unused)
510static const float dequant_1bit[2][3] = {
511 {-0.920000f, 0.000000f, 0.920000f },
512 {-0.890000f, 0.000000f, 0.890000f }
513};
514
515static const float type30_dequant[8] = {
516 -1.0f,-0.625f,-0.291666656732559f,0.0f,
517 0.25f,0.5f,0.75f,1.0f,
518};
519
520static const float type34_delta[10] = { // FIXME: covers 8 entries..
521 -1.0f,-0.60947573184967f,-0.333333343267441f,-0.138071194291115f,0.0f,
522 0.138071194291115f,0.333333343267441f,0.60947573184967f,1.0f,0.0f,
523};
524
525} // End of namespace Audio
526
527#endif
Definition: system.h:39