2
* mpadec - MPEG audio decoder
3
* Copyright (C) 2002-2004 Dmitriy Startsev (dstartsev@rambler.ru)
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
/* $Id: tables.c,v 1.1.1.1 2004/07/27 02:58:48 metal_man Exp $ */
23
#include "csoundCore.h"
24
#include "mpadec_internal.h"
26
const uint16_t crc_table[256] = {
27
0x0000, 0x8005, 0x800F, 0x000A, 0x801B, 0x001E, 0x0014, 0x8011,
28
0x8033, 0x0036, 0x003C, 0x8039, 0x0028, 0x802D, 0x8027, 0x0022,
29
0x8063, 0x0066, 0x006C, 0x8069, 0x0078, 0x807D, 0x8077, 0x0072,
30
0x0050, 0x8055, 0x805F, 0x005A, 0x804B, 0x004E, 0x0044, 0x8041,
31
0x80C3, 0x00C6, 0x00CC, 0x80C9, 0x00D8, 0x80DD, 0x80D7, 0x00D2,
32
0x00F0, 0x80F5, 0x80FF, 0x00FA, 0x80EB, 0x00EE, 0x00E4, 0x80E1,
33
0x00A0, 0x80A5, 0x80AF, 0x00AA, 0x80BB, 0x00BE, 0x00B4, 0x80B1,
34
0x8093, 0x0096, 0x009C, 0x8099, 0x0088, 0x808D, 0x8087, 0x0082,
35
0x8183, 0x0186, 0x018C, 0x8189, 0x0198, 0x819D, 0x8197, 0x0192,
36
0x01B0, 0x81B5, 0x81BF, 0x01BA, 0x81AB, 0x01AE, 0x01A4, 0x81A1,
37
0x01E0, 0x81E5, 0x81EF, 0x01EA, 0x81FB, 0x01FE, 0x01F4, 0x81F1,
38
0x81D3, 0x01D6, 0x01DC, 0x81D9, 0x01C8, 0x81CD, 0x81C7, 0x01C2,
39
0x0140, 0x8145, 0x814F, 0x014A, 0x815B, 0x015E, 0x0154, 0x8151,
40
0x8173, 0x0176, 0x017C, 0x8179, 0x0168, 0x816D, 0x8167, 0x0162,
41
0x8123, 0x0126, 0x012C, 0x8129, 0x0138, 0x813D, 0x8137, 0x0132,
42
0x0110, 0x8115, 0x811F, 0x011A, 0x810B, 0x010E, 0x0104, 0x8101,
43
0x8303, 0x0306, 0x030C, 0x8309, 0x0318, 0x831D, 0x8317, 0x0312,
44
0x0330, 0x8335, 0x833F, 0x033A, 0x832B, 0x032E, 0x0324, 0x8321,
45
0x0360, 0x8365, 0x836F, 0x036A, 0x837B, 0x037E, 0x0374, 0x8371,
46
0x8353, 0x0356, 0x035C, 0x8359, 0x0348, 0x834D, 0x8347, 0x0342,
47
0x03C0, 0x83C5, 0x83CF, 0x03CA, 0x83DB, 0x03DE, 0x03D4, 0x83D1,
48
0x83F3, 0x03F6, 0x03FC, 0x83F9, 0x03E8, 0x83ED, 0x83E7, 0x03E2,
49
0x83A3, 0x03A6, 0x03AC, 0x83A9, 0x03B8, 0x83BD, 0x83B7, 0x03B2,
50
0x0390, 0x8395, 0x839F, 0x039A, 0x838B, 0x038E, 0x0384, 0x8381,
51
0x0280, 0x8285, 0x828F, 0x028A, 0x829B, 0x029E, 0x0294, 0x8291,
52
0x82B3, 0x02B6, 0x02BC, 0x82B9, 0x02A8, 0x82AD, 0x82A7, 0x02A2,
53
0x82E3, 0x02E6, 0x02EC, 0x82E9, 0x02F8, 0x82FD, 0x82F7, 0x02F2,
54
0x02D0, 0x82D5, 0x82DF, 0x02DA, 0x82CB, 0x02CE, 0x02C4, 0x82C1,
55
0x8243, 0x0246, 0x024C, 0x8249, 0x0258, 0x825D, 0x8257, 0x0252,
56
0x0270, 0x8275, 0x827F, 0x027A, 0x826B, 0x026E, 0x0264, 0x8261,
57
0x0220, 0x8225, 0x822F, 0x022A, 0x823B, 0x023E, 0x0234, 0x8231,
58
0x8213, 0x0216, 0x021C, 0x8219, 0x0208, 0x820D, 0x8207, 0x0202
61
const MYFLT newcos[8] = {
62
0.93969262078590838405410927732473, -0.17364817766693034885171662676931,
63
-0.76604444311897803520239265055542, 0.98480775301220805936674302458952,
64
-0.34202014332566873304409961468226, -0.64278760968653932632264340990726,
65
0.86602540378443864676372317075294, 0.5
68
const MYFLT tfcos36[9] = {
69
0.50190991877167369479228784572231, 0.51763809020504152469779767524810,
70
0.55168895948124587824344735167135, 0.61038729438072803416729403213053,
71
0.70710678118654752440084436210485, 0.87172339781054900991884170836219,
72
1.18310079157624925896683916310440, 1.93185165257813657349948639945780,
73
5.73685662283492756457461251791420
76
const MYFLT tfcos12[3] = {
77
0.5176380902050415246977976752481, 0.70710678118654752440084436210485,
78
1.9318516525781365734994863994578
82
0.85749292571254418689325777610964, 0.88174199731770518177557399759066,
83
0.94962864910273289204833276115398, 0.98331459249179014599030200066392,
84
0.99551781606758576429088040422867, 0.99916055817814750452934664352117,
85
0.99989919524444704626703489425565, 0.99999315507028023572010150517204
89
-0.5144957554275265121359546656657900, -0.4717319685649722722499320887110000,
90
-0.3133774542039018543759498111808100, -0.1819131996109811770082058701228300,
91
-0.0945741925264206476076336384017240, -0.0409655828853040476857032123843680,
92
-0.0141985685724711480569918954984300, -0.0036999746737600368721643755691366
95
bandinfo_t band_info[9] = {
97
{ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162,
98
196, 238, 288, 342, 418, 576 },
99
{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, 12, 16, 20, 24, 28, 34, 42, 50,
101
{ 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 40*3, 52*3, 66*3, 84*3, 106*3,
103
{ 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56 } },
104
{ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156,
105
190, 230, 276, 330, 384, 576 },
106
{ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, 12, 16, 18, 22, 28, 34, 40, 46,
108
{ 0, 4*3, 8*3, 12*3, 16*3, 22*3, 28*3, 38*3, 50*3, 64*3, 80*3, 100*3,
110
{ 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66 } },
111
{ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194,
112
240, 296, 364, 448, 550, 576 },
113
{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, 16, 20, 24, 30, 38, 46, 56, 68,
115
{ 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 42*3, 58*3, 78*3, 104*3, 138*3,
117
{ 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12 } },
119
{ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
120
238, 284, 336, 396, 464, 522, 576 },
121
{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
123
{ 0, 4*3, 8*3, 12*3, 18*3, 24*3, 32*3, 42*3, 56*3, 74*3, 100*3, 132*3,
125
{ 4, 4, 4, 6, 6, 8, 10, 14, 18, 26, 32, 42, 18 } },
126
{ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194,
127
232, 278, 330, 394, 464, 540, 576 },
128
{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 18, 22, 26, 32, 38, 46, 52, 64,
130
{ 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 136*3,
132
{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 32, 44, 12 } },
133
{ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
134
238, 284, 336, 396, 464, 522, 576 },
135
{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
137
{ 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 134*3,
139
{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
141
{ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
142
238, 284, 336, 396, 464, 522, 576 },
143
{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
145
{ 0, 12, 24, 36, 54, 78, 108, 144, 186, 240, 312, 402, 522, 576 },
146
{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
147
{ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
148
238, 284, 336, 396, 464, 522, 576 },
149
{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
151
{ 0, 12, 24, 36, 54, 78, 108, 144, 186, 240, 312, 402, 522, 576 },
152
{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
153
{ { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336,
154
400, 476, 566, 568, 570, 572, 574, 576 },
155
{ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 76, 90,
157
{ 0, 24, 48, 72, 108, 156, 216, 288, 372, 480, 486, 492, 498, 576 },
158
{ 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26 } },
161
static alloc_table_t alloc_0[] = {
162
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
164
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
165
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
167
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
168
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
170
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
171
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31},
173
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
174
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
175
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
176
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
177
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
178
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
179
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
180
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
181
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
182
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
183
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
184
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
185
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
186
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
187
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
188
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
189
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
190
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
191
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
192
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
193
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
194
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
195
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
196
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
197
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
198
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
199
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
200
{2,0}, {5,3}, {7,5}, {16,-32767},
201
{2,0}, {5,3}, {7,5}, {16,-32767},
202
{2,0}, {5,3}, {7,5}, {16,-32767},
203
{2,0}, {5,3}, {7,5}, {16,-32767}
206
static alloc_table_t alloc_1[] = {
207
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
209
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
210
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
212
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
213
{4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
215
{11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
216
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
217
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
218
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
219
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
220
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
221
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
222
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
223
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
224
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
225
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
226
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
227
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
228
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
229
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
230
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
231
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
232
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
233
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
234
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
235
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
236
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
237
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
238
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
239
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
240
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
241
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
242
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
243
{3,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {16,-32767},
244
{2,0}, {5,3}, {7,5}, {16,-32767},
245
{2,0}, {5,3}, {7,5}, {16,-32767},
246
{2,0}, {5,3}, {7,5}, {16,-32767},
247
{2,0}, {5,3}, {7,5}, {16,-32767},
248
{2,0}, {5,3}, {7,5}, {16,-32767},
249
{2,0}, {5,3}, {7,5}, {16,-32767},
250
{2,0}, {5,3}, {7,5}, {16,-32767}
253
static alloc_table_t alloc_2[] = {
254
{4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
256
{10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
257
{4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
259
{10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
260
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
261
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
262
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
263
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
264
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
265
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}
268
static alloc_table_t alloc_3[] = {
269
{4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
271
{10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
272
{4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
274
{10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
275
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
276
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
277
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
278
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
279
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
280
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
281
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
282
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
283
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
284
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}
287
static alloc_table_t alloc_4[] = {
288
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
289
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191},
290
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
291
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191},
292
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
293
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191},
294
{4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
295
{9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191},
296
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
297
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
298
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
299
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
300
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
301
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
302
{3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
303
{2,0}, {5,3}, {7,5}, {10,9},
304
{2,0}, {5,3}, {7,5}, {10,9},
305
{2,0}, {5,3}, {7,5}, {10,9},
306
{2,0}, {5,3}, {7,5}, {10,9},
307
{2,0}, {5,3}, {7,5}, {10,9},
308
{2,0}, {5,3}, {7,5}, {10,9},
309
{2,0}, {5,3}, {7,5}, {10,9},
310
{2,0}, {5,3}, {7,5}, {10,9},
311
{2,0}, {5,3}, {7,5}, {10,9},
312
{2,0}, {5,3}, {7,5}, {10,9},
313
{2,0}, {5,3}, {7,5}, {10,9},
314
{2,0}, {5,3}, {7,5}, {10,9},
315
{2,0}, {5,3}, {7,5}, {10,9},
316
{2,0}, {5,3}, {7,5}, {10,9},
317
{2,0}, {5,3}, {7,5}, {10,9},
318
{2,0}, {5,3}, {7,5}, {10,9},
319
{2,0}, {5,3}, {7,5}, {10,9},
320
{2,0}, {5,3}, {7,5}, {10,9},
321
{2,0}, {5,3}, {7,5}, {10,9}
324
alloc_table_t *alloc_tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 };
326
static int16_t tab0[] = { 0 };
328
static int16_t tab1[] = { -5, -3, -1, 17, 1, 16, 0 };
330
static int16_t tab2[] = {
331
-15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32,
335
static int16_t tab3[] = {
336
-13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32,
340
static int16_t tab5[] = {
341
-29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49,
343
3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17,
348
static int16_t tab6[] = {
349
-25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50,
351
49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1,
356
static int16_t tab7[] = {
357
-69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69,
359
-1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1,
361
80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65,
363
-3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1,
365
-5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0
368
static int16_t tab8[] = {
369
-65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85,
371
-3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1,
373
67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65,
375
64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3,
377
2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0
380
static int16_t tab9[] = {
381
-63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53,
383
84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81,
385
-1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1,
387
-3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3,
389
18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0
392
static int16_t tab10[] = {
393
-125, -121, -111, -83, -55, -35, -21, -13, -7, -3, -1, 119,
395
87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101,
397
-1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11,
399
100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1,
401
-17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82,
403
-1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80,
405
-3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1,
407
50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1,
409
2, 32, 17, -1, 1, 16, 0
412
static int16_t tab11[] = {
413
-121, -113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103,
415
-3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1,
417
-1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83,
419
-1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54,
421
-1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98,
423
6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1,
425
36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64,
427
-1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1,
429
32, 17, -3, -1, 1, 16, 0
432
static int16_t tab12[] = {
433
-115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103,
435
117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55,
437
85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1,
439
112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68,
441
-1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53,
443
82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3,
445
36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11,
447
-1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7,
449
2, 32, 0, 17, -1, 1, 16
452
static int16_t tab13[] = {
453
-509, -503, -475, -405, -333, -265, -205, -153, -115, -83, -53, -35,
455
-7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223,
457
207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1,
459
236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159,
461
234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204,
463
-5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173,
465
203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217,
467
231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202,
469
63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1,
471
-5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11,
473
200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23,
475
240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5,
477
46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1,
479
-1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1,
481
198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1,
483
-1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5,
485
151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7,
487
196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3,
489
28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192,
491
-5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11,
493
-1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1,
495
-11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74,
497
58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3,
499
-3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3,
501
-1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117,
503
131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11,
505
145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114,
507
40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39,
509
-1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3,
511
-1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22,
513
96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5,
515
-7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51,
517
-5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3,
519
-1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1,
524
static int16_t tab15[] = {
525
-495, -445, -355, -263, -183, -115, -77, -43, -27, -13, -7, -3,
527
-1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252,
529
191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1,
531
-1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234,
533
-3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127,
535
-3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3,
537
-3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1,
539
-3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244,
541
216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110,
543
31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186,
545
125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1,
547
-1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1,
549
-1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7,
551
199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1,
553
198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29,
555
-5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3,
557
-1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195,
559
122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91,
561
-7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75,
563
-5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43,
565
-1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3,
567
-1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1,
569
42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7,
571
73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88,
573
-13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1,
575
-3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1,
577
-3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8,
579
-3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39,
581
23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3,
583
-1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53,
585
-5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21,
587
5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1,
589
4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3,
591
34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3,
596
static int16_t tab16[] = {
597
-509, -503, -461, -323, -103, -37, -27, -15, -7, -3, -1, 239,
599
253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1,
601
-1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246,
603
-3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1,
605
-13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1,
607
238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219,
609
-1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3,
611
94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241,
613
-5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157,
615
-1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3,
617
-1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62,
619
214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212,
621
-5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224,
623
-3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7,
625
108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1,
627
153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91,
629
192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3,
631
-1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3,
633
-1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3,
635
-1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90,
637
178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105,
639
164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42,
641
-19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119,
643
-1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3,
645
-1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9,
647
145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21,
649
-1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129,
651
8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39,
653
-1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112,
655
99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1,
657
-5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1,
659
-23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1,
661
-5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19,
663
3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1,
668
static int16_t tab24[] = {
669
-451, -117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223,
671
207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1,
673
-5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95,
675
244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1,
677
240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206,
679
236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234,
681
-1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218,
683
-1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231,
685
-143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141,
687
-1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1,
689
-5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140,
691
78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155,
693
170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124,
695
77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1,
697
-1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1,
699
-1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153,
701
-3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1,
703
167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19,
705
137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3,
707
26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3,
709
144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7,
711
27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1,
713
-1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3,
715
-1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31,
717
-1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25,
719
-1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102,
721
-3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8,
723
101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55,
725
-7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99,
727
-7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6,
729
83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1,
731
80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51,
733
-1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7,
735
3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17,
740
static int16_t tab_c0[] = {
741
-29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3,
743
9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1,
748
static int16_t tab_c1[] = {
749
-15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11,
751
8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3,
756
newhuff_t hufft[] = {
757
{ 0, tab0 }, { 0, tab1 }, { 0, tab2 }, { 0, tab3 },
758
{ 0, tab0 }, { 0, tab5 }, { 0, tab6 }, { 0, tab7 },
759
{ 0, tab8 }, { 0, tab9 }, { 0, tab10 }, { 0, tab11 },
760
{ 0, tab12 }, { 0, tab13 }, { 0, tab0 }, { 0, tab15 },
761
{ 1, tab16 }, { 2, tab16 }, { 3, tab16 }, { 4, tab16 },
762
{ 6, tab16 }, { 8, tab16 }, { 10, tab16 }, { 13, tab16 },
763
{ 4, tab24 }, { 5, tab24 }, { 6, tab24 }, { 7, tab24 },
764
{ 8, tab24 }, { 9, tab24 }, { 11, tab24 }, { 13, tab24 }
767
newhuff_t hufftc[] = { { 0, tab_c0 }, { 0, tab_c1 } };
769
static int32_t intwinbase[] = {
770
0, -1, -1, -1, -1, -1, -1, -2, -2, -2,
771
-2, -3, -3, -4, -4, -5, -5, -6, -7, -7,
772
-8, -9, -10, -11, -13, -14, -16, -17, -19, -21,
773
-24, -26, -29, -31, -35, -38, -41, -45, -49, -53,
774
-58, -63, -68, -73, -79, -85, -91, -97, -104, -111,
775
-117, -125, -132, -139, -147, -154, -161, -169, -176, -183,
776
-190, -196, -202, -208, -213, -218, -222, -225, -227, -228,
777
-228, -227, -224, -221, -215, -208, -200, -189, -177, -163,
778
-146, -127, -106, -83, -57, -29, 2, 36, 72, 111,
779
153, 197, 244, 294, 347, 401, 459, 519, 581, 645,
780
711, 779, 848, 919, 991, 1064, 1137, 1210, 1283, 1356,
781
1428, 1498, 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962,
782
2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063, 2037, 2000,
783
1952, 1893, 1822, 1739, 1644, 1535, 1414, 1280, 1131, 970,
784
794, 605, 402, 185, -45, -288, -545, -814, -1095, -1388,
785
-1692, -2006, -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
786
-5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, -7910, -8209,
787
-8491, -8755, -8998, -9219, -9416, -9585, -9727, -9838, -9916, -9959,
788
-9966, -9935, -9863, -9750, -9592, -9389, -9139, -8840, -8492, -8092,
789
-7640, -7134, -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082,
790
-70, 998, 2122, 3300, 4533, 5818, 7154, 8540, 9975, 11455,
791
12980, 14548, 16155, 17799, 19478, 21189, 22929, 24694, 26482, 28289,
792
30112, 31947, 33791, 35640, 37489, 39336, 41176, 43006, 44821, 46617,
793
48390, 50137, 51853, 53534, 55178, 56778, 58333, 59838, 61289, 62684,
794
64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835,
795
73415, 73908, 74313, 74630, 74856, 74992, 75038
798
static void make_synth_window(mpadec_t mpadec, MYFLT scale)
800
register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
801
register int i, j, k;
804
for (i = 0, j = 0, k = 0; i < 256; i++, j++, k += 32) {
806
mpa->tables.decwin[k] =
807
mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
808
if ((i & 31) == 31) k -= 1023;
809
if ((i & 63) == 63) scale = -scale;
811
for (; i < 512; i++, j--, k += 32) {
813
mpa->tables.decwin[k] =
814
mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
815
if ((i & 31) == 31) k -= 1023;
816
if ((i & 63) == 63) scale = -scale;
820
static void init_limits(mpadec_t mpadec, int32_t sblimit)
822
register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
825
for (i = 0; i < 9; i++) {
826
for (j = 0; j < 23; j++) {
827
mpa->tables.long_limit[i][j] = (band_info[i].long_idx[j] + 7)/SSLIMIT + 1;
828
if (mpa->tables.long_limit[i][j] > sblimit)
829
mpa->tables.long_limit[i][j] = sblimit;
831
for (j = 0; j < 14; j++) {
832
mpa->tables.short_limit[i][j] =
833
(band_info[i].short_idx[j] - 1)/SSLIMIT + 1;
834
if (mpa->tables.short_limit[i][j] > sblimit)
835
mpa->tables.short_limit[i][j] = sblimit;
840
static void init_layer2(mpadec_t mpadec)
842
register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
843
int i, j, k; uint8_t *tab;
844
static MYFLT mulmul[27] = { 0.0, -2.0/3.0, 2.0/3.0, 2.0/7.0, 2.0/15.0,
845
2.0/31.0, 2.0/63.0, 2.0/127.0, 2.0/255.0,
846
2.0/511.0, 2.0/1023.0, 2.0/2047.0, 2.0/4095.0,
847
2.0/8191.0, 2.0/16383.0, 2.0/32767.0, 2.0/65535.0,
848
-4.0/5.0, -2.0/5.0, 2.0/5.0, 4.0/5.0, -8.0/9.0,
849
-4.0/9.0, -2.0/9.0, 2.0/9.0, 4.0/9.0, 8.0/9.0 };
850
static uint8_t base[3][9] = { { 1, 0, 2, }, { 17, 18, 0, 19, 20, },
851
{ 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
853
tab = mpa->tables.grp3tab;
854
for (i = 0; i < 3; i++)
855
for (j = 0; j < 3; j++)
856
for (k = 0; k < 3; k++, tab += 3) {
861
tab = mpa->tables.grp5tab;
862
for (i = 0; i < 5; i++)
863
for (j = 0; j < 5; j++)
864
for (k = 0; k < 5; k++, tab += 3) {
869
tab = mpa->tables.grp9tab;
870
for (i = 0; i < 9; i++)
871
for (j = 0; j < 9; j++)
872
for (k = 0; k < 9; k++, tab += 3) {
877
mpa->tables.mp2tables[0] = mpa->tables.mp2tables[1] =
878
mpa->tables.mp2tables[2] = NULL;
879
mpa->tables.mp2tables[3] = mpa->tables.grp3tab;
880
mpa->tables.mp2tables[4] = NULL;
881
mpa->tables.mp2tables[5] = mpa->tables.grp5tab;
882
mpa->tables.mp2tables[6] = mpa->tables.mp2tables[7] =
883
mpa->tables.mp2tables[8] = NULL;
884
mpa->tables.mp2tables[9] = mpa->tables.grp9tab;
885
for (i = 0; i < 27; i++) {
886
for (j = 0, k = 3; j < 63; j++, k--)
887
mpa->tables.muls[i][j] = mulmul[i]*pow(2.0, (MYFLT)k/3.0);
888
mpa->tables.muls[i][63] = 0.0;
892
static void init_layer3(mpadec_t mpadec)
894
register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
897
for (i = -256; i < 122; i++)
898
mpa->tables.gainpow2[i + 256] = pow(2.0, -0.25*(i + 210));
899
for (i = 0; i < 8207; i++) mpa->tables.ispow[i] = pow(i, 4.0/3.0);
900
for (i = 0; i < 18; i++) {
901
mpa->tables.win[0][0][i] =
902
mpa->tables.win[0][1][i] =
903
0.5*sin((2*i + 1)*M_PI/72.0)/cos((2*i + 19)*M_PI/72.0);
904
mpa->tables.win[0][0][i + 18] =
905
mpa->tables.win[0][3][i + 18] =
906
0.5*sin((2*(i + 18) + 1)*M_PI/72.0)/cos((2*(i + 18) + 19)*M_PI/72.0);
908
for (i = 0; i < 6; i++) {
909
mpa->tables.win[0][1][i + 18] = 0.5/cos((2*(i + 18) + 19)*M_PI/72.0);
910
mpa->tables.win[0][3][i + 12] = 0.5/cos((2*(i + 12) + 19)*M_PI/72.0);
911
mpa->tables.win[0][1][i + 24] =
912
0.5*sin((2*i + 13)*M_PI/24.0)/cos((2*(i + 24) + 19)*M_PI/72.0);
913
mpa->tables.win[0][1][i + 30] = mpa->tables.win[0][3][i] = 0.0;
914
mpa->tables.win[0][3][i + 6] =
915
0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*(i + 6) + 19)*M_PI/72.0);
917
for (i = 0; i < 12; i++) {
918
mpa->tables.win[0][2][i] =
919
0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*i + 7)*M_PI/24.0);
921
for (i = 0; i < 4; i++) {
922
int len = (i == 2) ? 12 : 36;
923
for (j = 0; j < len; j += 2) {
924
mpa->tables.win[1][i][j] = mpa->tables.win[0][i][j];
925
mpa->tables.win[1][i][j + 1] = -mpa->tables.win[0][i][j + 1];
928
for (i = 0; i < 16; i++) {
929
MYFLT tmp = tan(i*M_PI/12.0);
930
mpa->tables.tan1_1[i] = tmp/(1.0 + tmp);
931
mpa->tables.tan2_1[i] = 1.0/(1.0 + tmp);
932
mpa->tables.tan1_2[i] = M_SQRT2*tmp/(1.0 + tmp);
933
mpa->tables.tan2_2[i] = M_SQRT2/(1.0 + tmp);
934
for (j = 0; j < 2; j++) {
935
MYFLT base = pow(2.0, -0.25*(j + 1));
936
MYFLT p1 = 1.0, p2 = 1.0;
938
if (i & 1) p1 = pow(base, 0.5*(i + 1));
939
else p2 = pow(base, 0.5*i);
941
mpa->tables.pow1_1[j][i] = p1;
942
mpa->tables.pow2_1[j][i] = p2;
943
mpa->tables.pow1_2[j][i] = M_SQRT2*p1;
944
mpa->tables.pow2_2[j][i] = M_SQRT2*p2;
947
mpa->tables.istabs[0][0][0] = mpa->tables.tan1_1;
948
mpa->tables.istabs[0][0][1] = mpa->tables.tan2_1;
949
mpa->tables.istabs[0][1][0] = mpa->tables.tan1_2;
950
mpa->tables.istabs[0][1][1] = mpa->tables.tan2_2;
951
mpa->tables.istabs[1][0][0] = mpa->tables.pow1_1[0];
952
mpa->tables.istabs[1][0][1] = mpa->tables.pow2_1[0];
953
mpa->tables.istabs[1][1][0] = mpa->tables.pow1_2[0];
954
mpa->tables.istabs[1][1][1] = mpa->tables.pow2_2[0];
955
mpa->tables.istabs[2][0][0] = mpa->tables.pow1_1[1];
956
mpa->tables.istabs[2][0][1] = mpa->tables.pow2_1[1];
957
mpa->tables.istabs[2][1][0] = mpa->tables.pow1_2[1];
958
mpa->tables.istabs[2][1][1] = mpa->tables.pow2_2[1];
959
for (i = 0; i < 9; i++) {
960
bandinfo_t *bi = &band_info[i];
961
int32_t *mp, cb, lwin; int16_t *bdf;
962
mp = mpa->tables.map[i][0] = mpa->tables.mapbuf0[i];
964
for (cb = 0, j = 0; cb < 8; cb++, j += *bdf++, mp += 4) {
970
bdf = bi->short_diff + 3;
971
for (cb = 3; cb < 13; cb++) {
972
int l = (*bdf++) >> 1;
973
for (lwin = 0; lwin < 3; lwin++, mp += 4) {
981
mpa->tables.mapend[i][0] = mp;
982
mp = mpa->tables.map[i][1] = mpa->tables.mapbuf1[i];
983
bdf = bi->short_diff;
984
for (cb = 0, j = 0; cb < 13; cb++) {
985
int l = (*bdf++) >> 1;
986
for (lwin = 0; lwin < 3; lwin++, mp += 4) {
994
mpa->tables.mapend[i][1] = mp;
995
mp = mpa->tables.map[i][2] = mpa->tables.mapbuf2[i];
997
for (cb = 0; cb < 22; cb++, mp += 2) {
998
mp[0] = (*bdf++) >> 1;
1001
mpa->tables.mapend[i][2] = mp;
1003
for (i = 0; i < 5; i++) {
1004
for (j = 0; j < 6; j++) {
1005
for (k = 0; k < 6; k++) {
1006
register int n = k + 6*j + 36*i;
1007
mpa->tables.i_slen2[n] = i | (j << 3) | (k << 6) | (3 << 12);
1011
for (i = 0; i < 4; i++) {
1012
for (j = 0; j < 4; j++) {
1013
for (k = 0; k < 4; k++) {
1014
register int n = k + 4*j + 16*i;
1015
mpa->tables.i_slen2[n + 180] = i | (j << 3) | (k << 6) | (4 << 12);
1019
for (i = 0; i < 4; i++) {
1020
for (j = 0; j < 3; j++) {
1021
register int n = j + 3*i;
1022
mpa->tables.i_slen2[n + 244] = i | (j << 3) | (5 << 12);
1023
mpa->tables.n_slen2[n + 500] = i | (j << 3) | (2 << 12) | (1 << 15);
1026
for (i = 0; i < 5; i++) {
1027
for (j = 0; j < 5; j++) {
1028
for (k = 0; k < 4; k++) {
1029
for (l = 0; l < 4; l++) {
1030
register int n = l + 4*k + 16*j + 80*i;
1031
mpa->tables.n_slen2[n] = i | (j << 3) | (k << 6) | (l << 9);
1036
for (i = 0; i < 5; i++) {
1037
for (j = 0; j < 5; j++) {
1038
for (k = 0; k < 4; k++) {
1039
register int n = k + 4*j + 20*i;
1040
mpa->tables.n_slen2[n + 400] = i | (j << 3) | (k << 6) | (1 << 12);
1046
void init_tables(mpadec_t mpadec, MYFLT scale, int32_t sblimit)
1048
register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
1050
if (mpa->state < MPADEC_STATE_START) {
1054
init_limits(mpa, sblimit);
1055
make_synth_window(mpa, scale);