FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/qua_gain_tab.c @ 356:5ccfe176bae1
libtwamr: integrate dec_gain.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 05 May 2024 22:24:42 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
355:9beb01439a90 | 356:5ccfe176bae1 |
---|---|
1 #include "typedef.h" | |
2 #include "namespace.h" | |
3 #include "qua_gain_tab.h" | |
4 | |
5 /* The tables contains the following data: | |
6 | |
7 g_pitch (Q14), | |
8 g_fac (Q12), (g_code = g_code0*g_fac), | |
9 qua_ener_MR122 (Q10), (log2(g_fac)) | |
10 qua_ener (Q10) (20*log10(g_fac)) | |
11 | |
12 The log2() and log10() values are calculated on the fixed point value | |
13 (g_fac Q12) and not on the original floating point value of g_fac | |
14 to make the quantizer/MA predictdor use corresponding values. | |
15 */ | |
16 | |
17 /* table used in 'high' rates: MR67 MR74 */ | |
18 | |
19 const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] = { | |
20 /* Note: column 4 (qua_ener) contains the original values from IS641 | |
21 to ensure bit-exactness; however, they are not exactly the | |
22 rounded value of (20*log10(g_fac)) */ | |
23 /*g_pit, g_fac, qua_ener_MR122, qua_ener */ | |
24 577, 662, -2692, -16214, | |
25 806, 1836, -1185, -7135, | |
26 3109, 1052, -2008, -12086, | |
27 4181, 1387, -1600, -9629, | |
28 2373, 1425, -1560, -9394, | |
29 3248, 1985, -1070, -6442, | |
30 1827, 2320, -840, -5056, | |
31 941, 3314, -313, -1885, | |
32 2351, 2977, -471, -2838, | |
33 3616, 2420, -777, -4681, | |
34 3451, 3096, -414, -2490, | |
35 2955, 4301, 72, 434, | |
36 1848, 4500, 139, 836, | |
37 3884, 5416, 413, 2484, | |
38 1187, 7210, 835, 5030, | |
39 3083, 9000, 1163, 7002, | |
40 7384, 883, -2267, -13647, | |
41 5962, 1506, -1478, -8900, | |
42 5155, 2134, -963, -5800, | |
43 7944, 2009, -1052, -6335, | |
44 6507, 2250, -885, -5327, | |
45 7670, 2752, -588, -3537, | |
46 5952, 3016, -452, -2724, | |
47 4898, 3764, -125, -751, | |
48 6989, 3588, -196, -1177, | |
49 8174, 3978, -43, -260, | |
50 6064, 4404, 107, 645, | |
51 7709, 5087, 320, 1928, | |
52 5523, 6021, 569, 3426, | |
53 7769, 7126, 818, 4926, | |
54 6060, 7938, 977, 5885, | |
55 5594, 11487, 1523, 9172, | |
56 10581, 1356, -1633, -9831, | |
57 9049, 1597, -1391, -8380, | |
58 9794, 2035, -1033, -6220, | |
59 8946, 2415, -780, -4700, | |
60 10296, 2584, -681, -4099, | |
61 9407, 2734, -597, -3595, | |
62 8700, 3218, -356, -2144, | |
63 9757, 3395, -277, -1669, | |
64 10177, 3892, -75, -454, | |
65 9170, 4528, 148, 891, | |
66 10152, 5004, 296, 1781, | |
67 9114, 5735, 497, 2993, | |
68 10500, 6266, 628, 3782, | |
69 10110, 7631, 919, 5534, | |
70 8844, 8727, 1117, 6728, | |
71 8956, 12496, 1648, 9921, | |
72 12924, 976, -2119, -12753, | |
73 11435, 1755, -1252, -7539, | |
74 12138, 2328, -835, -5024, | |
75 11388, 2368, -810, -4872, | |
76 10700, 3064, -429, -2580, | |
77 12332, 2861, -530, -3192, | |
78 11722, 3327, -307, -1848, | |
79 11270, 3700, -150, -904, | |
80 10861, 4413, 110, 663, | |
81 12082, 4533, 150, 902, | |
82 11283, 5205, 354, 2132, | |
83 11960, 6305, 637, 3837, | |
84 11167, 7534, 900, 5420, | |
85 12128, 8329, 1049, 6312, | |
86 10969, 10777, 1429, 8604, | |
87 10300, 17376, 2135, 12853, | |
88 13899, 1681, -1316, -7921, | |
89 12580, 2045, -1026, -6179, | |
90 13265, 2439, -766, -4610, | |
91 14033, 2989, -465, -2802, | |
92 13452, 3098, -413, -2482, | |
93 12396, 3658, -167, -1006, | |
94 13510, 3780, -119, -713, | |
95 12880, 4272, 62, 374, | |
96 13533, 4861, 253, 1523, | |
97 12667, 5457, 424, 2552, | |
98 13854, 6106, 590, 3551, | |
99 13031, 6483, 678, 4084, | |
100 13557, 7721, 937, 5639, | |
101 12957, 9311, 1213, 7304, | |
102 13714, 11551, 1532, 9221, | |
103 12591, 15206, 1938, 11667, | |
104 15113, 1540, -1445, -8700, | |
105 15072, 2333, -832, -5007, | |
106 14527, 2511, -723, -4352, | |
107 14692, 3199, -365, -2197, | |
108 15382, 3560, -207, -1247, | |
109 14133, 3960, -50, -300, | |
110 15102, 4236, 50, 298, | |
111 14332, 4824, 242, 1454, | |
112 14846, 5451, 422, 2542, | |
113 15306, 6083, 584, 3518, | |
114 14329, 6888, 768, 4623, | |
115 15060, 7689, 930, 5602, | |
116 14406, 9426, 1231, 7413, | |
117 15387, 9741, 1280, 7706, | |
118 14824, 14271, 1844, 11102, | |
119 13600, 24939, 2669, 16067, | |
120 16396, 1969, -1082, -6517, | |
121 16817, 2832, -545, -3283, | |
122 15713, 2843, -539, -3248, | |
123 16104, 3336, -303, -1825, | |
124 16384, 3963, -49, -294, | |
125 16940, 4579, 165, 992, | |
126 15711, 4599, 171, 1030, | |
127 16222, 5448, 421, 2537, | |
128 16832, 6382, 655, 3945, | |
129 15745, 7141, 821, 4944, | |
130 16326, 7469, 888, 5343, | |
131 16611, 8624, 1100, 6622, | |
132 17028, 10418, 1379, 8303, | |
133 15905, 11817, 1565, 9423, | |
134 16878, 14690, 1887, 11360, | |
135 16515, 20870, 2406, 14483, | |
136 18142, 2083, -999, -6013, | |
137 19401, 3178, -375, -2257, | |
138 17508, 3426, -264, -1589, | |
139 20054, 4027, -25, -151, | |
140 18069, 4249, 54, 326, | |
141 18952, 5066, 314, 1890, | |
142 17711, 5402, 409, 2461, | |
143 19835, 6192, 610, 3676, | |
144 17950, 7014, 795, 4784, | |
145 21318, 7877, 966, 5816, | |
146 17910, 9289, 1210, 7283, | |
147 19144, 9290, 1210, 7284, | |
148 20517, 11381, 1510, 9089, | |
149 18075, 14485, 1866, 11234, | |
150 19999, 17882, 2177, 13108, | |
151 18842, 32764, 3072, 18494 | |
152 }; | |
153 | |
154 /* table used in 'low' rates: MR475, MR515, MR59 */ | |
155 | |
156 const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] = { | |
157 /*g_pit, g_fac, qua_ener_MR122, qua_ener */ | |
158 10813, 28753, 2879, 17333, | |
159 20480, 2785, -570, -3431, | |
160 18841, 6594, 703, 4235, | |
161 6225, 7413, 876, 5276, | |
162 17203, 10444, 1383, 8325, | |
163 21626, 1269, -1731, -10422, | |
164 21135, 4423, 113, 683, | |
165 11304, 1556, -1430, -8609, | |
166 19005, 12820, 1686, 10148, | |
167 17367, 2498, -731, -4398, | |
168 17858, 4833, 244, 1472, | |
169 9994, 2498, -731, -4398, | |
170 17530, 7864, 964, 5802, | |
171 14254, 1884, -1147, -6907, | |
172 15892, 3153, -387, -2327, | |
173 6717, 1802, -1213, -7303, | |
174 18186, 20193, 2357, 14189, | |
175 18022, 3031, -445, -2678, | |
176 16711, 5857, 528, 3181, | |
177 8847, 4014, -30, -180, | |
178 15892, 8970, 1158, 6972, | |
179 18022, 1392, -1594, -9599, | |
180 16711, 4096, 0, 0, | |
181 8192, 655, -2708, -16305, | |
182 15237, 13926, 1808, 10884, | |
183 14254, 3112, -406, -2444, | |
184 14090, 4669, 193, 1165, | |
185 5406, 2703, -614, -3697, | |
186 13434, 6553, 694, 4180, | |
187 12451, 901, -2237, -13468, | |
188 12451, 2662, -637, -3833, | |
189 3768, 655, -2708, -16305, | |
190 14745, 23511, 2582, 15543, | |
191 19169, 2457, -755, -4546, | |
192 20152, 5079, 318, 1913, | |
193 6881, 4096, 0, 0, | |
194 20480, 8560, 1089, 6556, | |
195 19660, 737, -2534, -15255, | |
196 19005, 4259, 58, 347, | |
197 7864, 2088, -995, -5993, | |
198 11468, 12288, 1623, 9771, | |
199 15892, 1474, -1510, -9090, | |
200 15728, 4628, 180, 1086, | |
201 9175, 1433, -1552, -9341, | |
202 16056, 7004, 793, 4772, | |
203 14827, 737, -2534, -15255, | |
204 15073, 2252, -884, -5321, | |
205 5079, 1228, -1780, -10714, | |
206 13271, 17326, 2131, 12827, | |
207 16547, 2334, -831, -5002, | |
208 15073, 5816, 518, 3118, | |
209 3932, 3686, -156, -938, | |
210 14254, 8601, 1096, 6598, | |
211 16875, 778, -2454, -14774, | |
212 15073, 3809, -107, -646, | |
213 6062, 614, -2804, -16879, | |
214 9338, 9256, 1204, 7251, | |
215 13271, 1761, -1247, -7508, | |
216 13271, 3522, -223, -1343, | |
217 2457, 1966, -1084, -6529, | |
218 11468, 5529, 443, 2668, | |
219 10485, 737, -2534, -15255, | |
220 11632, 3194, -367, -2212, | |
221 1474, 778, -2454, -14774 | |
222 }; | |
223 | |
224 /* table that was originally in qgain475.tab */ | |
225 | |
226 /* The table contains the following data: | |
227 * | |
228 * g_pitch(0) (Q14) // for sub- | |
229 * g_fac(0) (Q12) // frame 0 and 2 | |
230 * g_pitch(1) (Q14) // for sub- | |
231 * g_fac(2) (Q12) // frame 1 and 3 | |
232 * | |
233 */ | |
234 const Word16 table_gain_MR475[MR475_VQ_SIZE*4] = { | |
235 /*g_pit(0), g_fac(0), g_pit(1), g_fac(1) */ | |
236 812, 128, 542, 140, | |
237 2873, 1135, 2266, 3402, | |
238 2067, 563, 12677, 647, | |
239 4132, 1798, 5601, 5285, | |
240 7689, 374, 3735, 441, | |
241 10912, 2638, 11807, 2494, | |
242 20490, 797, 5218, 675, | |
243 6724, 8354, 5282, 1696, | |
244 1488, 428, 5882, 452, | |
245 5332, 4072, 3583, 1268, | |
246 2469, 901, 15894, 1005, | |
247 14982, 3271, 10331, 4858, | |
248 3635, 2021, 2596, 835, | |
249 12360, 4892, 12206, 1704, | |
250 13432, 1604, 9118, 2341, | |
251 3968, 1538, 5479, 9936, | |
252 3795, 417, 1359, 414, | |
253 3640, 1569, 7995, 3541, | |
254 11405, 645, 8552, 635, | |
255 4056, 1377, 16608, 6124, | |
256 11420, 700, 2007, 607, | |
257 12415, 1578, 11119, 4654, | |
258 13680, 1708, 11990, 1229, | |
259 7996, 7297, 13231, 5715, | |
260 2428, 1159, 2073, 1941, | |
261 6218, 6121, 3546, 1804, | |
262 8925, 1802, 8679, 1580, | |
263 13935, 3576, 13313, 6237, | |
264 6142, 1130, 5994, 1734, | |
265 14141, 4662, 11271, 3321, | |
266 12226, 1551, 13931, 3015, | |
267 5081, 10464, 9444, 6706, | |
268 1689, 683, 1436, 1306, | |
269 7212, 3933, 4082, 2713, | |
270 7793, 704, 15070, 802, | |
271 6299, 5212, 4337, 5357, | |
272 6676, 541, 6062, 626, | |
273 13651, 3700, 11498, 2408, | |
274 16156, 716, 12177, 751, | |
275 8065, 11489, 6314, 2256, | |
276 4466, 496, 7293, 523, | |
277 10213, 3833, 8394, 3037, | |
278 8403, 966, 14228, 1880, | |
279 8703, 5409, 16395, 4863, | |
280 7420, 1979, 6089, 1230, | |
281 9371, 4398, 14558, 3363, | |
282 13559, 2873, 13163, 1465, | |
283 5534, 1678, 13138, 14771, | |
284 7338, 600, 1318, 548, | |
285 4252, 3539, 10044, 2364, | |
286 10587, 622, 13088, 669, | |
287 14126, 3526, 5039, 9784, | |
288 15338, 619, 3115, 590, | |
289 16442, 3013, 15542, 4168, | |
290 15537, 1611, 15405, 1228, | |
291 16023, 9299, 7534, 4976, | |
292 1990, 1213, 11447, 1157, | |
293 12512, 5519, 9475, 2644, | |
294 7716, 2034, 13280, 2239, | |
295 16011, 5093, 8066, 6761, | |
296 10083, 1413, 5002, 2347, | |
297 12523, 5975, 15126, 2899, | |
298 18264, 2289, 15827, 2527, | |
299 16265, 10254, 14651, 11319, | |
300 1797, 337, 3115, 397, | |
301 3510, 2928, 4592, 2670, | |
302 7519, 628, 11415, 656, | |
303 5946, 2435, 6544, 7367, | |
304 8238, 829, 4000, 863, | |
305 10032, 2492, 16057, 3551, | |
306 18204, 1054, 6103, 1454, | |
307 5884, 7900, 18752, 3468, | |
308 1864, 544, 9198, 683, | |
309 11623, 4160, 4594, 1644, | |
310 3158, 1157, 15953, 2560, | |
311 12349, 3733, 17420, 5260, | |
312 6106, 2004, 2917, 1742, | |
313 16467, 5257, 16787, 1680, | |
314 17205, 1759, 4773, 3231, | |
315 7386, 6035, 14342, 10012, | |
316 4035, 442, 4194, 458, | |
317 9214, 2242, 7427, 4217, | |
318 12860, 801, 11186, 825, | |
319 12648, 2084, 12956, 6554, | |
320 9505, 996, 6629, 985, | |
321 10537, 2502, 15289, 5006, | |
322 12602, 2055, 15484, 1653, | |
323 16194, 6921, 14231, 5790, | |
324 2626, 828, 5615, 1686, | |
325 13663, 5778, 3668, 1554, | |
326 11313, 2633, 9770, 1459, | |
327 14003, 4733, 15897, 6291, | |
328 6278, 1870, 7910, 2285, | |
329 16978, 4571, 16576, 3849, | |
330 15248, 2311, 16023, 3244, | |
331 14459, 17808, 11847, 2763, | |
332 1981, 1407, 1400, 876, | |
333 4335, 3547, 4391, 4210, | |
334 5405, 680, 17461, 781, | |
335 6501, 5118, 8091, 7677, | |
336 7355, 794, 8333, 1182, | |
337 15041, 3160, 14928, 3039, | |
338 20421, 880, 14545, 852, | |
339 12337, 14708, 6904, 1920, | |
340 4225, 933, 8218, 1087, | |
341 10659, 4084, 10082, 4533, | |
342 2735, 840, 20657, 1081, | |
343 16711, 5966, 15873, 4578, | |
344 10871, 2574, 3773, 1166, | |
345 14519, 4044, 20699, 2627, | |
346 15219, 2734, 15274, 2186, | |
347 6257, 3226, 13125, 19480, | |
348 7196, 930, 2462, 1618, | |
349 4515, 3092, 13852, 4277, | |
350 10460, 833, 17339, 810, | |
351 16891, 2289, 15546, 8217, | |
352 13603, 1684, 3197, 1834, | |
353 15948, 2820, 15812, 5327, | |
354 17006, 2438, 16788, 1326, | |
355 15671, 8156, 11726, 8556, | |
356 3762, 2053, 9563, 1317, | |
357 13561, 6790, 12227, 1936, | |
358 8180, 3550, 13287, 1778, | |
359 16299, 6599, 16291, 7758, | |
360 8521, 2551, 7225, 2645, | |
361 18269, 7489, 16885, 2248, | |
362 17882, 2884, 17265, 3328, | |
363 9417, 20162, 11042, 8320, | |
364 1286, 620, 1431, 583, | |
365 5993, 2289, 3978, 3626, | |
366 5144, 752, 13409, 830, | |
367 5553, 2860, 11764, 5908, | |
368 10737, 560, 5446, 564, | |
369 13321, 3008, 11946, 3683, | |
370 19887, 798, 9825, 728, | |
371 13663, 8748, 7391, 3053, | |
372 2515, 778, 6050, 833, | |
373 6469, 5074, 8305, 2463, | |
374 6141, 1865, 15308, 1262, | |
375 14408, 4547, 13663, 4515, | |
376 3137, 2983, 2479, 1259, | |
377 15088, 4647, 15382, 2607, | |
378 14492, 2392, 12462, 2537, | |
379 7539, 2949, 12909, 12060, | |
380 5468, 684, 3141, 722, | |
381 5081, 1274, 12732, 4200, | |
382 15302, 681, 7819, 592, | |
383 6534, 2021, 16478, 8737, | |
384 13364, 882, 5397, 899, | |
385 14656, 2178, 14741, 4227, | |
386 14270, 1298, 13929, 2029, | |
387 15477, 7482, 15815, 4572, | |
388 2521, 2013, 5062, 1804, | |
389 5159, 6582, 7130, 3597, | |
390 10920, 1611, 11729, 1708, | |
391 16903, 3455, 16268, 6640, | |
392 9306, 1007, 9369, 2106, | |
393 19182, 5037, 12441, 4269, | |
394 15919, 1332, 15357, 3512, | |
395 11898, 14141, 16101, 6854, | |
396 2010, 737, 3779, 861, | |
397 11454, 2880, 3564, 3540, | |
398 9057, 1241, 12391, 896, | |
399 8546, 4629, 11561, 5776, | |
400 8129, 589, 8218, 588, | |
401 18728, 3755, 12973, 3149, | |
402 15729, 758, 16634, 754, | |
403 15222, 11138, 15871, 2208, | |
404 4673, 610, 10218, 678, | |
405 15257, 4146, 5729, 3327, | |
406 8377, 1670, 19862, 2321, | |
407 15450, 5511, 14054, 5481, | |
408 5728, 2888, 7580, 1346, | |
409 14384, 5325, 16236, 3950, | |
410 15118, 3744, 15306, 1435, | |
411 14597, 4070, 12301, 15696, | |
412 7617, 1699, 2170, 884, | |
413 4459, 4567, 18094, 3306, | |
414 12742, 815, 14926, 907, | |
415 15016, 4281, 15518, 8368, | |
416 17994, 1087, 2358, 865, | |
417 16281, 3787, 15679, 4596, | |
418 16356, 1534, 16584, 2210, | |
419 16833, 9697, 15929, 4513, | |
420 3277, 1085, 9643, 2187, | |
421 11973, 6068, 9199, 4462, | |
422 8955, 1629, 10289, 3062, | |
423 16481, 5155, 15466, 7066, | |
424 13678, 2543, 5273, 2277, | |
425 16746, 6213, 16655, 3408, | |
426 20304, 3363, 18688, 1985, | |
427 14172, 12867, 15154, 15703, | |
428 4473, 1020, 1681, 886, | |
429 4311, 4301, 8952, 3657, | |
430 5893, 1147, 11647, 1452, | |
431 15886, 2227, 4582, 6644, | |
432 6929, 1205, 6220, 799, | |
433 12415, 3409, 15968, 3877, | |
434 19859, 2109, 9689, 2141, | |
435 14742, 8830, 14480, 2599, | |
436 1817, 1238, 7771, 813, | |
437 19079, 4410, 5554, 2064, | |
438 3687, 2844, 17435, 2256, | |
439 16697, 4486, 16199, 5388, | |
440 8028, 2763, 3405, 2119, | |
441 17426, 5477, 13698, 2786, | |
442 19879, 2720, 9098, 3880, | |
443 18172, 4833, 17336, 12207, | |
444 5116, 996, 4935, 988, | |
445 9888, 3081, 6014, 5371, | |
446 15881, 1667, 8405, 1183, | |
447 15087, 2366, 19777, 7002, | |
448 11963, 1562, 7279, 1128, | |
449 16859, 1532, 15762, 5381, | |
450 14708, 2065, 20105, 2155, | |
451 17158, 8245, 17911, 6318, | |
452 5467, 1504, 4100, 2574, | |
453 17421, 6810, 5673, 2888, | |
454 16636, 3382, 8975, 1831, | |
455 20159, 4737, 19550, 7294, | |
456 6658, 2781, 11472, 3321, | |
457 19397, 5054, 18878, 4722, | |
458 16439, 2373, 20430, 4386, | |
459 11353, 26526, 11593, 3068, | |
460 2866, 1566, 5108, 1070, | |
461 9614, 4915, 4939, 3536, | |
462 7541, 878, 20717, 851, | |
463 6938, 4395, 16799, 7733, | |
464 10137, 1019, 9845, 964, | |
465 15494, 3955, 15459, 3430, | |
466 18863, 982, 20120, 963, | |
467 16876, 12887, 14334, 4200, | |
468 6599, 1220, 9222, 814, | |
469 16942, 5134, 5661, 4898, | |
470 5488, 1798, 20258, 3962, | |
471 17005, 6178, 17929, 5929, | |
472 9365, 3420, 7474, 1971, | |
473 19537, 5177, 19003, 3006, | |
474 16454, 3788, 16070, 2367, | |
475 8664, 2743, 9445, 26358, | |
476 10856, 1287, 3555, 1009, | |
477 5606, 3622, 19453, 5512, | |
478 12453, 797, 20634, 911, | |
479 15427, 3066, 17037, 10275, | |
480 18883, 2633, 3913, 1268, | |
481 19519, 3371, 18052, 5230, | |
482 19291, 1678, 19508, 3172, | |
483 18072, 10754, 16625, 6845, | |
484 3134, 2298, 10869, 2437, | |
485 15580, 6913, 12597, 3381, | |
486 11116, 3297, 16762, 2424, | |
487 18853, 6715, 17171, 9887, | |
488 12743, 2605, 8937, 3140, | |
489 19033, 7764, 18347, 3880, | |
490 20475, 3682, 19602, 3380, | |
491 13044, 19373, 10526, 23124 | |
492 }; |