annotate mpegaudiotab.h @ 0:986e461dc072 libavcodec

Initial revision
author glantau
date Sun, 22 Jul 2001 14:18:56 +0000
parents
children 608c7f964bca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * mpeg audio layer 2 tables. Most of them come from the mpeg audio
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 * specification.
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 * Copyright (c) 2000 Gerard Lantau.
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 * The licence of this code is contained in file LICENCE found in the
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * same archive
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
10
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 static const unsigned short bitrate_tab[2][15] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}, /* mpeg2 lsf */
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}, /* mpeg1 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
15
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 static const unsigned short freq_tab[3] = { 44100, 48000, 32000 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
17
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 #define SQRT2 1.41421356237309514547
986e461dc072 Initial revision
glantau
parents:
diff changeset
19
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 static const int costab32[30] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 FIX(0.54119610014619701222),
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 FIX(1.3065629648763763537),
986e461dc072 Initial revision
glantau
parents:
diff changeset
23
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 FIX(0.50979557910415917998),
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 FIX(2.5629154477415054814),
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 FIX(0.89997622313641556513),
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 FIX(0.60134488693504528634),
986e461dc072 Initial revision
glantau
parents:
diff changeset
28
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 FIX(0.5024192861881556782),
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 FIX(5.1011486186891552563),
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 FIX(0.78815462345125020249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 FIX(0.64682178335999007679),
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 FIX(0.56694403481635768927),
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 FIX(1.0606776859903470633),
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 FIX(1.7224470982383341955),
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 FIX(0.52249861493968885462),
986e461dc072 Initial revision
glantau
parents:
diff changeset
37
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 FIX(10.19000812354803287),
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 FIX(0.674808341455005678),
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 FIX(1.1694399334328846596),
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 FIX(0.53104259108978413284),
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 FIX(2.0577810099534108446),
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 FIX(0.58293496820613388554),
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 FIX(0.83934964541552681272),
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 FIX(0.50547095989754364798),
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 FIX(3.4076084184687189804),
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 FIX(0.62250412303566482475),
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 FIX(0.97256823786196078263),
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 FIX(0.51544730992262455249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 FIX(1.4841646163141661852),
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 FIX(0.5531038960344445421),
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 FIX(0.74453627100229857749),
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 FIX(0.5006029982351962726),
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
55
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 static const int bitinv32[32] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 0, 16, 8, 24, 4, 20, 12, 28,
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 2, 18, 10, 26, 6, 22, 14, 30,
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 1, 17, 9, 25, 5, 21, 13, 29,
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 3, 19, 11, 27, 7, 23, 15, 31
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
62
986e461dc072 Initial revision
glantau
parents:
diff changeset
63
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 static short filter_bank[512];
986e461dc072 Initial revision
glantau
parents:
diff changeset
65
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 static const double enwindow[512] = {0.000000000,
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 -0.000000477, -0.000000477, -0.000000477, -0.000000477, -0.000000477, -0.000000477, -0.000000954, -0.000000954,
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 -0.000000954, -0.000000954, -0.000001431, -0.000001431, -0.000001907, -0.000001907, -0.000002384, -0.000002384,
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 -0.000002861, -0.000003338, -0.000003338, -0.000003815, -0.000004292, -0.000004768, -0.000005245, -0.000006199,
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 -0.000006676, -0.000007629, -0.000008106, -0.000009060, -0.000010014, -0.000011444, -0.000012398, -0.000013828,
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 -0.000014782, -0.000016689, -0.000018120, -0.000019550, -0.000021458, -0.000023365, -0.000025272, -0.000027657,
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 -0.000030041, -0.000032425, -0.000034809, -0.000037670, -0.000040531, -0.000043392, -0.000046253, -0.000049591,
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 -0.000052929, -0.000055790, -0.000059605, -0.000062943, -0.000066280, -0.000070095, -0.000073433, -0.000076771,
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 -0.000080585, -0.000083923, -0.000087261, -0.000090599, -0.000093460, -0.000096321, -0.000099182, 0.000101566,
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 0.000103951, 0.000105858, 0.000107288, 0.000108242, 0.000108719, 0.000108719, 0.000108242, 0.000106812,
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 0.000105381, 0.000102520, 0.000099182, 0.000095367, 0.000090122, 0.000084400, 0.000077724, 0.000069618,
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 0.000060558, 0.000050545, 0.000039577, 0.000027180, 0.000013828, -0.000000954, -0.000017166, -0.000034332,
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 -0.000052929, -0.000072956, -0.000093937, -0.000116348, -0.000140190, -0.000165462, -0.000191212, -0.000218868,
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 -0.000247478, -0.000277042, -0.000307560, -0.000339031, -0.000371456, -0.000404358, -0.000438213, -0.000472546,
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 -0.000507355, -0.000542164, -0.000576973, -0.000611782, -0.000646591, -0.000680923, -0.000714302, -0.000747204,
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 -0.000779152, -0.000809669, -0.000838757, -0.000866413, -0.000891685, -0.000915051, -0.000935555, -0.000954151,
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 -0.000968933, -0.000980854, -0.000989437, -0.000994205, -0.000995159, -0.000991821, -0.000983715, 0.000971317,
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 0.000953674, 0.000930786, 0.000902653, 0.000868797, 0.000829220, 0.000783920, 0.000731945, 0.000674248,
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 0.000610352, 0.000539303, 0.000462532, 0.000378609, 0.000288486, 0.000191689, 0.000088215, -0.000021458,
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 -0.000137329, -0.000259876, -0.000388145, -0.000522137, -0.000661850, -0.000806808, -0.000956535, -0.001111031,
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 -0.001269817, -0.001432419, -0.001597881, -0.001766682, -0.001937389, -0.002110004, -0.002283096, -0.002457142,
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 -0.002630711, -0.002803326, -0.002974033, -0.003141880, -0.003306866, -0.003467083, -0.003622532, -0.003771782,
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 -0.003914356, -0.004048824, -0.004174709, -0.004290581, -0.004395962, -0.004489899, -0.004570484, -0.004638195,
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 -0.004691124, -0.004728317, -0.004748821, -0.004752159, -0.004737377, -0.004703045, -0.004649162, -0.004573822,
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 -0.004477024, -0.004357815, -0.004215240, -0.004049301, -0.003858566, -0.003643036, -0.003401756, 0.003134727,
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 0.002841473, 0.002521515, 0.002174854, 0.001800537, 0.001399517, 0.000971317, 0.000515938, 0.000033379,
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 -0.000475883, -0.001011848, -0.001573563, -0.002161503, -0.002774239, -0.003411293, -0.004072189, -0.004756451,
986e461dc072 Initial revision
glantau
parents:
diff changeset
93 -0.005462170, -0.006189346, -0.006937027, -0.007703304, -0.008487225, -0.009287834, -0.010103703, -0.010933399,
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 -0.011775017, -0.012627602, -0.013489246, -0.014358521, -0.015233517, -0.016112804, -0.016994476, -0.017876148,
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 -0.018756866, -0.019634247, -0.020506859, -0.021372318, -0.022228718, -0.023074150, -0.023907185, -0.024725437,
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 -0.025527000, -0.026310921, -0.027073860, -0.027815342, -0.028532982, -0.029224873, -0.029890060, -0.030526638,
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 -0.031132698, -0.031706810, -0.032248020, -0.032754898, -0.033225536, -0.033659935, -0.034055710, -0.034412861,
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 -0.034730434, -0.035007000, -0.035242081, -0.035435200, -0.035586357, -0.035694122, -0.035758972, 0.035780907,
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 0.035758972, 0.035694122, 0.035586357, 0.035435200, 0.035242081, 0.035007000, 0.034730434, 0.034412861,
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 0.034055710, 0.033659935, 0.033225536, 0.032754898, 0.032248020, 0.031706810, 0.031132698, 0.030526638,
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 0.029890060, 0.029224873, 0.028532982, 0.027815342, 0.027073860, 0.026310921, 0.025527000, 0.024725437,
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 0.023907185, 0.023074150, 0.022228718, 0.021372318, 0.020506859, 0.019634247, 0.018756866, 0.017876148,
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 0.016994476, 0.016112804, 0.015233517, 0.014358521, 0.013489246, 0.012627602, 0.011775017, 0.010933399,
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 0.010103703, 0.009287834, 0.008487225, 0.007703304, 0.006937027, 0.006189346, 0.005462170, 0.004756451,
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 0.004072189, 0.003411293, 0.002774239, 0.002161503, 0.001573563, 0.001011848, 0.000475883, -0.000033379,
986e461dc072 Initial revision
glantau
parents:
diff changeset
106 -0.000515938, -0.000971317, -0.001399517, -0.001800537, -0.002174854, -0.002521515, -0.002841473, 0.003134727,
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 0.003401756, 0.003643036, 0.003858566, 0.004049301, 0.004215240, 0.004357815, 0.004477024, 0.004573822,
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 0.004649162, 0.004703045, 0.004737377, 0.004752159, 0.004748821, 0.004728317, 0.004691124, 0.004638195,
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 0.004570484, 0.004489899, 0.004395962, 0.004290581, 0.004174709, 0.004048824, 0.003914356, 0.003771782,
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 0.003622532, 0.003467083, 0.003306866, 0.003141880, 0.002974033, 0.002803326, 0.002630711, 0.002457142,
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 0.002283096, 0.002110004, 0.001937389, 0.001766682, 0.001597881, 0.001432419, 0.001269817, 0.001111031,
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 0.000956535, 0.000806808, 0.000661850, 0.000522137, 0.000388145, 0.000259876, 0.000137329, 0.000021458,
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 -0.000088215, -0.000191689, -0.000288486, -0.000378609, -0.000462532, -0.000539303, -0.000610352, -0.000674248,
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 -0.000731945, -0.000783920, -0.000829220, -0.000868797, -0.000902653, -0.000930786, -0.000953674, 0.000971317,
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 0.000983715, 0.000991821, 0.000995159, 0.000994205, 0.000989437, 0.000980854, 0.000968933, 0.000954151,
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 0.000935555, 0.000915051, 0.000891685, 0.000866413, 0.000838757, 0.000809669, 0.000779152, 0.000747204,
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 0.000714302, 0.000680923, 0.000646591, 0.000611782, 0.000576973, 0.000542164, 0.000507355, 0.000472546,
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 0.000438213, 0.000404358, 0.000371456, 0.000339031, 0.000307560, 0.000277042, 0.000247478, 0.000218868,
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 0.000191212, 0.000165462, 0.000140190, 0.000116348, 0.000093937, 0.000072956, 0.000052929, 0.000034332,
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 0.000017166, 0.000000954, -0.000013828, -0.000027180, -0.000039577, -0.000050545, -0.000060558, -0.000069618,
986e461dc072 Initial revision
glantau
parents:
diff changeset
121 -0.000077724, -0.000084400, -0.000090122, -0.000095367, -0.000099182, -0.000102520, -0.000105381, -0.000106812,
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 -0.000108242, -0.000108719, -0.000108719, -0.000108242, -0.000107288, -0.000105858, -0.000103951, 0.000101566,
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 0.000099182, 0.000096321, 0.000093460, 0.000090599, 0.000087261, 0.000083923, 0.000080585, 0.000076771,
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 0.000073433, 0.000070095, 0.000066280, 0.000062943, 0.000059605, 0.000055790, 0.000052929, 0.000049591,
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 0.000046253, 0.000043392, 0.000040531, 0.000037670, 0.000034809, 0.000032425, 0.000030041, 0.000027657,
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 0.000025272, 0.000023365, 0.000021458, 0.000019550, 0.000018120, 0.000016689, 0.000014782, 0.000013828,
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 0.000012398, 0.000011444, 0.000010014, 0.000009060, 0.000008106, 0.000007629, 0.000006676, 0.000006199,
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 0.000005245, 0.000004768, 0.000004292, 0.000003815, 0.000003338, 0.000003338, 0.000002861, 0.000002384,
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 0.000002384, 0.000001907, 0.000001907, 0.000001431, 0.000001431, 0.000000954, 0.000000954, 0.000000954,
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 0.000000954, 0.000000477, 0.000000477, 0.000000477, 0.000000477, 0.000000477, 0.000000477
986e461dc072 Initial revision
glantau
parents:
diff changeset
131 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
132
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 static int scale_factor_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
134 #ifdef USE_FLOATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 static float scale_factor_inv_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 #else
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 static INT8 scale_factor_shift[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 static unsigned short scale_factor_mult[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
140 static unsigned char scale_diff_table[128];
986e461dc072 Initial revision
glantau
parents:
diff changeset
141
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 static const int sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
143
986e461dc072 Initial revision
glantau
parents:
diff changeset
144 static const int quant_steps[17] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
145 3, 5, 7, 9, 15,
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 31, 63, 127, 255, 511,
986e461dc072 Initial revision
glantau
parents:
diff changeset
147 1023, 2047, 4095, 8191, 16383,
986e461dc072 Initial revision
glantau
parents:
diff changeset
148 32767, 65535
986e461dc072 Initial revision
glantau
parents:
diff changeset
149 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
150
986e461dc072 Initial revision
glantau
parents:
diff changeset
151 /* we use a negative value if grouped */
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 static const int quant_bits[17] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
153 -5, -7, 3, -10, 4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 5, 6, 7, 8, 9,
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 10, 11, 12, 13, 14,
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 15, 16
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
158
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 /* signal to noise ratio of each quantification step (could be
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 computed from quant_steps[]). The values are dB multiplied by 10
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 static unsigned short quant_snr[17] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 70, 110, 160, 208,
986e461dc072 Initial revision
glantau
parents:
diff changeset
164 253, 316, 378, 439,
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 499, 559, 620, 680,
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 740, 800, 861, 920,
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 980
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
169
986e461dc072 Initial revision
glantau
parents:
diff changeset
170
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 /* total number of bits per allocation group */
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 static unsigned short total_quant_bits[17];
986e461dc072 Initial revision
glantau
parents:
diff changeset
173
986e461dc072 Initial revision
glantau
parents:
diff changeset
174 /* encoding tables which give the quantization index. Note how it is
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 possible to store them efficiently ! */
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 static const unsigned char alloc_table_0[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
178 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
182 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
185 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
186 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
187 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
193 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
197 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
203 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
204 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
205
986e461dc072 Initial revision
glantau
parents:
diff changeset
206 static const unsigned char alloc_table_1[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
207 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
208 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
209 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
210 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
211 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
212 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
214 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
215 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
216 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
217 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
219 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 3, 0, 1, 2, 3, 4, 5, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
231 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
232 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
233 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
235 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 2, 0, 1, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
238
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 static const unsigned char alloc_table_2[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
986e461dc072 Initial revision
glantau
parents:
diff changeset
241 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
243 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
245 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
249
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 static const unsigned char alloc_table_3[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
255 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
257 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
258 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
261 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
262 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
264
986e461dc072 Initial revision
glantau
parents:
diff changeset
265 static const unsigned char alloc_table_4[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
986e461dc072 Initial revision
glantau
parents:
diff changeset
267 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
986e461dc072 Initial revision
glantau
parents:
diff changeset
268 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
986e461dc072 Initial revision
glantau
parents:
diff changeset
269 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
276 3, 0, 1, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
277 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
279 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
280 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
281 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
282 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
283 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
284 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
285 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
286 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
287 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
288 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
289 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
290 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
291 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
292 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
293 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 2, 0, 1, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
296 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
297
986e461dc072 Initial revision
glantau
parents:
diff changeset
298 const unsigned char *alloc_tables[5] =
986e461dc072 Initial revision
glantau
parents:
diff changeset
299 { alloc_table_0, alloc_table_1, alloc_table_2, alloc_table_3, alloc_table_4, };
986e461dc072 Initial revision
glantau
parents:
diff changeset
300
986e461dc072 Initial revision
glantau
parents:
diff changeset
301 /* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
986e461dc072 Initial revision
glantau
parents:
diff changeset
302 project */
986e461dc072 Initial revision
glantau
parents:
diff changeset
303 const float fixed_smr[SBLIMIT] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 30, 17, 16, 10, 3, 12, 8, 2.5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
305 5, 5, 6, 6, 5, 6, 10, 6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 -4, -10, -21, -30, -42, -55, -68, -75,
986e461dc072 Initial revision
glantau
parents:
diff changeset
307 -75, -75, -75, -75, -91, -107, -110, -108
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
309
986e461dc072 Initial revision
glantau
parents:
diff changeset
310 const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 };