1 /*
2   This file is derived from
3 
4   amp MPEG audio decoder (version 0.7.3)
5   (C) Tomislav Uzelac  1996,1997
6 
7 This software can be used freely for any purpose. It can be distributed
8 freely, as long as it is not sold commercially without permission from
9 Tomislav Uzelac <tuzelac@rasip.fer.hr>. However, including this software
10 on CD_ROMs containing other free software is explicitly permitted even
11 when a modest distribution fee is charged for the CD, as long as this
12 software is not a primary selling argument for the CD.
13 
14 Building derived versions of this software is permitted, as long as they
15 are not sold commercially without permission from Tomislav Uzelac
16 <tuzelac@rasip.fer.hr>. Any derived versions must be clearly marked as
17 such, and must be called by a name other than amp. Any derived versions
18 must retain this copyright notice.
19 */
20 
21 /* buffer for the 'bit reservoir'
22 */
23 #define BUFFER_SIZE     4096
24 #define BUFFER_AUX      2048
25 
26 typedef struct mp3Info {
27   unsigned int headerInt;
28   int gotHeader;
29   int bytesPerFrame;
30   int id;
31   int fullID;
32   int cnt;
33   char rest[18][32][8][4];
34   int restlen;
35   int ind;
36   int bufind;
37   unsigned char buffer[BUFFER_SIZE+BUFFER_AUX];
38   int append;
39   int data;
40   float u[2][2][32][16];
41   int u_start[2];
42   int u_div[2];
43   int bitrate;
44   unsigned char lastByte;
45   unsigned char sr_index;
46 
47   int nch;
48   int scalefac_l[2][2][22];
49   int scalefac_s[2][2][13][3];
50 
51   int is[2][578];
52   float xr[2][32][18];
53   int *t_l,*t_s;
54   int non_zero[2]; /* this is 2*bigvalues+4*count1, i guess...*/
55   int is_max[21]; /* the maximum value of is_pos. for short blocks is_max[sfb=0] == is_max[6],
56                    * it's sloppy but i'm sick of waisting storage. blaah...
57                    */
58   int intensity_scale;
59 
60   float stereo_samples[18][32][2];
61   float mono_samples[18][32];
62   float s[2][32][18];
63   float res[32][18];
64   /* append, data, buffer handled by swapping values */
65 
66 } mp3Info;
67 
68 /* "audio.h" */
69 
70 struct AUDIO_HEADER {
71         int ID;
72         int fullID;
73         int layer;
74         int protection_bit;
75         int bitrate_index;
76         int sampling_frequency;
77         int padding_bit;
78         int private_bit;
79         int mode;
80         int mode_extension;
81         int copyright;
82         int original;
83         int emphasis;
84 };
85 
86 struct SIDE_INFO {
87         int main_data_begin;
88         int scfsi[2][4];
89         int part2_3_length[2][2];
90         int big_values[2][2];
91         int global_gain[2][2];
92         int scalefac_compress[2][2];
93         int window_switching_flag[2][2];
94         int block_type[2][2];
95         int mixed_block_flag[2][2];
96         int table_select[2][2][3];
97         int subblock_gain[2][2][3];
98         int region0_count[2][2];
99         int region1_count[2][2];
100         int preflag[2][2];
101         int scalefac_scale[2][2];
102         int count1table_select[2][2];
103         int error[2];
104 };
105 
106 /*
107  * These three are changed as we access a specific sound
108 */
109 unsigned char *gblBuffer;
110 int gblAppend;
111 int gblData;
112 /* end move to local */
113 
114 /* win is pre loaded with window data, read-only*/
115 float win[4][36];
116 /*
117 int t_sampling_frequency[2][3] = {
118    { 22050 , 24000 , 16000},
119    { 44100 , 48000 , 32000}
120 };
121 
122 */
123 /* id=row,sr_index=element*/
124 int t_sampling_frequency[4][3] = {
125 { 11025 , 12000 , 8000},  /* 0=v2.5*/
126 { 0,0,0},                 /*1=invalid*/
127 { 22050 , 24000 , 16000}, /*2=v2*/
128 { 44100 , 48000 , 32000}, /*3=v1 */
129 };
130 #if 0
131 int SHOW_HEADER,SHOW_HEADER_DETAIL;
132 int SHOW_SIDE_INFO,SHOW_SIDE_INFO_DETAIL;
133 int SHOW_MDB,SHOW_MDB_DETAIL;
134 int SHOW_HUFFMAN_ERRORS,SHOW_HUFFBITS;
135 int SHOW_SCFSI,SHOW_BLOCK_TYPE,SHOW_TABLES,SHOW_BITRATE;
136 int A_QUIET,A_SHOW_CNT,A_FORMAT_WAVE,A_DUMP_BINARY, A_OSCI;
137 int A_WRITE_TO_FILE;
138 int A_AUDIO_PLAY;
139 int A_SET_VOLUME, A_SHOW_TIME;
140 int A_MSG_STDOUT;
141 #endif
142 int sr_lookup[2] = {72000, 144000};
143 short t_bitrate[2][3][15] = {{
144 {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256},
145 {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160},
146 {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
147 },{
148 {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448},
149 {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384},
150 {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}
151 }};
152 
153 /* the last sfb is given implicitly on pg.28. of the standard. scalefactors
154  * for that one are 0, pretab also
155  */
156 /* leftmost index denotes ID, so first three tables are for MPEG2 (header->ID==0)
157  * and the other three are for MPEG1 (header->ID==1)
158  */
159 /* 22.05, 24, 16 */
160 int t_b8_l[2][3][22]={{ /* table B.8b ISO/IEC 11172-3 */
161 {5,11,17,23,29,35,43,53,65,79,95,115,139,167,199,237,283,335,395,463,521,575},
162 {5,11,17,23,29,35,43,53,65,79,95,113,135,161,193,231,277,331,393,463,539,575},
163 {5,11,17,23,29,35,43,53,65,79,95,115,139,167,199,237,283,335,395,463,521,575}
164 },{
165 {3,7,11,15,19,23,29,35,43,51,61,73,89,109,133,161,195,237,287,341,417,575},
166 {3,7,11,15,19,23,29,35,41,49,59,71,87,105,127,155,189,229,275,329,383,575},
167 {3,7,11,15,19,23,29,35,43,53,65,81,101,125,155,193,239,295,363,447,549,575}
168 }};
169 int t_b8_s[2][3][13]={{ /* table B.8b ISO/IEC 11172-3 */
170 {3,7,11,17,23,31,41,55,73,99,131,173,191},
171 {3,7,11,17,25,35,47,61,79,103,135,179,191},
172 {3,7,11,17,25,35,47,61,79,103,133,173,191}
173 },{
174 {3,7,11,15,21,29,39,51,65,83,105,135,191},
175 {3,7,11,15,21,27,37,49,63,79,99,125,191},
176 {3,7,11,15,21,29,41,57,77,103,137,179,191}
177 }};
178 
179 /* "getbits.h" */
180 
181 /* gethdr() error codes: NS == not supported
182 */
183 #define GETHDR_ERR 1
184 #define GETHDR_NS  2
185 
186 
187 /* internal buffer, _bptr holds the position in _bits_
188 */
189 static unsigned char _buffer[32];
190 static int _bptr;
191 
192 static unsigned int _getbits(int n);
193 static int _fillbfr(int size);
194 static void getinfo(struct AUDIO_HEADER *header,struct SIDE_INFO *info);
195 static int gethdr(struct AUDIO_HEADER *header);
196 static void getcrc();
197 static int fillbfr(int advance);
198 static unsigned int viewbits(int n);
199 static void sackbits(int n);
200 static unsigned int getbits(int n);
201 
202 /* getdata.h */
203 
204 static char t_slen1[16]={0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4};
205 static char t_slen2[16]={0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3};
206 static int t_linbits[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,6,8,10,13,4,5,6,7,8,9,11,13};
207 
208 static  int _qsign(int x,int *q);
209 static int decode_scalefactors(mp3Info *ext, struct SIDE_INFO *info,struct AUDIO_HEADER *header,int gr,int ch);
210 static int decode_huffman_data(mp3Info *ext, struct SIDE_INFO *info,int gr,int ch,int ssize);
211 void calculate_t43(void);
212 
213 /* my implementation of MPEG2 scalefactor decoding is, admitably, horrible
214  * anyway, just take a look at pg.18 of MPEG2 specs, and you'll know what
215  * this is all about
216  */
217 static const char spooky_table[2][3][3][4]={
218 {
219 { {6,5,5,5},   {9,9,9,9},   {6,9,9,9} },
220 { {6,5,7,3},   {9,9,12,6},  {6,9,12,6}},
221 { {11,10,0,0}, {18,18,0,0}, {15,18,0,0}}
222 },
223 {
224 { {7,7,7,0},   {12,12,12,0}, {6,15,12,0}},
225 { {6,6,6,3},   {12,9,9,6},   {6,12,9,6}},
226 { {8,8,5,0},   {15,12,9,0},  {6,18,9,0}}
227 }};
228 
229 /* misc2.h */
230 
231 #define i_sq2   0.707106781188
232 #define IS_ILLEGAL 0xfeed
233 
234 static void requantize_mono(mp3Info *ext, int gr,int ch,struct SIDE_INFO *info,struct AUDIO_HEADER *header);
235 static void requantize_ms(mp3Info *ext, int gr,struct SIDE_INFO *info,struct AUDIO_HEADER *header);
236 static void alias_reduction(mp3Info *ext, int ch);
237 
238 static  float fras_l(int sfb,int global_gain,int scalefac_scale,int scalefac,int preflag);
239 static  float fras_s(int global_gain,int subblock_gain,int scalefac_scale,int scalefac);
240 /*static  float fras2(int is,float a);*/
241 static int find_isbound(mp3Info *ext, int isbound[3],int gr,struct SIDE_INFO *info,struct AUDIO_HEADER *header);
242 static  void stereo_s(mp3Info *ext, int l,float a[2],int pos,int ms_flag,int is_pos,struct AUDIO_HEADER *header);
243 static  void stereo_l(mp3Info *ext, int l,float a[2],int ms_flag,int is_pos,struct AUDIO_HEADER *header);
244 static int hasSync (unsigned char *buf);
245 static int locateNextFrame (unsigned char *tmp);
246 int no_of_imdcts[2];
247 
248 static const int t_pretab[22]={0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
249 static const float t_is[7]={ 1.0f, 0.788675134596f, 0.633974596215f,
250                  0.5f, 0.366025403784f, 0.211324865405f, 0.0f};
251 static const float t_is2[2][32]={
252 {             1.0f,       0.840896f,       0.707107f,       0.594604f,            0.5f,       0.420448f,
253        0.353553f,       0.297302f,           0.25f,       0.210224f,       0.176777f,       0.148651f,
254           0.125f,       0.105112f,      0.0883883f,      0.0743254f},
255 {             1.0f,       0.707107f,            0.5f,       0.353553f,           0.25f,       0.176777f,
256           0.125f,      0.0883883f,         0.0625f,      0.0441942f,        0.03125f,      0.0220971f,
257        0.015625f,      0.0110485f,      0.0078125f,     0.00552427f}
258 };
259 static const float Cs[8]={0.857492925712f, 0.881741997318f, 0.949628649103f,
260               0.983314592492f, 0.995517816065f, 0.999160558175f,
261               0.999899195243f, 0.999993155067f};
262 static const float Ca[8]={-0.5144957554270f, -0.4717319685650f, -0.3133774542040f,
263               -0.1819131996110f, -0.0945741925262f, -0.0409655828852f,
264               -0.0141985685725f,        -0.00369997467375f};
265 static const float tab[4]={1.f,1.189207115f,1.414213562f,1.6817928301f};
266 static const float tabi[4]={1.f,0.840896415f,0.707106781f,0.594603557f};
267 
268 /* leftmost index denotes header->ID, so first three are for MPEG2
269  * and the others are for MPEG1
270  */
271 static const short t_reorder[2][3][576]={{
272 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
273   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
274   40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
275   60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  90,  91,
276   78,  79,  80,  81,  82,  83,  96,  97,  84,  85,  86,  87,  88,  89, 102, 103,  92,  93,  94,  95,
277  108, 109, 110, 111, 112, 113,  98,  99, 100, 101, 114, 115, 116, 117, 118, 119, 104, 105, 106, 107,
278  120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 144, 145, 146, 147, 148, 149, 162, 163,
279  132, 133, 134, 135, 136, 137, 150, 151, 152, 153, 154, 155, 168, 169, 138, 139, 140, 141, 142, 143,
280  156, 157, 158, 159, 160, 161, 174, 175, 164, 165, 166, 167, 180, 181, 182, 183, 184, 185, 198, 199,
281  200, 201, 202, 203, 216, 217, 170, 171, 172, 173, 186, 187, 188, 189, 190, 191, 204, 205, 206, 207,
282  208, 209, 222, 223, 176, 177, 178, 179, 192, 193, 194, 195, 196, 197, 210, 211, 212, 213, 214, 215,
283  228, 229, 218, 219, 220, 221, 234, 235, 236, 237, 238, 239, 252, 253, 254, 255, 256, 257, 270, 271,
284  272, 273, 274, 275, 288, 289, 290, 291, 224, 225, 226, 227, 240, 241, 242, 243, 244, 245, 258, 259,
285  260, 261, 262, 263, 276, 277, 278, 279, 280, 281, 294, 295, 296, 297, 230, 231, 232, 233, 246, 247,
286  248, 249, 250, 251, 264, 265, 266, 267, 268, 269, 282, 283, 284, 285, 286, 287, 300, 301, 302, 303,
287  292, 293, 306, 307, 308, 309, 310, 311, 324, 325, 326, 327, 328, 329, 342, 343, 344, 345, 346, 347,
288  360, 361, 362, 363, 364, 365, 378, 379, 380, 381, 382, 383, 298, 299, 312, 313, 314, 315, 316, 317,
289  330, 331, 332, 333, 334, 335, 348, 349, 350, 351, 352, 353, 366, 367, 368, 369, 370, 371, 384, 385,
290  386, 387, 388, 389, 304, 305, 318, 319, 320, 321, 322, 323, 336, 337, 338, 339, 340, 341, 354, 355,
291  356, 357, 358, 359, 372, 373, 374, 375, 376, 377, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
292  400, 401, 414, 415, 416, 417, 418, 419, 432, 433, 434, 435, 436, 437, 450, 451, 452, 453, 454, 455,
293  468, 469, 470, 471, 472, 473, 486, 487, 488, 489, 490, 491, 504, 505, 506, 507, 508, 509, 402, 403,
294  404, 405, 406, 407, 420, 421, 422, 423, 424, 425, 438, 439, 440, 441, 442, 443, 456, 457, 458, 459,
295  460, 461, 474, 475, 476, 477, 478, 479, 492, 493, 494, 495, 496, 497, 510, 511, 512, 513, 514, 515,
296  408, 409, 410, 411, 412, 413, 426, 427, 428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463,
297  464, 465, 466, 467, 480, 481, 482, 483, 484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519,
298  520, 521, 522, 523, 524, 525, 526, 527, 540, 541, 542, 543, 544, 545, 558, 559, 560, 561, 562, 563,
299  528, 529, 530, 531, 532, 533, 546, 547, 548, 549, 550, 551, 564, 565, 566, 567, 568, 569, 534, 535,
300  536, 537, 538, 539, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575},
301 
302 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
303   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
304   40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
305   72,  73,  60,  61,  62,  63,  64,  65,  78,  79,  66,  67,  68,  69,  70,  71,  84,  85,  74,  75,
306   76,  77,  90,  91,  92,  93,  94,  95,  80,  81,  82,  83,  96,  97,  98,  99, 100, 101,  86,  87,
307   88,  89, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 126, 127, 128, 129, 130, 131,
308  114, 115, 116, 117, 118, 119, 132, 133, 134, 135, 136, 137, 120, 121, 122, 123, 124, 125, 138, 139,
309  140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 162, 163, 164, 165, 166, 167, 180, 181, 150, 151,
310  152, 153, 154, 155, 168, 169, 170, 171, 172, 173, 186, 187, 156, 157, 158, 159, 160, 161, 174, 175,
311  176, 177, 178, 179, 192, 193, 182, 183, 184, 185, 198, 199, 200, 201, 202, 203, 216, 217, 218, 219,
312  220, 221, 234, 235, 188, 189, 190, 191, 204, 205, 206, 207, 208, 209, 222, 223, 224, 225, 226, 227,
313  240, 241, 194, 195, 196, 197, 210, 211, 212, 213, 214, 215, 228, 229, 230, 231, 232, 233, 246, 247,
314  236, 237, 238, 239, 252, 253, 254, 255, 256, 257, 270, 271, 272, 273, 274, 275, 288, 289, 290, 291,
315  292, 293, 306, 307, 242, 243, 244, 245, 258, 259, 260, 261, 262, 263, 276, 277, 278, 279, 280, 281,
316  294, 295, 296, 297, 298, 299, 312, 313, 248, 249, 250, 251, 264, 265, 266, 267, 268, 269, 282, 283,
317  284, 285, 286, 287, 300, 301, 302, 303, 304, 305, 318, 319, 308, 309, 310, 311, 324, 325, 326, 327,
318  328, 329, 342, 343, 344, 345, 346, 347, 360, 361, 362, 363, 364, 365, 378, 379, 380, 381, 382, 383,
319  396, 397, 398, 399, 314, 315, 316, 317, 330, 331, 332, 333, 334, 335, 348, 349, 350, 351, 352, 353,
320  366, 367, 368, 369, 370, 371, 384, 385, 386, 387, 388, 389, 402, 403, 404, 405, 320, 321, 322, 323,
321  336, 337, 338, 339, 340, 341, 354, 355, 356, 357, 358, 359, 372, 373, 374, 375, 376, 377, 390, 391,
322  392, 393, 394, 395, 408, 409, 410, 411, 400, 401, 414, 415, 416, 417, 418, 419, 432, 433, 434, 435,
323  436, 437, 450, 451, 452, 453, 454, 455, 468, 469, 470, 471, 472, 473, 486, 487, 488, 489, 490, 491,
324  504, 505, 506, 507, 508, 509, 522, 523, 524, 525, 526, 527, 406, 407, 420, 421, 422, 423, 424, 425,
325  438, 439, 440, 441, 442, 443, 456, 457, 458, 459, 460, 461, 474, 475, 476, 477, 478, 479, 492, 493,
326  494, 495, 496, 497, 510, 511, 512, 513, 514, 515, 528, 529, 530, 531, 532, 533, 412, 413, 426, 427,
327  428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463, 464, 465, 466, 467, 480, 481, 482, 483,
328  484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519, 520, 521, 534, 535, 536, 537, 538, 539,
329  540, 541, 542, 543, 544, 545, 558, 559, 560, 561, 562, 563, 546, 547, 548, 549, 550, 551, 564, 565,
330  566, 567, 568, 569, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575},
331 
332 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
333   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
334   40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
335   72,  73,  60,  61,  62,  63,  64,  65,  78,  79,  66,  67,  68,  69,  70,  71,  84,  85,  74,  75,
336   76,  77,  90,  91,  92,  93,  94,  95,  80,  81,  82,  83,  96,  97,  98,  99, 100, 101,  86,  87,
337   88,  89, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 126, 127, 128, 129, 130, 131,
338  114, 115, 116, 117, 118, 119, 132, 133, 134, 135, 136, 137, 120, 121, 122, 123, 124, 125, 138, 139,
339  140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 162, 163, 164, 165, 166, 167, 180, 181, 150, 151,
340  152, 153, 154, 155, 168, 169, 170, 171, 172, 173, 186, 187, 156, 157, 158, 159, 160, 161, 174, 175,
341  176, 177, 178, 179, 192, 193, 182, 183, 184, 185, 198, 199, 200, 201, 202, 203, 216, 217, 218, 219,
342  220, 221, 234, 235, 188, 189, 190, 191, 204, 205, 206, 207, 208, 209, 222, 223, 224, 225, 226, 227,
343  240, 241, 194, 195, 196, 197, 210, 211, 212, 213, 214, 215, 228, 229, 230, 231, 232, 233, 246, 247,
344  236, 237, 238, 239, 252, 253, 254, 255, 256, 257, 270, 271, 272, 273, 274, 275, 288, 289, 290, 291,
345  292, 293, 306, 307, 242, 243, 244, 245, 258, 259, 260, 261, 262, 263, 276, 277, 278, 279, 280, 281,
346  294, 295, 296, 297, 298, 299, 312, 313, 248, 249, 250, 251, 264, 265, 266, 267, 268, 269, 282, 283,
347  284, 285, 286, 287, 300, 301, 302, 303, 304, 305, 318, 319, 308, 309, 310, 311, 324, 325, 326, 327,
348  328, 329, 342, 343, 344, 345, 346, 347, 360, 361, 362, 363, 364, 365, 378, 379, 380, 381, 382, 383,
349  396, 397, 314, 315, 316, 317, 330, 331, 332, 333, 334, 335, 348, 349, 350, 351, 352, 353, 366, 367,
350  368, 369, 370, 371, 384, 385, 386, 387, 388, 389, 402, 403, 320, 321, 322, 323, 336, 337, 338, 339,
351  340, 341, 354, 355, 356, 357, 358, 359, 372, 373, 374, 375, 376, 377, 390, 391, 392, 393, 394, 395,
352  408, 409, 398, 399, 400, 401, 414, 415, 416, 417, 418, 419, 432, 433, 434, 435, 436, 437, 450, 451,
353  452, 453, 454, 455, 468, 469, 470, 471, 472, 473, 486, 487, 488, 489, 490, 491, 504, 505, 506, 507,
354  508, 509, 404, 405, 406, 407, 420, 421, 422, 423, 424, 425, 438, 439, 440, 441, 442, 443, 456, 457,
355  458, 459, 460, 461, 474, 475, 476, 477, 478, 479, 492, 493, 494, 495, 496, 497, 510, 511, 512, 513,
356  514, 515, 410, 411, 412, 413, 426, 427, 428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463,
357  464, 465, 466, 467, 480, 481, 482, 483, 484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519,
358  520, 521, 522, 523, 524, 525, 526, 527, 540, 541, 542, 543, 544, 545, 558, 559, 560, 561, 562, 563,
359  528, 529, 530, 531, 532, 533, 546, 547, 548, 549, 550, 551, 564, 565, 566, 567, 568, 569, 534, 535,
360  536, 537, 538, 539, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575}
361 },
362 {
363 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
364   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
365   42,  43,  44,  45,  48,  49,  50,  51,  40,  41,  54,  55,  56,  57,  46,  47,  60,  61,  62,  63,
366   52,  53,  66,  67,  68,  69,  58,  59,  72,  73,  74,  75,  76,  77,  64,  65,  78,  79,  80,  81,
367   82,  83,  70,  71,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95, 108, 109, 110, 111,
368   96,  97,  98,  99, 100, 101, 114, 115, 116, 117, 102, 103, 104, 105, 106, 107, 120, 121, 122, 123,
369  112, 113, 126, 127, 128, 129, 130, 131, 144, 145, 146, 147, 118, 119, 132, 133, 134, 135, 136, 137,
370  150, 151, 152, 153, 124, 125, 138, 139, 140, 141, 142, 143, 156, 157, 158, 159, 148, 149, 162, 163,
371  164, 165, 166, 167, 180, 181, 182, 183, 184, 185, 154, 155, 168, 169, 170, 171, 172, 173, 186, 187,
372  188, 189, 190, 191, 160, 161, 174, 175, 176, 177, 178, 179, 192, 193, 194, 195, 196, 197, 198, 199,
373  200, 201, 202, 203, 216, 217, 218, 219, 220, 221, 234, 235, 236, 237, 238, 239, 204, 205, 206, 207,
374  208, 209, 222, 223, 224, 225, 226, 227, 240, 241, 242, 243, 244, 245, 210, 211, 212, 213, 214, 215,
375  228, 229, 230, 231, 232, 233, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 270, 271,
376  272, 273, 274, 275, 288, 289, 290, 291, 292, 293, 306, 307, 308, 309, 258, 259, 260, 261, 262, 263,
377  276, 277, 278, 279, 280, 281, 294, 295, 296, 297, 298, 299, 312, 313, 314, 315, 264, 265, 266, 267,
378  268, 269, 282, 283, 284, 285, 286, 287, 300, 301, 302, 303, 304, 305, 318, 319, 320, 321, 310, 311,
379  324, 325, 326, 327, 328, 329, 342, 343, 344, 345, 346, 347, 360, 361, 362, 363, 364, 365, 378, 379,
380  380, 381, 382, 383, 396, 397, 398, 399, 316, 317, 330, 331, 332, 333, 334, 335, 348, 349, 350, 351,
381  352, 353, 366, 367, 368, 369, 370, 371, 384, 385, 386, 387, 388, 389, 402, 403, 404, 405, 322, 323,
382  336, 337, 338, 339, 340, 341, 354, 355, 356, 357, 358, 359, 372, 373, 374, 375, 376, 377, 390, 391,
383  392, 393, 394, 395, 408, 409, 410, 411, 400, 401, 414, 415, 416, 417, 418, 419, 432, 433, 434, 435,
384  436, 437, 450, 451, 452, 453, 454, 455, 468, 469, 470, 471, 472, 473, 486, 487, 488, 489, 490, 491,
385  504, 505, 506, 507, 508, 509, 522, 523, 524, 525, 526, 527, 540, 541, 542, 543, 544, 545, 558, 559,
386  560, 561, 562, 563, 406, 407, 420, 421, 422, 423, 424, 425, 438, 439, 440, 441, 442, 443, 456, 457,
387  458, 459, 460, 461, 474, 475, 476, 477, 478, 479, 492, 493, 494, 495, 496, 497, 510, 511, 512, 513,
388  514, 515, 528, 529, 530, 531, 532, 533, 546, 547, 548, 549, 550, 551, 564, 565, 566, 567, 568, 569,
389  412, 413, 426, 427, 428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463, 464, 465, 466, 467,
390  480, 481, 482, 483, 484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519, 520, 521, 534, 535,
391  536, 537, 538, 539, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575},
392 
393 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
394   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
395   42,  43,  44,  45,  48,  49,  50,  51,  40,  41,  54,  55,  56,  57,  46,  47,  60,  61,  62,  63,
396   52,  53,  66,  67,  68,  69,  58,  59,  72,  73,  74,  75,  64,  65,  78,  79,  80,  81,  70,  71,
397   84,  85,  86,  87,  76,  77,  90,  91,  92,  93,  94,  95, 108, 109,  82,  83,  96,  97,  98,  99,
398  100, 101, 114, 115,  88,  89, 102, 103, 104, 105, 106, 107, 120, 121, 110, 111, 112, 113, 126, 127,
399  128, 129, 130, 131, 144, 145, 116, 117, 118, 119, 132, 133, 134, 135, 136, 137, 150, 151, 122, 123,
400  124, 125, 138, 139, 140, 141, 142, 143, 156, 157, 146, 147, 148, 149, 162, 163, 164, 165, 166, 167,
401  180, 181, 182, 183, 152, 153, 154, 155, 168, 169, 170, 171, 172, 173, 186, 187, 188, 189, 158, 159,
402  160, 161, 174, 175, 176, 177, 178, 179, 192, 193, 194, 195, 184, 185, 198, 199, 200, 201, 202, 203,
403  216, 217, 218, 219, 220, 221, 234, 235, 190, 191, 204, 205, 206, 207, 208, 209, 222, 223, 224, 225,
404  226, 227, 240, 241, 196, 197, 210, 211, 212, 213, 214, 215, 228, 229, 230, 231, 232, 233, 246, 247,
405  236, 237, 238, 239, 252, 253, 254, 255, 256, 257, 270, 271, 272, 273, 274, 275, 288, 289, 290, 291,
406  242, 243, 244, 245, 258, 259, 260, 261, 262, 263, 276, 277, 278, 279, 280, 281, 294, 295, 296, 297,
407  248, 249, 250, 251, 264, 265, 266, 267, 268, 269, 282, 283, 284, 285, 286, 287, 300, 301, 302, 303,
408  292, 293, 306, 307, 308, 309, 310, 311, 324, 325, 326, 327, 328, 329, 342, 343, 344, 345, 346, 347,
409  360, 361, 362, 363, 364, 365, 298, 299, 312, 313, 314, 315, 316, 317, 330, 331, 332, 333, 334, 335,
410  348, 349, 350, 351, 352, 353, 366, 367, 368, 369, 370, 371, 304, 305, 318, 319, 320, 321, 322, 323,
411  336, 337, 338, 339, 340, 341, 354, 355, 356, 357, 358, 359, 372, 373, 374, 375, 376, 377, 378, 379,
412  380, 381, 382, 383, 396, 397, 398, 399, 400, 401, 414, 415, 416, 417, 418, 419, 432, 433, 434, 435,
413  436, 437, 450, 451, 452, 453, 454, 455, 468, 469, 470, 471, 472, 473, 486, 487, 488, 489, 490, 491,
414  504, 505, 506, 507, 508, 509, 522, 523, 524, 525, 526, 527, 540, 541, 542, 543, 544, 545, 558, 559,
415  560, 561, 562, 563, 384, 385, 386, 387, 388, 389, 402, 403, 404, 405, 406, 407, 420, 421, 422, 423,
416  424, 425, 438, 439, 440, 441, 442, 443, 456, 457, 458, 459, 460, 461, 474, 475, 476, 477, 478, 479,
417  492, 493, 494, 495, 496, 497, 510, 511, 512, 513, 514, 515, 528, 529, 530, 531, 532, 533, 546, 547,
418  548, 549, 550, 551, 564, 565, 566, 567, 568, 569, 390, 391, 392, 393, 394, 395, 408, 409, 410, 411,
419  412, 413, 426, 427, 428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463, 464, 465, 466, 467,
420  480, 481, 482, 483, 484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519, 520, 521, 534, 535,
421  536, 537, 538, 539, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575},
422 
423 {  0,   1,   2,   3,   6,   7,   8,   9,  12,  13,  14,  15,   4,   5,  18,  19,  10,  11,  24,  25,
424   16,  17,  30,  31,  20,  21,  22,  23,  26,  27,  28,  29,  32,  33,  34,  35,  36,  37,  38,  39,
425   42,  43,  44,  45,  48,  49,  50,  51,  40,  41,  54,  55,  56,  57,  46,  47,  60,  61,  62,  63,
426   52,  53,  66,  67,  68,  69,  58,  59,  72,  73,  74,  75,  76,  77,  64,  65,  78,  79,  80,  81,
427   82,  83,  70,  71,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95, 108, 109, 110, 111,
428  112, 113,  96,  97,  98,  99, 100, 101, 114, 115, 116, 117, 118, 119, 102, 103, 104, 105, 106, 107,
429  120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 144, 145, 146, 147, 148, 149, 162, 163,
430  164, 165, 132, 133, 134, 135, 136, 137, 150, 151, 152, 153, 154, 155, 168, 169, 170, 171, 138, 139,
431  140, 141, 142, 143, 156, 157, 158, 159, 160, 161, 174, 175, 176, 177, 166, 167, 180, 181, 182, 183,
432  184, 185, 198, 199, 200, 201, 202, 203, 216, 217, 218, 219, 220, 221, 172, 173, 186, 187, 188, 189,
433  190, 191, 204, 205, 206, 207, 208, 209, 222, 223, 224, 225, 226, 227, 178, 179, 192, 193, 194, 195,
434  196, 197, 210, 211, 212, 213, 214, 215, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
435  252, 253, 254, 255, 256, 257, 270, 271, 272, 273, 274, 275, 288, 289, 290, 291, 292, 293, 306, 307,
436  240, 241, 242, 243, 244, 245, 258, 259, 260, 261, 262, 263, 276, 277, 278, 279, 280, 281, 294, 295,
437  296, 297, 298, 299, 312, 313, 246, 247, 248, 249, 250, 251, 264, 265, 266, 267, 268, 269, 282, 283,
438  284, 285, 286, 287, 300, 301, 302, 303, 304, 305, 318, 319, 308, 309, 310, 311, 324, 325, 326, 327,
439  328, 329, 342, 343, 344, 345, 346, 347, 360, 361, 362, 363, 364, 365, 378, 379, 380, 381, 382, 383,
440  396, 397, 398, 399, 400, 401, 314, 315, 316, 317, 330, 331, 332, 333, 334, 335, 348, 349, 350, 351,
441  352, 353, 366, 367, 368, 369, 370, 371, 384, 385, 386, 387, 388, 389, 402, 403, 404, 405, 406, 407,
442  320, 321, 322, 323, 336, 337, 338, 339, 340, 341, 354, 355, 356, 357, 358, 359, 372, 373, 374, 375,
443  376, 377, 390, 391, 392, 393, 394, 395, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
444  432, 433, 434, 435, 436, 437, 450, 451, 452, 453, 454, 455, 468, 469, 470, 471, 472, 473, 486, 487,
445  488, 489, 490, 491, 504, 505, 506, 507, 508, 509, 522, 523, 524, 525, 526, 527, 420, 421, 422, 423,
446  424, 425, 438, 439, 440, 441, 442, 443, 456, 457, 458, 459, 460, 461, 474, 475, 476, 477, 478, 479,
447  492, 493, 494, 495, 496, 497, 510, 511, 512, 513, 514, 515, 528, 529, 530, 531, 532, 533, 426, 427,
448  428, 429, 430, 431, 444, 445, 446, 447, 448, 449, 462, 463, 464, 465, 466, 467, 480, 481, 482, 483,
449  484, 485, 498, 499, 500, 501, 502, 503, 516, 517, 518, 519, 520, 521, 534, 535, 536, 537, 538, 539,
450  540, 541, 542, 543, 544, 545, 558, 559, 560, 561, 562, 563, 546, 547, 548, 549, 550, 551, 564, 565,
451  566, 567, 568, 569, 552, 553, 554, 555, 556, 557, 570, 571, 572, 573, 574, 575}
452 }};
453 /* TFW: increased size from 8192 to 8206 to accomodate some encoders that use additional 14 lookups
454         also changed static initializer with function to improve accuracy and reduce chance of typo
455 */
456 static float t_43[8207];
457 
458 /* huffman.h  */
459 
460 static int huffman_decode(int tbl,int *x,int *y);
461 
462 #define N_CUE 16
463 #define NC_O  4
464 
465 /* these are the huffman tables, rearranged for lookup
466 */
467 unsigned int h0[1]={0x0};
468 unsigned int h1[4]={0x311, 0x20000301, 0x40000210, 0x80000100};
469 unsigned int h2[9]={0x622, 0x4000602, 0x8000512, 0x10000521, 0x18000520, 0x20000311, 0x40000301, 0x60000310,
470  0x80000100};
471 unsigned int h3[9]={ 0x622, 0x4000602, 0x8000512, 0x10000521, 0x18000520, 0x20000310, 0x40000211, 0x80000201,
472  0xc0000200};
473 unsigned int h5[16]={0x833, 0x1000823, 0x2000732, 0x4000631, 0x8000713, 0xa000703, 0xc000730, 0xe000722,
474  0x10000612, 0x14000621, 0x18000602, 0x1c000620, 0x20000311, 0x40000301, 0x60000310, 0x80000100};
475 unsigned int h6[16]={0x733, 0x2000703, 0x4000623, 0x8000632, 0xc000630, 0x10000513, 0x18000531, 0x20000522,
476  0x28000502, 0x30000412, 0x40000421, 0x50000420, 0x60000301, 0x80000211, 0xc0000310, 0xe0000300};
477 unsigned int h7[36]={ 0xa55, 0x400a45, 0x800a54, 0xc00a53, 0x1000935, 0x1800944, 0x2000925, 0x2800952,
478  0x3000815, 0x4000851, 0x5000905, 0x5800934, 0x6000850, 0x7000943, 0x7800933, 0x8000824,
479  0x9000842, 0xa000714, 0xc000741, 0xe000740, 0x10000804, 0x11000823, 0x12000832, 0x13000803,
480  0x14000713, 0x16000731, 0x18000730, 0x1a000722, 0x1c000612, 0x20000521, 0x28000602, 0x2c000620,
481  0x30000411, 0x40000301, 0x60000310, 0x80000100};
482 unsigned int h8[36]={0xb55, 0x200b54, 0x400a45, 0x800953, 0x1000a35, 0x1400a44, 0x1800925, 0x2000952,
483  0x2800905, 0x3000815, 0x4000851, 0x5000934, 0x5800943, 0x6000950, 0x6800933, 0x7000824,
484  0x8000842, 0x9000814, 0xa000741, 0xc000804, 0xd000840, 0xe000823, 0xf000832, 0x10000813,
485  0x11000831, 0x12000803, 0x13000830, 0x14000622, 0x18000602, 0x1c000620, 0x20000412, 0x30000421,
486  0x40000211, 0x80000301, 0xa0000310, 0xc0000200};
487 unsigned int h9[36]={ 0x955, 0x800945, 0x1000835, 0x2000853, 0x3000954, 0x3800905, 0x4000844, 0x5000825,
488  0x6000852, 0x7000815, 0x8000751, 0xa000734, 0xc000743, 0xe000850, 0xf000804, 0x10000724,
489  0x12000742, 0x14000733, 0x16000740, 0x18000614, 0x1c000641, 0x20000623, 0x24000632, 0x28000513,
490  0x30000531, 0x38000603, 0x3c000630, 0x40000522, 0x48000502, 0x50000412, 0x60000421, 0x70000420,
491  0x80000311, 0xa0000301, 0xc0000310, 0xe0000300};
492 unsigned int h10[64]={ 0xb77, 0x200b67, 0x400b76, 0x600b57, 0x800b75, 0xa00b66, 0xc00a47, 0x1000a74,
493  0x1400a56, 0x1800a65, 0x1c00a37, 0x2000a73, 0x2400a46, 0x2800b55, 0x2a00b54, 0x2c00a63,
494  0x3000927, 0x3800972, 0x4000a64, 0x4400a07, 0x4800970, 0x5000962, 0x5800a45, 0x5c00a35,
495  0x6000906, 0x6800a53, 0x6c00a44, 0x7000817, 0x8000871, 0x9000936, 0x9800926, 0xa000a25,
496  0xa400a52, 0xa800915, 0xb000951, 0xb800a34, 0xbc00a43, 0xc000816, 0xd000861, 0xe000860,
497  0xf000905, 0xf800950, 0x10000924, 0x10800942, 0x11000933, 0x11800904, 0x12000814, 0x13000841,
498  0x14000840, 0x15000823, 0x16000832, 0x17000803, 0x18000713, 0x1a000731, 0x1c000730, 0x1e000722,
499  0x20000612, 0x24000621, 0x28000602, 0x2c000620, 0x30000411, 0x40000301, 0x60000310, 0x80000100};
500 unsigned int h11[64]={ 0xa77, 0x400a67, 0x800a76, 0xc00a75, 0x1000a66, 0x1400a47, 0x1800a74, 0x1c00b57,
501  0x1e00b55, 0x2000a56, 0x2400a65, 0x2800937, 0x3000973, 0x3800946, 0x4000a45, 0x4400a54,
502  0x4800a35, 0x4c00a53, 0x5000827, 0x6000872, 0x7000964, 0x7800907, 0x8000771, 0xa000817,
503  0xb000870, 0xc000836, 0xd000863, 0xe000860, 0xf000944, 0xf800925, 0x10000952, 0x10800905,
504  0x11000815, 0x12000762, 0x14000826, 0x15000806, 0x16000716, 0x18000761, 0x1a000851, 0x1b000834,
505  0x1c000850, 0x1d000943, 0x1d800933, 0x1e000824, 0x1f000842, 0x20000814, 0x21000841, 0x22000804,
506  0x23000840, 0x24000723, 0x26000732, 0x28000613, 0x2c000631, 0x30000703, 0x32000730, 0x34000622,
507  0x38000521, 0x40000412, 0x50000502, 0x58000520, 0x60000311, 0x80000301, 0xa0000310, 0xc0000200};
508 unsigned int h12[64]={ 0xa77, 0x400a67, 0x800976, 0x1000957, 0x1800975, 0x2000966, 0x2800947, 0x3000974,
509  0x3800965, 0x4000856, 0x5000837, 0x6000973, 0x6800955, 0x7000827, 0x8000872, 0x9000846,
510  0xa000864, 0xb000817, 0xc000871, 0xd000907, 0xd800970, 0xe000836, 0xf000863, 0x10000845,
511  0x11000854, 0x12000844, 0x13000906, 0x13800905, 0x14000726, 0x16000762, 0x18000761, 0x1a000816,
512  0x1b000860, 0x1c000835, 0x1d000853, 0x1e000825, 0x1f000852, 0x20000715, 0x22000751, 0x24000734,
513  0x26000743, 0x28000850, 0x29000804, 0x2a000724, 0x2c000742, 0x2e000714, 0x30000633, 0x34000641,
514  0x38000623, 0x3c000632, 0x40000740, 0x42000703, 0x44000630, 0x48000513, 0x50000531, 0x58000522,
515  0x60000412, 0x70000421, 0x80000502, 0x88000520, 0x90000400, 0xa0000311, 0xc0000301, 0xe0000310};
516 unsigned int h13[256]={
517  0x13fe, 0x33fc, 0x52fd, 0x91ed, 0x110ff, 0x210ef, 0x310df, 0x410ee,
518  0x510cf, 0x610de, 0x710bf, 0x810fb, 0x910ce, 0xa10dc, 0xb11af, 0xb91e9,
519  0xc0fec, 0xe0fdd, 0x1010fa, 0x1110cd, 0x120fbe, 0x140feb, 0x160f9f, 0x180ff9,
520  0x1a0fea, 0x1c0fbd, 0x1e0fdb, 0x200f8f, 0x220ff8, 0x240fcc, 0x2610ae, 0x27109e,
521  0x280f8e, 0x2a107f, 0x2b107e, 0x2c0ef7, 0x300eda, 0x340fad, 0x360fbc, 0x380fcb,
522  0x3a0ff6, 0x3c0e6f, 0x400ee8, 0x440e5f, 0x480e9d, 0x4c0ed9, 0x500ef5, 0x540ee7,
523  0x580eac, 0x5c0ebb, 0x600e4f, 0x640ef4, 0x680fca, 0x6a0fe6, 0x6c0ef3, 0x700d3f,
524  0x780e8d, 0x7c0ed8, 0x800d2f, 0x880df2, 0x900e6e, 0x940e9c, 0x980d0f, 0xa00ec9,
525  0xa40e5e, 0xa80dab, 0xb00e7d, 0xb40ed7, 0xb80d4e, 0xc00ec8, 0xc40ed6, 0xc80d3e,
526  0xd00db9, 0xd80e9b, 0xdc0eaa, 0xe00c1f, 0xf00cf1, 0x1000cf0, 0x1100dba, 0x1180de5,
527  0x1200de4, 0x1280d8c, 0x1300d6d, 0x1380de3, 0x1400ce2, 0x1500d2e, 0x1580d0e, 0x1600c1e,
528  0x1700ce1, 0x1800de0, 0x1880d5d, 0x1900dd5, 0x1980d7c, 0x1a00dc7, 0x1a80d4d, 0x1b00d8b,
529  0x1b80db8, 0x1c00dd4, 0x1c80d9a, 0x1d00da9, 0x1d80d6c, 0x1e00cc6, 0x1f00c3d, 0x2000dd3,
530  0x2080d7b, 0x2100c2d, 0x2200cd2, 0x2300c1d, 0x2400cb7, 0x2500d5c, 0x2580dc5, 0x2600d99,
531  0x2680d7a, 0x2700cc3, 0x2800da7, 0x2880d97, 0x2900c4b, 0x2a00bd1, 0x2c00c0d, 0x2d00cd0,
532  0x2e00c8a, 0x2f00ca8, 0x3000c4c, 0x3100cc4, 0x3200c6b, 0x3300cb6, 0x3400b3c, 0x3600b2c,
533  0x3800bc2, 0x3a00b5b, 0x3c00cb5, 0x3d00c89, 0x3e00b1c, 0x4000bc1, 0x4200c98, 0x4300c0c,
534  0x4400bc0, 0x4600cb4, 0x4700c6a, 0x4800ca6, 0x4900c79, 0x4a00b3b, 0x4c00bb3, 0x4e00c88,
535  0x4f00c5a, 0x5000b2b, 0x5200ca5, 0x5300c69, 0x5400ba4, 0x5600c78, 0x5700c87, 0x5800b94,
536  0x5a00c77, 0x5b00c76, 0x5c00ab2, 0x6000a1b, 0x6400ab1, 0x6800b0b, 0x6a00bb0, 0x6c00b96,
537  0x6e00b4a, 0x7000b3a, 0x7200ba3, 0x7400b59, 0x7600b95, 0x7800a2a, 0x7c00aa2, 0x8000a1a,
538  0x8400aa1, 0x8800b0a, 0x8a00b68, 0x8c00aa0, 0x9000b86, 0x9200b49, 0x9400a93, 0x9800b39,
539  0x9a00b58, 0x9c00b85, 0x9e00b67, 0xa000a29, 0xa400a92, 0xa800b57, 0xaa00b75, 0xac00a38,
540  0xb000a83, 0xb400b66, 0xb600b47, 0xb800b74, 0xba00b56, 0xbc00b65, 0xbe00b73, 0xc000919,
541  0xc800991, 0xd000a09, 0xd400a90, 0xd800a48, 0xdc00a84, 0xe000a72, 0xe400b46, 0xe600b64,
542  0xe800928, 0xf000982, 0xf800918, 0x10000a37, 0x10400a27, 0x10800917, 0x11000971, 0x11800a55,
543  0x11c00a07, 0x12000a70, 0x12400a36, 0x12800a63, 0x12c00a45, 0x13000a54, 0x13400a26, 0x13800a62,
544  0x13c00a35, 0x14000881, 0x15000908, 0x15800980, 0x16000916, 0x16800961, 0x17000906, 0x17800960,
545  0x18000a53, 0x18400a44, 0x18800925, 0x19000952, 0x19800905, 0x1a000815, 0x1b000851, 0x1c000934,
546  0x1c800943, 0x1d000950, 0x1d800924, 0x1e000942, 0x1e800933, 0x1f000814, 0x20000741, 0x22000804,
547  0x23000840, 0x24000823, 0x25000832, 0x26000713, 0x28000731, 0x2a000703, 0x2c000730, 0x2e000722,
548  0x30000612, 0x34000621, 0x38000602, 0x3c000620, 0x40000411, 0x50000401, 0x60000310, 0x80000100};
549 unsigned int h15[256]={ 0xdff, 0x80def, 0x100dfe, 0x180ddf, 0x200cee, 0x300dfd, 0x380dcf, 0x400dfc,
550  0x480dde, 0x500ded, 0x580dbf, 0x600cfb, 0x700dce, 0x780dec, 0x800cdd, 0x900caf,
551  0xa00cfa, 0xb00cbe, 0xc00ceb, 0xd00ccd, 0xe00cdc, 0xf00c9f, 0x1000cf9, 0x1100cea,
552  0x1200cbd, 0x1300cdb, 0x1400c8f, 0x1500cf8, 0x1600ccc, 0x1700c9e, 0x1800ce9, 0x1900c7f,
553  0x1a00cf7, 0x1b00cad, 0x1c00cda, 0x1d00cbc, 0x1e00c6f, 0x1f00dae, 0x1f80d0f, 0x2000bcb,
554  0x2200bf6, 0x2400c8e, 0x2500ce8, 0x2600c5f, 0x2700c9d, 0x2800bf5, 0x2a00b7e, 0x2c00be7,
555  0x2e00bac, 0x3000bca, 0x3200bbb, 0x3400cd9, 0x3500c8d, 0x3600b4f, 0x3800bf4, 0x3a00b3f,
556  0x3c00bf3, 0x3e00bd8, 0x4000be6, 0x4200b2f, 0x4400bf2, 0x4600c6e, 0x4700cf0, 0x4800b1f,
557  0x4a00bf1, 0x4c00b9c, 0x4e00bc9, 0x5000b5e, 0x5200bab, 0x5400bba, 0x5600be5, 0x5800b7d,
558  0x5a00bd7, 0x5c00b4e, 0x5e00be4, 0x6000b8c, 0x6200bc8, 0x6400b3e, 0x6600b6d, 0x6800bd6,
559  0x6a00be3, 0x6c00b9b, 0x6e00bb9, 0x7000b2e, 0x7200baa, 0x7400be2, 0x7600b1e, 0x7800be1,
560  0x7a00c0e, 0x7b00ce0, 0x7c00b5d, 0x7e00bd5, 0x8000b7c, 0x8200bc7, 0x8400b4d, 0x8600b8b,
561  0x8800ad4, 0x8c00bb8, 0x8e00b9a, 0x9000ba9, 0x9200b6c, 0x9400bc6, 0x9600b3d, 0x9800ad3,
562  0x9c00ad2, 0xa000b2d, 0xa200b0d, 0xa400a1d, 0xa800a7b, 0xac00ab7, 0xb000ad1, 0xb400b5c,
563  0xb600bd0, 0xb800ac5, 0xbc00a8a, 0xc000aa8, 0xc400a4c, 0xc800ac4, 0xcc00a6b, 0xd000ab6,
564  0xd400b99, 0xd600b0c, 0xd800a3c, 0xdc00ac3, 0xe000a7a, 0xe400aa7, 0xe800aa6, 0xec00bc0,
565  0xee00b0b, 0xf0009c2, 0xf800a2c, 0xfc00a5b, 0x10000ab5, 0x10400a1c, 0x10800a89, 0x10c00a98,
566  0x11000ac1, 0x11400a4b, 0x11800ab4, 0x11c00a6a, 0x12000a3b, 0x12400a79, 0x128009b3, 0x13000a97,
567  0x13400a88, 0x13800a2b, 0x13c00a5a, 0x140009b2, 0x14800aa5, 0x14c00a1b, 0x150009b1, 0x15800ab0,
568  0x15c00a69, 0x16000a96, 0x16400a4a, 0x16800aa4, 0x16c00a78, 0x17000a87, 0x17400a3a, 0x178009a3,
569  0x18000959, 0x18800995, 0x1900092a, 0x198009a2, 0x1a00091a, 0x1a8009a1, 0x1b000a0a, 0x1b400aa0,
570  0x1b800968, 0x1c000986, 0x1c800949, 0x1d000994, 0x1d800939, 0x1e000993, 0x1e800a77, 0x1ec00a09,
571  0x1f000958, 0x1f800985, 0x20000929, 0x20800967, 0x21000976, 0x21800992, 0x22000891, 0x23000919,
572  0x23800990, 0x24000948, 0x24800984, 0x25000957, 0x25800975, 0x26000938, 0x26800983, 0x27000966,
573  0x27800947, 0x28000828, 0x29000882, 0x2a000818, 0x2b000881, 0x2c000974, 0x2c800908, 0x2d000980,
574  0x2d800956, 0x2e000965, 0x2e800937, 0x2f000973, 0x2f800946, 0x30000827, 0x31000872, 0x32000864,
575  0x33000817, 0x34000855, 0x35000871, 0x36000907, 0x36800970, 0x37000836, 0x38000863, 0x39000845,
576  0x3a000854, 0x3b000826, 0x3c000862, 0x3d000816, 0x3e000906, 0x3e800960, 0x3f000835, 0x40000761,
577  0x42000853, 0x43000844, 0x44000725, 0x46000752, 0x48000715, 0x4a000751, 0x4c000805, 0x4d000850,
578  0x4e000734, 0x50000743, 0x52000724, 0x54000742, 0x56000733, 0x58000641, 0x5c000714, 0x5e000704,
579  0x60000623, 0x64000632, 0x68000740, 0x6a000703, 0x6c000613, 0x70000631, 0x74000630, 0x78000522,
580  0x80000512, 0x88000521, 0x90000502, 0x98000520, 0xa0000311, 0xc0000401, 0xd0000410, 0xe0000300};
581 unsigned int h16[256]={ 0xbef, 0x200bfe, 0x400bdf, 0x600bfd, 0x800bcf, 0xa00bfc, 0xc00bbf, 0xe00bfb,
582  0x1000aaf, 0x1400bfa, 0x1600b9f, 0x1800bf9, 0x1a00bf8, 0x1c00a8f, 0x2000a7f, 0x2400af7,
583  0x2800a6f, 0x2c00af6, 0x30008ff, 0x4000a5f, 0x4400af5, 0x480094f, 0x50009f4, 0x58009f3,
584  0x60009f0, 0x6800a3f, 0x6c010ce, 0x6c111ec, 0x6c191dd, 0x6c20fde, 0x6c40fe9, 0x6c610ea,
585  0x6c710d9, 0x6c80eee, 0x6cc0fed, 0x6ce0feb, 0x6d00ebe, 0x6d40ecd, 0x6d80fdc, 0x6da0fdb,
586  0x6dc0eae, 0x6e00ecc, 0x6e40fad, 0x6e60fda, 0x6e80f7e, 0x6ea0fac, 0x6ec0eca, 0x6f00fc9,
587  0x6f20f7d, 0x6f40e5e, 0x6f80dbd, 0x70008f2, 0x800092f, 0x880090f, 0x900081f, 0xa0008f1,
588  0xb000d9e, 0xb080ebc, 0xb0c0ecb, 0xb100e8e, 0xb140ee8, 0xb180e9d, 0xb1c0ee7, 0xb200ebb,
589  0xb240e8d, 0xb280ed8, 0xb2c0e6e, 0xb300de6, 0xb380d9c, 0xb400eab, 0xb440eba, 0xb480ee5,
590  0xb4c0ed7, 0xb500d4e, 0xb580ee4, 0xb5c0e8c, 0xb600dc8, 0xb680d3e, 0xb700d6d, 0xb780ed6,
591  0xb7c0e9b, 0xb800eb9, 0xb840eaa, 0xb880de1, 0xb900dd4, 0xb980eb8, 0xb9c0ea9, 0xba00d7b,
592  0xba80eb7, 0xbac0ed0, 0xbb00ce3, 0xbc00d0e, 0xbc80de0, 0xbd00d5d, 0xbd80dd5, 0xbe00d7c,
593  0xbe80dc7, 0xbf00d4d, 0xbf80d8b, 0xc000d9a, 0xc080d6c, 0xc100dc6, 0xc180d3d, 0xc200d5c,
594  0xc280dc5, 0xc300c0d, 0xc400d8a, 0xc480da8, 0xc500d99, 0xc580d4c, 0xc600db6, 0xc680d7a,
595  0xc700c3c, 0xc800d5b, 0xc880d89, 0xc900c1c, 0xca00cc0, 0xcb00d98, 0xcb80d79, 0xcc00be2,
596  0xce00c2e, 0xcf00c1e, 0xd000cd3, 0xd100c2d, 0xd200cd2, 0xd300cd1, 0xd400c3b, 0xd500d97,
597  0xd580d88, 0xd600b1d, 0xd800cc4, 0xd900c6b, 0xda00cc3, 0xdb00ca7, 0xdc00b2c, 0xde00cc2,
598  0xdf00cb5, 0xe000cc1, 0xe100c0c, 0xe200c4b, 0xe300cb4, 0xe400c6a, 0xe500ca6, 0xe600bb3,
599  0xe800c5a, 0xe900ca5, 0xea00b2b, 0xec00bb2, 0xee00b1b, 0xf000bb1, 0xf200c0b, 0xf300cb0,
600  0xf400c69, 0xf500c96, 0xf600c4a, 0xf700ca4, 0xf800c78, 0xf900c87, 0xfa00ba3, 0xfc00c3a,
601   0xfd00c59, 0xfe00b2a, 0x10000c95, 0x10100c68, 0x10200ba1, 0x10400c86, 0x10500c77, 0x10600b94,
602  0x10800c49, 0x10900c57, 0x10a00b67, 0x10c00aa2, 0x11000a1a, 0x11400b0a, 0x11600ba0, 0x11800b39,
603  0x11a00b93, 0x11c00b58, 0x11e00b85, 0x12000a29, 0x12400a92, 0x12800b76, 0x12a00b09, 0x12c00a19,
604  0x13000a91, 0x13400b90, 0x13600b48, 0x13800b84, 0x13a00b75, 0x13c00b38, 0x13e00b83, 0x14000b66,
605  0x14200b28, 0x14400a82, 0x14800b47, 0x14a00b74, 0x14c00a18, 0x15000a81, 0x15400a80, 0x15800b08,
606  0x15a00b56, 0x15c00a37, 0x16000a73, 0x16400b65, 0x16600b46, 0x16800a27, 0x16c00a72, 0x17000b64,
607  0x17200b55, 0x17400a07, 0x17800917, 0x18000971, 0x18800a70, 0x18c00a36, 0x19000a63, 0x19400a45,
608  0x19800a54, 0x19c00a26, 0x1a000962, 0x1a800916, 0x1b000961, 0x1b800a06, 0x1bc00a60, 0x1c000953,
609  0x1c800a35, 0x1cc00a44, 0x1d000925, 0x1d800952, 0x1e000851, 0x1f000915, 0x1f800905, 0x20000934,
610  0x20800943, 0x21000950, 0x21800924, 0x22000942, 0x22800933, 0x23000814, 0x24000841, 0x25000904,
611  0x25800940, 0x26000823, 0x27000832, 0x28000713, 0x2a000731, 0x2c000803, 0x2d000830, 0x2e000722,
612  0x30000612, 0x34000621, 0x38000602, 0x3c000620, 0x40000411, 0x50000401, 0x60000310, 0x80000100};
613 unsigned int h24[256]={ 0x8ef, 0x10008fe, 0x20008df, 0x30008fd, 0x40008cf, 0x50008fc, 0x60008bf, 0x70008fb,
614  0x80007fa, 0xa0008af, 0xb00089f, 0xc0007f9, 0xe0007f8, 0x1000088f, 0x1100087f, 0x120007f7,
615  0x1400076f, 0x160007f6, 0x1800075f, 0x1a0007f5, 0x1c00074f, 0x1e0007f4, 0x2000073f, 0x220007f3,
616  0x2400072f, 0x260007f2, 0x280007f1, 0x2a00081f, 0x2b0008f0, 0x2c00090f, 0x2c800bee, 0x2ca00bde,
617  0x2cc00bed, 0x2ce00bce, 0x2d000bec, 0x2d200bdd, 0x2d400bbe, 0x2d600beb, 0x2d800bcd, 0x2da00bdc,
618  0x2dc00bae, 0x2de00bea, 0x2e000bbd, 0x2e200bdb, 0x2e400bcc, 0x2e600b9e, 0x2e800be9, 0x2ea00bad,
619  0x2ec00bda, 0x2ee00bbc, 0x2f000bcb, 0x2f200b8e, 0x2f400be8, 0x2f600b9d, 0x2f800bd9, 0x2fa00b7e,
620  0x2fc00be7, 0x2fe00bac, 0x300004ff, 0x40000bca, 0x40200bbb, 0x40400b8d, 0x40600bd8, 0x40800c0e,
621  0x40900ce0, 0x40a00b0d, 0x40c00ae6, 0x41000b6e, 0x41200b9c, 0x41400ac9, 0x41800a5e, 0x41c00aba,
622  0x42000ae5, 0x42400bab, 0x42600b7d, 0x42800ad7, 0x42c00ae4, 0x43000a8c, 0x43400ac8, 0x43800b4e,
623  0x43a00b2e, 0x43c00a3e, 0x44000a6d, 0x44400ad6, 0x44800ae3, 0x44c00a9b, 0x45000ab9, 0x45400aaa,
624  0x45800ae2, 0x45c00a1e, 0x46000ae1, 0x46400a5d, 0x46800ad5, 0x46c00a7c, 0x47000ac7, 0x47400a4d,
625  0x47800a8b, 0x47c00ab8, 0x48000ad4, 0x48400a9a, 0x48800aa9, 0x48c00a6c, 0x49000ac6, 0x49400a3d,
626  0x49800ad3, 0x49c00a2d, 0x4a000ad2, 0x4a400a1d, 0x4a800a7b, 0x4ac00ab7, 0x4b000ad1, 0x4b400a5c,
627  0x4b800ac5, 0x4bc00a8a, 0x4c000aa8, 0x4c400a99, 0x4c800a4c, 0x4cc00ac4, 0x4d000a6b, 0x4d400ab6,
628  0x4d800bd0, 0x4da00b0c, 0x4dc00a3c, 0x4e000ac3, 0x4e400a7a, 0x4e800aa7, 0x4ec00a2c, 0x4f000ac2,
629  0x4f400a5b, 0x4f800ab5, 0x4fc00a1c, 0x50000a89, 0x50400a98, 0x50800ac1, 0x50c00a4b, 0x51000bc0,
630  0x51200b0b, 0x51400a3b, 0x51800bb0, 0x51a00b0a, 0x51c00a1a, 0x520009b4, 0x52800a6a, 0x52c00aa6,
631  0x53000a79, 0x53400a97, 0x53800ba0, 0x53a00b09, 0x53c00a90, 0x540009b3, 0x54800988, 0x55000a2b,
632  0x55400a5a, 0x558009b2, 0x56000aa5, 0x56400a1b, 0x56800ab1, 0x56c00a69, 0x57000996, 0x578009a4,
633  0x58000a4a, 0x58400a78, 0x58800987, 0x5900093a, 0x598009a3, 0x5a000959, 0x5a800995, 0x5b00092a,
634   0x5b8009a2, 0x5c0009a1, 0x5c800968, 0x5d000986, 0x5d800977, 0x5e000949, 0x5e800994, 0x5f000939,
635  0x5f800993, 0x60000958, 0x60800985, 0x61000929, 0x61800967, 0x62000976, 0x62800992, 0x63000919,
636  0x63800991, 0x64000948, 0x64800984, 0x65000957, 0x65800975, 0x66000938, 0x66800983, 0x67000966,
637  0x67800928, 0x68000982, 0x68800918, 0x69000947, 0x69800974, 0x6a000981, 0x6a800a08, 0x6ac00a80,
638  0x6b000956, 0x6b800965, 0x6c000917, 0x6c800a07, 0x6cc00a70, 0x6d000873, 0x6e000937, 0x6e800927,
639  0x6f000872, 0x70000846, 0x71000864, 0x72000855, 0x73000871, 0x74000836, 0x75000863, 0x76000845,
640  0x77000854, 0x78000826, 0x79000862, 0x7a000816, 0x7b000861, 0x7c000906, 0x7c800960, 0x7d000835,
641  0x7e000853, 0x7f000844, 0x80000825, 0x81000852, 0x82000815, 0x83000905, 0x83800950, 0x84000751,
642  0x86000834, 0x87000843, 0x88000724, 0x8a000742, 0x8c000733, 0x8e000714, 0x90000741, 0x92000804,
643  0x93000840, 0x94000723, 0x96000732, 0x98000613, 0x9c000631, 0xa0000703, 0xa2000730, 0xa4000622,
644  0xa8000512, 0xb0000521, 0xb8000602, 0xbc000620, 0xc0000411, 0xd0000401, 0xe0000410, 0xf0000400};
645 unsigned int hA[16]={ 0x6b0, 0x40006f0, 0x80006d0, 0xc0006e0, 0x10000670, 0x14000650, 0x18000590, 0x20000560,
646  0x28000530, 0x300005a0, 0x380005c0, 0x40000420, 0x50000410, 0x60000440, 0x70000480, 0x80000100};
647 unsigned int hB[16]={  0x4f0, 0x100004e0, 0x200004d0, 0x300004c0, 0x400004b0, 0x500004a0, 0x60000490, 0x70000480,
648  0x80000470, 0x90000460, 0xa0000450, 0xb0000440, 0xc0000430, 0xd0000420, 0xe0000410, 0xf0000400};
649 
650 /* now the cues, remember to change these tables if you change N_CUE
651 */
652 unsigned char h_cue[34][N_CUE]={
653 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
654 {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3},
655 {0,3,5,5,6,6,7,7,8,8,8,8,8,8,8,8},
656 {0,3,5,5,6,6,6,6,7,7,7,7,8,8,8,8},
657 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
658 {0,8,12,12,13,13,14,14,15,15,15,15,15,15,15,15},
659 {0,5,7,9,10,11,12,12,13,13,13,13,14,14,15,15},
660 {0,20,29,32,33,33,34,34,35,35,35,35,35,35,35,35},
661 {0,23,30,31,32,32,32,32,33,33,34,34,35,35,35,35},
662 {0,15,21,24,27,29,30,31,32,32,33,33,34,34,35,35},
663 {0,42,56,60,61,61,62,62,63,63,63,63,63,63,63,63},
664 {0,30,45,53,57,58,60,60,61,61,62,62,63,63,63,63},
665 {0,23,37,46,50,54,56,57,58,60,61,61,62,62,63,63},
666 {0,203,238,248,252,253,254,254,255,255,255,255,255,255,255,255},
667 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
668 {0,132,178,205,223,233,240,245,248,250,252,252,253,254,255,255},
669 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
670 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
671 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
672 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
673 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
674 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
675 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
676 {0,162,231,248,252,253,254,254,255,255,255,255,255,255,255,255},
677 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
678 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
679 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
680 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
681 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
682 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
683 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
684 {0,13,22,58,59,131,177,209,226,238,245,249,252,253,254,255},
685 {0,4,7,9,11,12,13,14,15,15,15,15,15,15,15,15},
686 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
687 };
688 
689 /* hmmm, a sto sa h4 i h14, preslikati ih u h5/h15
690 */
691 unsigned int *tables[34]={h0,h1,h2,h3,0,h5,h6,h7,h8,h9,h10,h11,h12,h13,0,h15,
692         h16,h16,h16,h16,h16,h16,h16,h16,h24,h24,h24,h24,h24,h24,h24,h24,hA,hB};
693 
694 /* transform.h */
695 
696 static void imdct_init();
697 void imdct(mp3Info *ext, int win_type,int sb,int ch);
698 void poly(mp3Info *ext, const int ch, int i);
699 static void premultiply();
700 
701 static const float t_sin[4][36]={{
702    -0.032160f,    0.103553f,   -0.182543f,    0.266729f,   -0.353554f,    0.440377f,
703    -0.524563f,    0.603553f,   -0.674947f,    0.736575f,   -0.786566f,    0.823400f,
704    -0.845957f,    0.853554f,   -0.845957f,    0.823399f,   -0.786566f,    0.736575f,
705    -0.674947f,    0.603553f,   -0.524564f,    0.440378f,   -0.353553f,    0.266729f,
706    -0.182544f,    0.103553f,   -0.032160f,   -0.029469f,    0.079459f,   -0.116293f,
707     0.138851f,   -0.146446f,    0.138851f,   -0.116293f,    0.079459f,   -0.029469f
708 },{
709    -0.032160f,    0.103553f,   -0.182543f,    0.266729f,   -0.353554f,    0.440377f,
710    -0.524563f,    0.603553f,   -0.674947f,    0.736575f,   -0.786566f,    0.823400f,
711    -0.845957f,    0.853554f,   -0.845957f,    0.823399f,   -0.786566f,    0.736575f,
712    -0.675590f,    0.608761f,   -0.537300f,    0.461749f,   -0.382683f,    0.300706f,
713    -0.214588f,    0.120590f,   -0.034606f,   -0.026554f,    0.049950f,   -0.028251f,
714     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f
715 },{
716    -0.103553f,    0.353554f,   -0.603553f,    0.786566f,   -0.853554f,    0.786566f,
717    -0.603553f,    0.353553f,   -0.103553f,   -0.079459f,    0.146446f,   -0.079459f,
718     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,
719     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,
720     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,
721     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f
722 },{
723     0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,    0.000000f,
724    -0.127432f,    0.379410f,   -0.608182f,    0.792598f,   -0.915976f,    0.967944f,
725    -0.953717f,    0.923880f,   -0.887011f,    0.843391f,   -0.793353f,    0.737277f,
726    -0.674947f,    0.603553f,   -0.524564f,    0.440378f,   -0.353553f,    0.266729f,
727    -0.182544f,    0.103553f,   -0.032160f,   -0.029469f,    0.079459f,   -0.116293f,
728     0.138851f,   -0.146446f,    0.138851f,   -0.116293f,    0.079459f,   -0.029469f
729 }};
730 
731 static const float t_2cos[4][18]={
732 { -0.174311f,  -0.517638f,  -0.845237f,  -1.147153f,
733   -1.414214f,  -1.638304f, -1.812616f,  -1.931852f,
734   -1.992389f,   0.174311f,   0.517638f,   0.845237f,
735    1.147153f,   1.414214f,   1.638304f, 1.812616f,
736    1.931852f,   1.992389f},
737 { -0.174311f,  -0.517638f,  -0.845237f,  -1.147153f,
738   -1.414214f,  -1.638304f, -1.812616f,  -1.931852f,
739   -1.992389f,   0.174311f,   0.517638f,   0.845237f,
740    1.147153f,   1.414214f,   1.638304f, 1.812616f,
741    1.931852f,   1.992389f},
742 { -0.517638f, -1.41421f, -1.93185f, 0.517638f, 1.41421f
743     , 1.93185f,.0f,.0f,.0f,.0f,.0f,.0f,.0f,.0f,.0f,.0f,.0f,.0f},
744 { -0.174311f,  -0.517638f,  -0.845237f,  -1.147153f,
745   -1.414214f,  -1.638304f, -1.812616f,  -1.931852f,  -1.992389f,
746    0.174311f,   0.517638f,   0.845237f,   1.147153f,
747    1.414214f,   1.638304f, 1.812616f,   1.931852f,   1.992389f}
748 };
749 
750 static const float b1 = 1.997590912f;
751 static const float b2 = 1.990369453f;
752 static const float b3 = 1.978353019f;
753 static const float b4 = 1.961570560f;
754 static const float b5 = 1.940062506f;
755 static const float b6 = 1.913880671f;
756 static const float b7 = 1.883088130f;
757 static const float b8 = 1.847759065f;
758 static const float b9 = 1.807978586f;
759 static const float b10= 1.763842529f;
760 static const float b11= 1.715457220f;
761 static const float b12= 1.662939225f;
762 static const float b13= 1.606415063f;
763 static const float b14= 1.546020907f;
764 static const float b15= 1.481902251f;
765 static const float b16= 1.414213562f;
766 static const float b17= 1.343117910f;
767 static const float b18= 1.268786568f;
768 static const float b19= 1.191398609f;
769 static const float b20= 1.111140466f;
770 static const float b21= 1.028205488f;
771 static const float b22= 0.942793474f;
772 static const float b23= 0.855110187f;
773 static const float b24= 0.765366865f;
774 static const float b25= 0.673779707f;
775 static const float b26= 0.580569355f;
776 static const float b27= 0.485960360f;
777 static const float b28= 0.390180644f;
778 static const float b29= 0.293460949f;
779 static const float b30= 0.196034281f;
780 static const float b31= 0.098135349f;
781 
782 static float t_dewindow[16][32] = {
783 {0.000000000f ,-0.000442505f , 0.003250122f ,-0.007003784f , 0.031082153f ,-0.078628540f , 0.100311279f ,-0.572036743f ,
784  1.144989014f , 0.572036743f , 0.100311279f , 0.078628540f , 0.031082153f , 0.007003784f , 0.003250122f , 0.000442505f ,
785 -0.000015259f ,-0.000473022f , 0.003326416f ,-0.007919312f , 0.030517578f ,-0.084182739f , 0.090927124f ,-0.600219727f ,
786  1.144287109f , 0.543823242f , 0.108856201f , 0.073059082f , 0.031478882f , 0.006118774f , 0.003173828f , 0.000396729f },
787 
788 {-0.000015259f ,-0.000534058f , 0.003387451f ,-0.008865356f , 0.029785156f ,-0.089706421f , 0.080688477f ,-0.628295898f ,
789  1.142211914f , 0.515609741f , 0.116577148f , 0.067520142f , 0.031738281f , 0.005294800f , 0.003082275f , 0.000366211f ,
790 -0.000015259f ,-0.000579834f , 0.003433228f ,-0.009841919f , 0.028884888f ,-0.095169067f , 0.069595337f ,-0.656219482f ,
791  1.138763428f , 0.487472534f , 0.123474121f , 0.061996460f , 0.031845093f , 0.004486084f , 0.002990723f , 0.000320435f },
792 
793 {-0.000015259f ,-0.000625610f , 0.003463745f ,-0.010848999f , 0.027801514f ,-0.100540161f , 0.057617187f ,-0.683914185f ,
794  1.133926392f , 0.459472656f , 0.129577637f , 0.056533813f , 0.031814575f , 0.003723145f , 0.002899170f , 0.000289917f ,
795 -0.000015259f ,-0.000686646f , 0.003479004f ,-0.011886597f , 0.026535034f ,-0.105819702f , 0.044784546f ,-0.711318970f ,
796  1.127746582f , 0.431655884f , 0.134887695f , 0.051132202f , 0.031661987f , 0.003005981f , 0.002792358f , 0.000259399f },
797 
798 {-0.000015259f ,-0.000747681f , 0.003479004f ,-0.012939453f , 0.025085449f ,-0.110946655f , 0.031082153f ,-0.738372803f ,
799  1.120223999f , 0.404083252f , 0.139450073f , 0.045837402f , 0.031387329f , 0.002334595f , 0.002685547f , 0.000244141f ,
800 -0.000030518f ,-0.000808716f , 0.003463745f ,-0.014022827f , 0.023422241f ,-0.115921021f , 0.016510010f ,-0.765029907f ,
801  1.111373901f , 0.376800537f , 0.143264771f , 0.040634155f , 0.031005859f , 0.001693726f , 0.002578735f , 0.000213623f },
802 
803 {-0.000030518f ,-0.000885010f , 0.003417969f ,-0.015121460f , 0.021575928f ,-0.120697021f , 0.001068115f ,-0.791213989f ,
804  1.101211548f , 0.349868774f , 0.146362305f , 0.035552979f , 0.030532837f , 0.001098633f , 0.002456665f , 0.000198364f ,
805 -0.000030518f ,-0.000961304f , 0.003372192f ,-0.016235352f , 0.019531250f ,-0.125259399f ,-0.015228271f ,-0.816864014f ,
806  1.089782715f , 0.323318481f , 0.148773193f , 0.030609131f , 0.029937744f , 0.000549316f , 0.002349854f , 0.000167847f },
807 
808 {-0.000030518f ,-0.001037598f , 0.003280640f ,-0.017349243f , 0.017257690f ,-0.129562378f ,-0.032379150f ,-0.841949463f ,
809  1.077117920f , 0.297210693f , 0.150497437f , 0.025817871f , 0.029281616f , 0.000030518f , 0.002243042f , 0.000152588f ,
810 -0.000045776f ,-0.001113892f , 0.003173828f ,-0.018463135f , 0.014801025f ,-0.133590698f ,-0.050354004f ,-0.866363525f ,
811  1.063217163f , 0.271591187f , 0.151596069f , 0.021179199f , 0.028533936f ,-0.000442505f , 0.002120972f , 0.000137329f },
812 
813 {-0.000045776f ,-0.001205444f , 0.003051758f ,-0.019577026f , 0.012115479f ,-0.137298584f ,-0.069168091f ,-0.890090942f ,
814  1.048156738f , 0.246505737f , 0.152069092f , 0.016708374f , 0.027725220f ,-0.000869751f , 0.002014160f , 0.000122070f ,
815 -0.000061035f ,-0.001296997f , 0.002883911f ,-0.020690918f , 0.009231567f ,-0.140670776f ,-0.088775635f ,-0.913055420f ,
816  1.031936646f , 0.221984863f , 0.151962280f , 0.012420654f , 0.026840210f ,-0.001266479f , 0.001907349f , 0.000106812f },
817 
818 {-0.000061035f ,-0.001388550f , 0.002700806f ,-0.021789551f , 0.006134033f ,-0.143676758f ,-0.109161377f ,-0.935195923f ,
819  1.014617920f , 0.198059082f , 0.151306152f , 0.008316040f , 0.025909424f ,-0.001617432f , 0.001785278f , 0.000106812f ,
820 -0.000076294f ,-0.001480103f , 0.002487183f ,-0.022857666f , 0.002822876f ,-0.146255493f ,-0.130310059f ,-0.956481934f ,
821  0.996246338f , 0.174789429f , 0.150115967f , 0.004394531f , 0.024932861f ,-0.001937866f , 0.001693726f , 0.000091553f },
822 
823 {-0.000076294f ,-0.001586914f , 0.002227783f ,-0.023910522f ,-0.000686646f ,-0.148422241f ,-0.152206421f ,-0.976852417f ,
824  0.976852417f , 0.152206421f , 0.148422241f , 0.000686646f , 0.023910522f ,-0.002227783f , 0.001586914f , 0.000076294f ,
825 -0.000091553f ,-0.001693726f , 0.001937866f ,-0.024932861f ,-0.004394531f ,-0.150115967f ,-0.174789429f ,-0.996246338f ,
826  0.956481934f , 0.130310059f , 0.146255493f ,-0.002822876f , 0.022857666f ,-0.002487183f , 0.001480103f , 0.000076294f },
827 
828 {-0.000106812f ,-0.001785278f , 0.001617432f ,-0.025909424f ,-0.008316040f ,-0.151306152f ,-0.198059082f ,-1.014617920f ,
829  0.935195923f , 0.109161377f , 0.143676758f ,-0.006134033f , 0.021789551f ,-0.002700806f , 0.001388550f , 0.000061035f ,
830 -0.000106812f ,-0.001907349f , 0.001266479f ,-0.026840210f ,-0.012420654f ,-0.151962280f ,-0.221984863f ,-1.031936646f ,
831  0.913055420f , 0.088775635f , 0.140670776f ,-0.009231567f , 0.020690918f ,-0.002883911f , 0.001296997f , 0.000061035f },
832 
833 {-0.000122070f ,-0.002014160f , 0.000869751f ,-0.027725220f ,-0.016708374f ,-0.152069092f ,-0.246505737f ,-1.048156738f ,
834  0.890090942f , 0.069168091f , 0.137298584f ,-0.012115479f , 0.019577026f ,-0.003051758f , 0.001205444f , 0.000045776f ,
835 -0.000137329f ,-0.002120972f , 0.000442505f ,-0.028533936f ,-0.021179199f ,-0.151596069f ,-0.271591187f ,-1.063217163f ,
836  0.866363525f , 0.050354004f , 0.133590698f ,-0.014801025f , 0.018463135f ,-0.003173828f , 0.001113892f , 0.000045776f },
837 
838 {-0.000152588f ,-0.002243042f ,-0.000030518f ,-0.029281616f ,-0.025817871f ,-0.150497437f ,-0.297210693f ,-1.077117920f ,
839  0.841949463f , 0.032379150f , 0.129562378f ,-0.017257690f , 0.017349243f ,-0.003280640f , 0.001037598f , 0.000030518f ,
840 -0.000167847f ,-0.002349854f ,-0.000549316f ,-0.029937744f ,-0.030609131f ,-0.148773193f ,-0.323318481f ,-1.089782715f ,
841  0.816864014f , 0.015228271f , 0.125259399f ,-0.019531250f , 0.016235352f ,-0.003372192f , 0.000961304f , 0.000030518f },
842 
843 {-0.000198364f ,-0.002456665f ,-0.001098633f ,-0.030532837f ,-0.035552979f ,-0.146362305f ,-0.349868774f ,-1.101211548f ,
844  0.791213989f ,-0.001068115f , 0.120697021f ,-0.021575928f , 0.015121460f ,-0.003417969f , 0.000885010f , 0.000030518f ,
845 -0.000213623f ,-0.002578735f ,-0.001693726f ,-0.031005859f ,-0.040634155f ,-0.143264771f ,-0.376800537f ,-1.111373901f ,
846  0.765029907f ,-0.016510010f , 0.115921021f ,-0.023422241f , 0.014022827f ,-0.003463745f , 0.000808716f , 0.000030518f },
847 
848 {-0.000244141f ,-0.002685547f ,-0.002334595f ,-0.031387329f ,-0.045837402f ,-0.139450073f ,-0.404083252f ,-1.120223999f ,
849  0.738372803f ,-0.031082153f , 0.110946655f ,-0.025085449f , 0.012939453f ,-0.003479004f , 0.000747681f , 0.000015259f ,
850 -0.000259399f ,-0.002792358f ,-0.003005981f ,-0.031661987f ,-0.051132202f ,-0.134887695f ,-0.431655884f ,-1.127746582f ,
851  0.711318970f ,-0.044784546f , 0.105819702f ,-0.026535034f , 0.011886597f ,-0.003479004f , 0.000686646f , 0.000015259f },
852 
853 {-0.000289917f ,-0.002899170f ,-0.003723145f ,-0.031814575f ,-0.056533813f ,-0.129577637f ,-0.459472656f ,-1.133926392f ,
854  0.683914185f ,-0.057617187f , 0.100540161f ,-0.027801514f , 0.010848999f ,-0.003463745f , 0.000625610f , 0.000015259f ,
855 -0.000320435f ,-0.002990723f ,-0.004486084f ,-0.031845093f ,-0.061996460f ,-0.123474121f ,-0.487472534f ,-1.138763428f ,
856  0.656219482f ,-0.069595337f , 0.095169067f ,-0.028884888f , 0.009841919f ,-0.003433228f , 0.000579834f , 0.000015259f },
857 
858 {-0.000366211f ,-0.003082275f ,-0.005294800f ,-0.031738281f ,-0.067520142f ,-0.116577148f ,-0.515609741f ,-1.142211914f ,
859  0.628295898f ,-0.080688477f , 0.089706421f ,-0.029785156f , 0.008865356f ,-0.003387451f , 0.000534058f , 0.000015259f ,
860 -0.000396729f ,-0.003173828f ,-0.006118774f ,-0.031478882f ,-0.073059082f ,-0.108856201f ,-0.543823242f ,-1.144287109f ,
861    0.600219727f ,-0.090927124f , 0.084182739f ,-0.030517578f , 0.007919312f ,-0.003326416f , 0.000473022f , 0.000015259f}
862 };
863