0
|
1 /*
|
|
2 * mpeg audio layer 2 tables. Most of them come from the mpeg audio
|
|
3 * specification.
|
|
4 *
|
84
|
5 * Copyright (c) 2000, 2001 Gerard Lantau.
|
0
|
6 *
|
|
7 * The licence of this code is contained in file LICENCE found in the
|
|
8 * same archive
|
|
9 */
|
|
10
|
|
11 #define SQRT2 1.41421356237309514547
|
|
12
|
|
13 static const int costab32[30] = {
|
|
14 FIX(0.54119610014619701222),
|
|
15 FIX(1.3065629648763763537),
|
|
16
|
|
17 FIX(0.50979557910415917998),
|
|
18 FIX(2.5629154477415054814),
|
|
19 FIX(0.89997622313641556513),
|
|
20 FIX(0.60134488693504528634),
|
|
21
|
|
22 FIX(0.5024192861881556782),
|
|
23 FIX(5.1011486186891552563),
|
|
24 FIX(0.78815462345125020249),
|
|
25 FIX(0.64682178335999007679),
|
|
26 FIX(0.56694403481635768927),
|
|
27 FIX(1.0606776859903470633),
|
|
28 FIX(1.7224470982383341955),
|
|
29 FIX(0.52249861493968885462),
|
|
30
|
|
31 FIX(10.19000812354803287),
|
|
32 FIX(0.674808341455005678),
|
|
33 FIX(1.1694399334328846596),
|
|
34 FIX(0.53104259108978413284),
|
|
35 FIX(2.0577810099534108446),
|
|
36 FIX(0.58293496820613388554),
|
|
37 FIX(0.83934964541552681272),
|
|
38 FIX(0.50547095989754364798),
|
|
39 FIX(3.4076084184687189804),
|
|
40 FIX(0.62250412303566482475),
|
|
41 FIX(0.97256823786196078263),
|
|
42 FIX(0.51544730992262455249),
|
|
43 FIX(1.4841646163141661852),
|
|
44 FIX(0.5531038960344445421),
|
|
45 FIX(0.74453627100229857749),
|
|
46 FIX(0.5006029982351962726),
|
|
47 };
|
|
48
|
|
49 static const int bitinv32[32] = {
|
|
50 0, 16, 8, 24, 4, 20, 12, 28,
|
|
51 2, 18, 10, 26, 6, 22, 14, 30,
|
|
52 1, 17, 9, 25, 5, 21, 13, 29,
|
|
53 3, 19, 11, 27, 7, 23, 15, 31
|
|
54 };
|
|
55
|
|
56
|
84
|
57 static INT16 filter_bank[512];
|
0
|
58
|
|
59 static int scale_factor_table[64];
|
|
60 #ifdef USE_FLOATS
|
|
61 static float scale_factor_inv_table[64];
|
|
62 #else
|
|
63 static INT8 scale_factor_shift[64];
|
|
64 static unsigned short scale_factor_mult[64];
|
|
65 #endif
|
|
66 static unsigned char scale_diff_table[128];
|
|
67
|
84
|
68 /* total number of bits per allocation group */
|
|
69 static unsigned short total_quant_bits[17];
|
0
|
70
|
|
71 /* signal to noise ratio of each quantification step (could be
|
|
72 computed from quant_steps[]). The values are dB multiplied by 10
|
|
73 */
|
|
74 static unsigned short quant_snr[17] = {
|
|
75 70, 110, 160, 208,
|
|
76 253, 316, 378, 439,
|
|
77 499, 559, 620, 680,
|
|
78 740, 800, 861, 920,
|
|
79 980
|
|
80 };
|
|
81
|
|
82 /* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
|
|
83 project */
|
84
|
84 static const float fixed_smr[SBLIMIT] = {
|
0
|
85 30, 17, 16, 10, 3, 12, 8, 2.5,
|
|
86 5, 5, 6, 6, 5, 6, 10, 6,
|
|
87 -4, -10, -21, -30, -42, -55, -68, -75,
|
|
88 -75, -75, -75, -75, -91, -107, -110, -108
|
|
89 };
|
|
90
|
84
|
91 static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 };
|
|
92
|