2
* 11/19/04 1.0 moved to LGPL.
4
* 18/06/01 Michael Scheerer, Fixed bugs which causes
5
* negative indexes in method huffmann_decode and in method
8
* 16/07/01 Michael Scheerer, Catched a bug in method
9
* huffmann_decode, which causes an outOfIndexException.
10
* Cause : Indexnumber of 24 at SfBandIndex,
11
* which has only a length of 22. I have simply and dirty
12
* fixed the index to <= 22, because I'm not really be able
13
* to fix the bug. The Indexnumber is taken from the MP3
14
* file and the origin Ma-Player with the same code works
17
* 02/19/99 Java Conversion by E.B, javalayer@javazoom.net
18
*-----------------------------------------------------------------------
19
* This program is free software; you can redistribute it and/or modify
20
* it under the terms of the GNU Library General Public License as published
21
* by the Free Software Foundation; either version 2 of the License, or
22
* (at your option) any later version.
24
* This program is distributed in the hope that it will be useful,
25
* but WITHOUT ANY WARRANTY; without even the implied warranty of
26
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
* GNU Library General Public License for more details.
29
* You should have received a copy of the GNU Library General Public
30
* License along with this program; if not, write to the Free Software
31
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32
*----------------------------------------------------------------------
35
package javazoom.jl.decoder;
38
* Class Implementing Layer 3 Decoder.
42
final class LayerIIIDecoder implements FrameDecoder {
43
final double d43 = (4.0 / 3.0);
45
public int[] scalefac_buffer;
47
// MDM: removed, as this wasn't being used.
48
// private float CheckSumOut1d = 0.0f;
49
private int CheckSumHuff = 0;
53
private float[][][] ro;
55
private float[][][] lr;
57
private float[] out_1d;
59
private float[][] prevblck;
63
private int[] nonzero;
65
private Bitstream stream;
67
private Header header;
69
private SynthesisFilter filter1, filter2;
71
private Obuffer buffer;
73
private int which_channels;
75
private BitReserve br;
77
private III_side_info_t si;
79
private temporaire2[] III_scalefac_t;
81
private temporaire2[] scalefac;
83
// private III_scalefac_t scalefac;
87
private int frame_start;
89
private int part2_start;
93
private int first_channel;
95
private int last_channel;
102
// REVIEW: these constructor arguments should be moved to the
103
// decodeFrame() method, where possible, so that one
104
public LayerIIIDecoder(Bitstream stream0, Header header0,
105
SynthesisFilter filtera, SynthesisFilter filterb, Obuffer buffer0,
107
huffcodetab.inithuff();
108
is_1d = new int[SBLIMIT * SSLIMIT + 4];
109
ro = new float[2][SBLIMIT][SSLIMIT];
110
lr = new float[2][SBLIMIT][SSLIMIT];
111
out_1d = new float[SBLIMIT * SSLIMIT];
112
prevblck = new float[2][SBLIMIT * SSLIMIT];
113
k = new float[2][SBLIMIT * SSLIMIT];
114
nonzero = new int[2];
117
III_scalefac_t = new temporaire2[2];
118
III_scalefac_t[0] = new temporaire2();
119
III_scalefac_t[1] = new temporaire2();
120
scalefac = III_scalefac_t;
123
sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
124
int[] l0 = { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140,
125
168, 200, 238, 284, 336, 396, 464, 522, 576 };
126
int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };
127
int[] l1 = { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136,
128
162, 194, 232, 278, 330, 394, 464, 540, 576 };
129
int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };
130
int[] l2 = { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140,
131
168, 200, 238, 284, 336, 396, 464, 522, 576 };
132
int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
134
int[] l3 = { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110,
135
134, 162, 196, 238, 288, 342, 418, 576 };
136
int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };
137
int[] l4 = { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106,
138
128, 156, 190, 230, 276, 330, 384, 576 };
139
int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };
140
int[] l5 = { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126,
141
156, 194, 240, 296, 364, 448, 550, 576 };
142
int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };
144
int[] l6 = { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140,
145
168, 200, 238, 284, 336, 396, 464, 522, 576 };
146
int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
147
int[] l7 = { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140,
148
168, 200, 238, 284, 336, 396, 464, 522, 576 };
149
int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
150
int[] l8 = { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232,
151
280, 336, 400, 476, 566, 568, 570, 572, 574, 576 };
152
int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 };
154
sfBandIndex[0] = new SBI(l0, s0);
155
sfBandIndex[1] = new SBI(l1, s1);
156
sfBandIndex[2] = new SBI(l2, s2);
158
sfBandIndex[3] = new SBI(l3, s3);
159
sfBandIndex[4] = new SBI(l4, s4);
160
sfBandIndex[5] = new SBI(l5, s5);
162
sfBandIndex[6] = new SBI(l6, s6);
163
sfBandIndex[7] = new SBI(l7, s7);
164
sfBandIndex[8] = new SBI(l8, s8);
165
// END OF L3TABLE INIT
167
if (reorder_table == null) { // SZD: generate LUT
168
reorder_table = new int[9][];
169
for (int i = 0; i < 9; i++)
170
reorder_table[i] = reorder(sfBandIndex[i].s);
174
int[] ll0 = { 0, 6, 11, 16, 21 };
175
int[] ss0 = { 0, 6, 12 };
176
sftable = new Sftable(ll0, ss0);
180
scalefac_buffer = new int[54];
181
// END OF scalefac_buffer
188
which_channels = which_ch0;
191
channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
192
max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
194
sfreq = header.sample_frequency()
195
+ ((header.version() == Header.MPEG1) ? 3
196
: (header.version() == Header.MPEG25_LSF) ? 6 : 0); // SZD
199
switch (which_channels) {
200
case OutputChannels.LEFT_CHANNEL:
201
case OutputChannels.DOWNMIX_CHANNELS:
202
first_channel = last_channel = 0;
205
case OutputChannels.RIGHT_CHANNEL:
206
first_channel = last_channel = 1;
209
case OutputChannels.BOTH_CHANNELS:
216
first_channel = last_channel = 0;
219
for (int ch = 0; ch < 2; ch++)
220
for (int j = 0; j < 576; j++)
221
prevblck[ch][j] = 0.0f;
223
nonzero[0] = nonzero[1] = 576;
225
br = new BitReserve();
226
si = new III_side_info_t();
230
* Notify decoder that a seek is being made.
232
public void seek_notify() {
234
for (int ch = 0; ch < 2; ch++)
235
for (int j = 0; j < 576; j++)
236
prevblck[ch][j] = 0.0f;
237
br = new BitReserve();
240
public void decodeFrame() {
245
* Decode one frame, filling the buffer with the output samples.
248
// subband samples are buffered and passed to the
249
// SynthesisFilter in one go.
250
private float[] samples1 = new float[32];
252
private float[] samples2 = new float[32];
254
public void decode() {
255
int nSlots = header.slots();
257
int gr, ch, ss, sb, sb18;
259
int bytes_to_discard;
264
for (i = 0; i < nSlots; i++)
265
br.hputbuf(stream.get_bits(8));
267
main_data_end = br.hsstell() >>> 3; // of previous frame
269
if ((flush_main = (br.hsstell() & 7)) != 0) {
270
br.hgetbits(8 - flush_main);
274
bytes_to_discard = frame_start - main_data_end - si.main_data_begin;
276
frame_start += nSlots;
278
if (bytes_to_discard < 0)
281
if (main_data_end > 4096) {
283
br.rewindNbytes(4096);
286
for (; bytes_to_discard > 0; bytes_to_discard--)
289
for (gr = 0; gr < max_gr; gr++) {
291
for (ch = 0; ch < channels; ch++) {
292
part2_start = br.hsstell();
294
if (header.version() == Header.MPEG1)
295
get_scale_factors(ch, gr);
297
// MPEG-2 LSF, SZD: MPEG-2.5 LSF
298
get_LSF_scale_factors(ch, gr);
300
huffman_decode(ch, gr);
301
// System.out.println("CheckSum HuffMan = " + CheckSumHuff);
302
dequantize_sample(ro[ch], ch, gr);
307
if ((which_channels == OutputChannels.DOWNMIX_CHANNELS)
311
for (ch = first_channel; ch <= last_channel; ch++) {
313
reorder(lr[ch], ch, gr);
315
// for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +
317
// System.out.println("CheckSumOut1d = "+CheckSumOut1d);
321
// for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +
323
// System.out.println("CheckSumOut1d = "+CheckSumOut1d);
325
for (sb18 = 18; sb18 < 576; sb18 += 36)
326
// Frequency inversion
327
for (ss = 1; ss < SSLIMIT; ss += 2)
328
out_1d[sb18 + ss] = -out_1d[sb18 + ss];
331
|| (which_channels == OutputChannels.RIGHT_CHANNEL)) {
332
for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
334
for (sb18 = 0; sb18 < 576; sb18 += 18) {
335
samples1[sb] = out_1d[sb18 + ss];
336
// filter1.input_sample(out_1d[sb18+ss], sb);
339
filter1.input_samples(samples1);
340
filter1.calculate_pcm_samples(buffer);
343
for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
345
for (sb18 = 0; sb18 < 576; sb18 += 18) {
346
samples2[sb] = out_1d[sb18 + ss];
347
// filter2.input_sample(out_1d[sb18+ss], sb);
350
filter2.input_samples(samples2);
351
filter2.calculate_pcm_samples(buffer);
358
// System.out.println("Counter =
359
// ................................."+counter);
360
// if (counter < 609)
363
buffer.write_buffer(1);
365
// else if (counter == 609)
377
* Reads the side info from the stream, assuming the entire. frame has been
378
* read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)
380
private boolean get_side_info() {
382
if (header.version() == Header.MPEG1) {
384
si.main_data_begin = stream.get_bits(9);
386
si.private_bits = stream.get_bits(5);
388
si.private_bits = stream.get_bits(3);
390
for (ch = 0; ch < channels; ch++) {
391
si.ch[ch].scfsi[0] = stream.get_bits(1);
392
si.ch[ch].scfsi[1] = stream.get_bits(1);
393
si.ch[ch].scfsi[2] = stream.get_bits(1);
394
si.ch[ch].scfsi[3] = stream.get_bits(1);
397
for (gr = 0; gr < 2; gr++) {
398
for (ch = 0; ch < channels; ch++) {
399
si.ch[ch].gr[gr].part2_3_length = stream.get_bits(12);
400
si.ch[ch].gr[gr].big_values = stream.get_bits(9);
401
si.ch[ch].gr[gr].global_gain = stream.get_bits(8);
402
si.ch[ch].gr[gr].scalefac_compress = stream.get_bits(4);
403
si.ch[ch].gr[gr].window_switching_flag = stream.get_bits(1);
404
if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {
405
si.ch[ch].gr[gr].block_type = stream.get_bits(2);
406
si.ch[ch].gr[gr].mixed_block_flag = stream.get_bits(1);
408
si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);
409
si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);
411
si.ch[ch].gr[gr].subblock_gain[0] = stream.get_bits(3);
412
si.ch[ch].gr[gr].subblock_gain[1] = stream.get_bits(3);
413
si.ch[ch].gr[gr].subblock_gain[2] = stream.get_bits(3);
415
// Set region_count parameters since they are implicit
418
if (si.ch[ch].gr[gr].block_type == 0) {
419
// Side info bad: block_type == 0 in split block
421
} else if (si.ch[ch].gr[gr].block_type == 2
422
&& si.ch[ch].gr[gr].mixed_block_flag == 0) {
423
si.ch[ch].gr[gr].region0_count = 8;
425
si.ch[ch].gr[gr].region0_count = 7;
427
si.ch[ch].gr[gr].region1_count = 20 - si.ch[ch].gr[gr].region0_count;
429
si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);
430
si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);
431
si.ch[ch].gr[gr].table_select[2] = stream.get_bits(5);
432
si.ch[ch].gr[gr].region0_count = stream.get_bits(4);
433
si.ch[ch].gr[gr].region1_count = stream.get_bits(3);
434
si.ch[ch].gr[gr].block_type = 0;
436
si.ch[ch].gr[gr].preflag = stream.get_bits(1);
437
si.ch[ch].gr[gr].scalefac_scale = stream.get_bits(1);
438
si.ch[ch].gr[gr].count1table_select = stream.get_bits(1);
442
} else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF
444
si.main_data_begin = stream.get_bits(8);
446
si.private_bits = stream.get_bits(1);
448
si.private_bits = stream.get_bits(2);
450
for (ch = 0; ch < channels; ch++) {
452
si.ch[ch].gr[0].part2_3_length = stream.get_bits(12);
453
si.ch[ch].gr[0].big_values = stream.get_bits(9);
454
si.ch[ch].gr[0].global_gain = stream.get_bits(8);
455
si.ch[ch].gr[0].scalefac_compress = stream.get_bits(9);
456
si.ch[ch].gr[0].window_switching_flag = stream.get_bits(1);
458
if ((si.ch[ch].gr[0].window_switching_flag) != 0) {
460
si.ch[ch].gr[0].block_type = stream.get_bits(2);
461
si.ch[ch].gr[0].mixed_block_flag = stream.get_bits(1);
462
si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
463
si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);
465
si.ch[ch].gr[0].subblock_gain[0] = stream.get_bits(3);
466
si.ch[ch].gr[0].subblock_gain[1] = stream.get_bits(3);
467
si.ch[ch].gr[0].subblock_gain[2] = stream.get_bits(3);
469
// Set region_count parameters since they are implicit in
472
if (si.ch[ch].gr[0].block_type == 0) {
473
// Side info bad: block_type == 0 in split block
475
} else if (si.ch[ch].gr[0].block_type == 2
476
&& si.ch[ch].gr[0].mixed_block_flag == 0) {
477
si.ch[ch].gr[0].region0_count = 8;
479
si.ch[ch].gr[0].region0_count = 7;
480
si.ch[ch].gr[0].region1_count = 20 - si.ch[ch].gr[0].region0_count;
484
si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
485
si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);
486
si.ch[ch].gr[0].table_select[2] = stream.get_bits(5);
487
si.ch[ch].gr[0].region0_count = stream.get_bits(4);
488
si.ch[ch].gr[0].region1_count = stream.get_bits(3);
489
si.ch[ch].gr[0].block_type = 0;
492
si.ch[ch].gr[0].scalefac_scale = stream.get_bits(1);
493
si.ch[ch].gr[0].count1table_select = stream.get_bits(1);
494
} // for(ch=0; ch<channels; ch++)
495
} // if (header.version() == MPEG1)
502
private void get_scale_factors(int ch, int gr) {
504
gr_info_s gr_info = (si.ch[ch].gr[gr]);
505
int scale_comp = gr_info.scalefac_compress;
506
int length0 = slen[0][scale_comp];
507
int length1 = slen[1][scale_comp];
509
if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
510
if ((gr_info.mixed_block_flag) != 0) { // MIXED
511
for (sfb = 0; sfb < 8; sfb++)
512
scalefac[ch].l[sfb] = br
513
.hgetbits(slen[0][gr_info.scalefac_compress]);
514
for (sfb = 3; sfb < 6; sfb++)
515
for (window = 0; window < 3; window++)
516
scalefac[ch].s[window][sfb] = br
517
.hgetbits(slen[0][gr_info.scalefac_compress]);
518
for (sfb = 6; sfb < 12; sfb++)
519
for (window = 0; window < 3; window++)
520
scalefac[ch].s[window][sfb] = br
521
.hgetbits(slen[1][gr_info.scalefac_compress]);
522
for (sfb = 12, window = 0; window < 3; window++)
523
scalefac[ch].s[window][sfb] = 0;
527
scalefac[ch].s[0][0] = br.hgetbits(length0);
528
scalefac[ch].s[1][0] = br.hgetbits(length0);
529
scalefac[ch].s[2][0] = br.hgetbits(length0);
530
scalefac[ch].s[0][1] = br.hgetbits(length0);
531
scalefac[ch].s[1][1] = br.hgetbits(length0);
532
scalefac[ch].s[2][1] = br.hgetbits(length0);
533
scalefac[ch].s[0][2] = br.hgetbits(length0);
534
scalefac[ch].s[1][2] = br.hgetbits(length0);
535
scalefac[ch].s[2][2] = br.hgetbits(length0);
536
scalefac[ch].s[0][3] = br.hgetbits(length0);
537
scalefac[ch].s[1][3] = br.hgetbits(length0);
538
scalefac[ch].s[2][3] = br.hgetbits(length0);
539
scalefac[ch].s[0][4] = br.hgetbits(length0);
540
scalefac[ch].s[1][4] = br.hgetbits(length0);
541
scalefac[ch].s[2][4] = br.hgetbits(length0);
542
scalefac[ch].s[0][5] = br.hgetbits(length0);
543
scalefac[ch].s[1][5] = br.hgetbits(length0);
544
scalefac[ch].s[2][5] = br.hgetbits(length0);
545
scalefac[ch].s[0][6] = br.hgetbits(length1);
546
scalefac[ch].s[1][6] = br.hgetbits(length1);
547
scalefac[ch].s[2][6] = br.hgetbits(length1);
548
scalefac[ch].s[0][7] = br.hgetbits(length1);
549
scalefac[ch].s[1][7] = br.hgetbits(length1);
550
scalefac[ch].s[2][7] = br.hgetbits(length1);
551
scalefac[ch].s[0][8] = br.hgetbits(length1);
552
scalefac[ch].s[1][8] = br.hgetbits(length1);
553
scalefac[ch].s[2][8] = br.hgetbits(length1);
554
scalefac[ch].s[0][9] = br.hgetbits(length1);
555
scalefac[ch].s[1][9] = br.hgetbits(length1);
556
scalefac[ch].s[2][9] = br.hgetbits(length1);
557
scalefac[ch].s[0][10] = br.hgetbits(length1);
558
scalefac[ch].s[1][10] = br.hgetbits(length1);
559
scalefac[ch].s[2][10] = br.hgetbits(length1);
560
scalefac[ch].s[0][11] = br.hgetbits(length1);
561
scalefac[ch].s[1][11] = br.hgetbits(length1);
562
scalefac[ch].s[2][11] = br.hgetbits(length1);
563
scalefac[ch].s[0][12] = 0;
564
scalefac[ch].s[1][12] = 0;
565
scalefac[ch].s[2][12] = 0;
568
} else { // LONG types 0,1,3
570
if ((si.ch[ch].scfsi[0] == 0) || (gr == 0)) {
571
scalefac[ch].l[0] = br.hgetbits(length0);
572
scalefac[ch].l[1] = br.hgetbits(length0);
573
scalefac[ch].l[2] = br.hgetbits(length0);
574
scalefac[ch].l[3] = br.hgetbits(length0);
575
scalefac[ch].l[4] = br.hgetbits(length0);
576
scalefac[ch].l[5] = br.hgetbits(length0);
578
if ((si.ch[ch].scfsi[1] == 0) || (gr == 0)) {
579
scalefac[ch].l[6] = br.hgetbits(length0);
580
scalefac[ch].l[7] = br.hgetbits(length0);
581
scalefac[ch].l[8] = br.hgetbits(length0);
582
scalefac[ch].l[9] = br.hgetbits(length0);
583
scalefac[ch].l[10] = br.hgetbits(length0);
585
if ((si.ch[ch].scfsi[2] == 0) || (gr == 0)) {
586
scalefac[ch].l[11] = br.hgetbits(length1);
587
scalefac[ch].l[12] = br.hgetbits(length1);
588
scalefac[ch].l[13] = br.hgetbits(length1);
589
scalefac[ch].l[14] = br.hgetbits(length1);
590
scalefac[ch].l[15] = br.hgetbits(length1);
592
if ((si.ch[ch].scfsi[3] == 0) || (gr == 0)) {
593
scalefac[ch].l[16] = br.hgetbits(length1);
594
scalefac[ch].l[17] = br.hgetbits(length1);
595
scalefac[ch].l[18] = br.hgetbits(length1);
596
scalefac[ch].l[19] = br.hgetbits(length1);
597
scalefac[ch].l[20] = br.hgetbits(length1);
600
scalefac[ch].l[21] = 0;
601
scalefac[ch].l[22] = 0;
608
// MDM: new_slen is fully initialized before use, no need
609
// to reallocate array.
610
private final int[] new_slen = new int[4];
612
private void get_LSF_scale_data(int ch, int gr) {
614
int scalefac_comp, int_scalefac_comp;
615
int mode_ext = header.mode_extension();
620
gr_info_s gr_info = (si.ch[ch].gr[gr]);
622
scalefac_comp = gr_info.scalefac_compress;
624
if (gr_info.block_type == 2) {
625
if (gr_info.mixed_block_flag == 0)
627
else if (gr_info.mixed_block_flag == 1)
635
if (!(((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
637
if (scalefac_comp < 400) {
639
new_slen[0] = (scalefac_comp >>> 4) / 5;
640
new_slen[1] = (scalefac_comp >>> 4) % 5;
641
new_slen[2] = (scalefac_comp & 0xF) >>> 2;
642
new_slen[3] = (scalefac_comp & 3);
643
si.ch[ch].gr[gr].preflag = 0;
646
} else if (scalefac_comp < 500) {
648
new_slen[0] = ((scalefac_comp - 400) >>> 2) / 5;
649
new_slen[1] = ((scalefac_comp - 400) >>> 2) % 5;
650
new_slen[2] = (scalefac_comp - 400) & 3;
652
si.ch[ch].gr[gr].preflag = 0;
655
} else if (scalefac_comp < 512) {
657
new_slen[0] = (scalefac_comp - 500) / 3;
658
new_slen[1] = (scalefac_comp - 500) % 3;
661
si.ch[ch].gr[gr].preflag = 1;
666
if ((((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
667
int_scalefac_comp = scalefac_comp >>> 1;
669
if (int_scalefac_comp < 180) {
670
new_slen[0] = int_scalefac_comp / 36;
671
new_slen[1] = (int_scalefac_comp % 36) / 6;
672
new_slen[2] = (int_scalefac_comp % 36) % 6;
674
si.ch[ch].gr[gr].preflag = 0;
676
} else if (int_scalefac_comp < 244) {
677
new_slen[0] = ((int_scalefac_comp - 180) & 0x3F) >>> 4;
678
new_slen[1] = ((int_scalefac_comp - 180) & 0xF) >>> 2;
679
new_slen[2] = (int_scalefac_comp - 180) & 3;
681
si.ch[ch].gr[gr].preflag = 0;
683
} else if (int_scalefac_comp < 255) {
684
new_slen[0] = (int_scalefac_comp - 244) / 3;
685
new_slen[1] = (int_scalefac_comp - 244) % 3;
688
si.ch[ch].gr[gr].preflag = 0;
693
for (int x = 0; x < 45; x++)
695
scalefac_buffer[x] = 0;
698
for (int i = 0; i < 4; i++) {
699
for (int j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++) {
700
scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br
701
.hgetbits(new_slen[i]);
704
} // for (unint32 j ...
705
} // for (uint32 i ...
711
private void get_LSF_scale_factors(int ch, int gr) {
714
gr_info_s gr_info = (si.ch[ch].gr[gr]);
716
get_LSF_scale_data(ch, gr);
718
if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
719
if (gr_info.mixed_block_flag != 0) { // MIXED
720
for (sfb = 0; sfb < 8; sfb++) {
721
scalefac[ch].l[sfb] = scalefac_buffer[m];
724
for (sfb = 3; sfb < 12; sfb++) {
725
for (window = 0; window < 3; window++) {
726
scalefac[ch].s[window][sfb] = scalefac_buffer[m];
730
for (window = 0; window < 3; window++)
731
scalefac[ch].s[window][12] = 0;
735
for (sfb = 0; sfb < 12; sfb++) {
736
for (window = 0; window < 3; window++) {
737
scalefac[ch].s[window][sfb] = scalefac_buffer[m];
742
for (window = 0; window < 3; window++)
743
scalefac[ch].s[window][12] = 0;
745
} else { // LONG types 0,1,3
747
for (sfb = 0; sfb < 21; sfb++) {
748
scalefac[ch].l[sfb] = scalefac_buffer[m];
751
scalefac[ch].l[21] = 0; // Jeff
752
scalefac[ch].l[22] = 0;
767
private void huffman_decode(int ch, int gr) {
773
int part2_3_end = part2_start + si.ch[ch].gr[gr].part2_3_length;
783
// Find region boundary for short block case
785
if (((si.ch[ch].gr[gr].window_switching_flag) != 0)
786
&& (si.ch[ch].gr[gr].block_type == 2)) {
789
// MS: Extrahandling for 8KHZ
790
region1Start = (sfreq == 8) ? 72 : 36; // sfb[9/3]*3=36 or in case
792
region2Start = 576; // No Region2 for short block case
794
} else { // Find region boundary for long block case
796
buf = si.ch[ch].gr[gr].region0_count + 1;
797
buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;
799
if (buf1 > sfBandIndex[sfreq].l.length - 1)
800
buf1 = sfBandIndex[sfreq].l.length - 1;
802
region1Start = sfBandIndex[sfreq].l[buf];
803
region2Start = sfBandIndex[sfreq].l[buf1]; /* MI */
807
// Read bigvalues area
808
for (int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i += 2) {
809
if (i < region1Start)
810
h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
811
else if (i < region2Start)
812
h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];
814
h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];
816
huffcodetab.huffman_decoder(h, x, y, v, w, br);
817
// if (index >= is_1d.length)
818
// System.out.println("i0="+i+"/"+(si.ch[ch].gr[gr].big_values<<1)+"
819
// Index="+index+" is_1d="+is_1d.length);
821
is_1d[index++] = x[0];
822
is_1d[index++] = y[0];
824
CheckSumHuff = CheckSumHuff + x[0] + y[0];
825
// System.out.println("x = "+x[0]+" y = "+y[0]);
829
h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
830
num_bits = br.hsstell();
832
while ((num_bits < part2_3_end) && (index < 576)) {
834
huffcodetab.huffman_decoder(h, x, y, v, w, br);
836
is_1d[index++] = v[0];
837
is_1d[index++] = w[0];
838
is_1d[index++] = x[0];
839
is_1d[index++] = y[0];
840
CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];
841
// System.out.println("v = "+v[0]+" w = "+w[0]);
842
// System.out.println("x = "+x[0]+" y = "+y[0]);
843
num_bits = br.hsstell();
846
if (num_bits > part2_3_end) {
847
br.rewindNbits(num_bits - part2_3_end);
851
num_bits = br.hsstell();
853
// Dismiss stuffing bits
854
if (num_bits < part2_3_end)
855
br.hgetbits(part2_3_end - num_bits);
867
// may not be necessary
868
for (; index < 576; index++)
875
private void i_stereo_k_values(int is_pos, int io_type, int i) {
879
} else if ((is_pos & 1) != 0) {
880
k[0][i] = io[io_type][(is_pos + 1) >>> 1];
884
k[1][i] = io[io_type][is_pos >>> 1];
891
private void dequantize_sample(float xr[][], int ch, int gr) {
892
gr_info_s gr_info = (si.ch[ch].gr[gr]);
894
int next_cb_boundary;
897
int index = 0, t_index, j;
899
float[][] xr_1d = xr;
901
// choose correct scalefactor band per block type, initalize boundary
903
if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
904
if (gr_info.mixed_block_flag != 0)
905
next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks:
908
cb_width = sfBandIndex[sfreq].s[1];
909
next_cb_boundary = (cb_width << 2) - cb_width;
913
next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
916
// Compute overall (global) scaling.
918
g_gain = (float) Math.pow(2.0, (0.25 * (gr_info.global_gain - 210.0)));
920
for (j = 0; j < nonzero[ch]; j++) {
921
// Modif E.B 02/22/99
922
int reste = j % SSLIMIT;
923
int quotien = (int) ((j - reste) / SSLIMIT);
925
xr_1d[quotien][reste] = 0.0f;
928
// Pow Array fix (11/17/04)
929
if (abv < t_43.length) {
931
xr_1d[quotien][reste] = g_gain * t_43[abv];
933
if (-abv < t_43.length)
934
xr_1d[quotien][reste] = -g_gain * t_43[-abv];
936
xr_1d[quotien][reste] = -g_gain
937
* (float) Math.pow(-abv, d43);
941
xr_1d[quotien][reste] = g_gain
942
* (float) Math.pow(abv, d43);
944
xr_1d[quotien][reste] = -g_gain
945
* (float) Math.pow(-abv, d43);
950
// apply formula per block type
951
for (j = 0; j < nonzero[ch]; j++) {
952
// Modif E.B 02/22/99
953
int reste = j % SSLIMIT;
954
int quotien = (int) ((j - reste) / SSLIMIT);
956
if (index == next_cb_boundary) { /* Adjust critical band boundary */
957
if ((gr_info.window_switching_flag != 0)
958
&& (gr_info.block_type == 2)) {
959
if (gr_info.mixed_block_flag != 0) {
961
if (index == sfBandIndex[sfreq].l[8]) {
962
next_cb_boundary = sfBandIndex[sfreq].s[4];
963
next_cb_boundary = (next_cb_boundary << 2)
966
cb_width = sfBandIndex[sfreq].s[4]
967
- sfBandIndex[sfreq].s[3];
969
cb_begin = sfBandIndex[sfreq].s[3];
970
cb_begin = (cb_begin << 2) - cb_begin;
972
} else if (index < sfBandIndex[sfreq].l[8]) {
974
next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
978
next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
979
next_cb_boundary = (next_cb_boundary << 2)
982
cb_begin = sfBandIndex[sfreq].s[cb];
983
cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
984
cb_begin = (cb_begin << 2) - cb_begin;
989
next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
990
next_cb_boundary = (next_cb_boundary << 2)
993
cb_begin = sfBandIndex[sfreq].s[cb];
994
cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
995
cb_begin = (cb_begin << 2) - cb_begin;
998
} else { // long blocks
1000
next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
1005
// Do long/short dependent scaling operations
1007
if ((gr_info.window_switching_flag != 0)
1008
&& (((gr_info.block_type == 2) && (gr_info.mixed_block_flag == 0)) || ((gr_info.block_type == 2)
1009
&& (gr_info.mixed_block_flag != 0) && (j >= 36)))) {
1011
t_index = (index - cb_begin) / cb_width;
1013
* xr[sb][ss] *= pow(2.0, ((-2.0 *
1014
* gr_info.subblock_gain[t_index]) -(0.5 * (1.0 +
1015
* gr_info.scalefac_scale) scalefac[ch].s[t_index][cb])));
1017
int idx = scalefac[ch].s[t_index][cb] << gr_info.scalefac_scale;
1018
idx += (gr_info.subblock_gain[t_index] << 2);
1020
xr_1d[quotien][reste] *= two_to_negative_half_pow[idx];
1022
} else { // LONG block types 0,1,3 & 1st 2 subbands of switched
1025
* xr[sb][ss] *= pow(2.0, -0.5 * (1.0+gr_info.scalefac_scale)
1026
* (scalefac[ch].l[cb] + gr_info.preflag * pretab[cb]));
1028
int idx = scalefac[ch].l[cb];
1030
if (gr_info.preflag != 0)
1033
idx = idx << gr_info.scalefac_scale;
1034
xr_1d[quotien][reste] *= two_to_negative_half_pow[idx];
1039
for (j = nonzero[ch]; j < 576; j++) {
1040
// Modif E.B 02/22/99
1041
int reste = j % SSLIMIT;
1042
int quotien = (int) ((j - reste) / SSLIMIT);
1047
xr_1d[quotien][reste] = 0.0f;
1056
private void reorder(float xr[][], int ch, int gr) {
1057
gr_info_s gr_info = (si.ch[ch].gr[gr]);
1060
int sfb, sfb_start, sfb_lines;
1061
int src_line, des_line;
1062
float[][] xr_1d = xr;
1064
if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
1066
for (index = 0; index < 576; index++)
1067
out_1d[index] = 0.0f;
1069
if (gr_info.mixed_block_flag != 0) {
1070
// NO REORDER FOR LOW 2 SUBBANDS
1071
for (index = 0; index < 36; index++) {
1072
// Modif E.B 02/22/99
1073
int reste = index % SSLIMIT;
1074
int quotien = (int) ((index - reste) / SSLIMIT);
1075
out_1d[index] = xr_1d[quotien][reste];
1077
// REORDERING FOR REST SWITCHED SHORT
1079
* for( sfb=3,sfb_start=sfBandIndex[sfreq].s[3],
1080
* sfb_lines=sfBandIndex[sfreq].s[4] - sfb_start; sfb < 13;
1081
* sfb++,sfb_start = sfBandIndex[sfreq].s[sfb], sfb_lines =
1082
* sfBandIndex[sfreq].s[sfb+1] - sfb_start ) {
1084
for (sfb = 3; sfb < 13; sfb++) {
1085
// System.out.println("sfreq="+sfreq+" sfb="+sfb+"
1086
// sfBandIndex="+sfBandIndex.length+"
1087
// sfBandIndex[sfreq].s="+sfBandIndex[sfreq].s.length);
1088
sfb_start = sfBandIndex[sfreq].s[sfb];
1089
sfb_lines = sfBandIndex[sfreq].s[sfb + 1] - sfb_start;
1091
int sfb_start3 = (sfb_start << 2) - sfb_start;
1093
for (freq = 0, freq3 = 0; freq < sfb_lines; freq++, freq3 += 3) {
1095
src_line = sfb_start3 + freq;
1096
des_line = sfb_start3 + freq3;
1097
// Modif E.B 02/22/99
1098
int reste = src_line % SSLIMIT;
1099
int quotien = (int) ((src_line - reste) / SSLIMIT);
1101
out_1d[des_line] = xr_1d[quotien][reste];
1102
src_line += sfb_lines;
1105
reste = src_line % SSLIMIT;
1106
quotien = (int) ((src_line - reste) / SSLIMIT);
1108
out_1d[des_line] = xr_1d[quotien][reste];
1109
src_line += sfb_lines;
1112
reste = src_line % SSLIMIT;
1113
quotien = (int) ((src_line - reste) / SSLIMIT);
1115
out_1d[des_line] = xr_1d[quotien][reste];
1119
} else { // pure short
1120
for (index = 0; index < 576; index++) {
1121
int j = reorder_table[sfreq][index];
1122
int reste = j % SSLIMIT;
1123
int quotien = (int) ((j - reste) / SSLIMIT);
1124
out_1d[index] = xr_1d[quotien][reste];
1127
} else { // long blocks
1128
for (index = 0; index < 576; index++) {
1129
// Modif E.B 02/22/99
1130
int reste = index % SSLIMIT;
1131
int quotien = (int) ((index - reste) / SSLIMIT);
1132
out_1d[index] = xr_1d[quotien][reste];
1141
int[] is_pos = new int[576];
1143
float[] is_ratio = new float[576];
1145
private void stereo(int gr) {
1148
if (channels == 1) { // mono , bypass xr[0][][] to lr[0][][]
1150
for (sb = 0; sb < SBLIMIT; sb++)
1151
for (ss = 0; ss < SSLIMIT; ss += 3) {
1152
lr[0][sb][ss] = ro[0][sb][ss];
1153
lr[0][sb][ss + 1] = ro[0][sb][ss + 1];
1154
lr[0][sb][ss + 2] = ro[0][sb][ss + 2];
1159
gr_info_s gr_info = (si.ch[0].gr[gr]);
1160
int mode_ext = header.mode_extension();
1163
int lines, temp, temp2;
1165
boolean ms_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x2) != 0));
1166
boolean i_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x1) != 0));
1167
boolean lsf = ((header.version() == Header.MPEG2_LSF || header
1168
.version() == Header.MPEG25_LSF)); // SZD
1170
int io_type = (gr_info.scalefac_compress & 1);
1174
for (i = 0; i < 576; i++) {
1181
if ((gr_info.window_switching_flag != 0)
1182
&& (gr_info.block_type == 2)) {
1183
if (gr_info.mixed_block_flag != 0) {
1187
for (int j = 0; j < 3; j++) {
1190
for (sfb = 12; sfb >= 3; sfb--) {
1191
i = sfBandIndex[sfreq].s[sfb];
1192
lines = sfBandIndex[sfreq].s[sfb + 1] - i;
1193
i = (i << 2) - i + (j + 1) * lines - 1;
1196
if (ro[1][i / 18][i % 18] != 0.0f) {
1197
// MDM: in java, array access is very
1199
// Is quicker to compute div and mod
1201
// if (ro[1][ss_div[i]][ss_mod[i]] !=
1211
} // while (lines > 0)
1213
} // for (sfb=12 ...
1220
temp = sfBandIndex[sfreq].s[sfb];
1221
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
1222
i = (temp << 2) - temp + j * sb;
1224
for (; sb > 0; sb--) {
1225
is_pos[i] = scalefac[1].s[j][sfb];
1228
i_stereo_k_values(is_pos[i],
1231
is_ratio[i] = TAN12[is_pos[i]];
1236
} // while (sfb < 12)
1237
sfb = sfBandIndex[sfreq].s[10];
1238
sb = sfBandIndex[sfreq].s[11] - sfb;
1239
sfb = (sfb << 2) - sfb + j * sb;
1240
temp = sfBandIndex[sfreq].s[11];
1241
sb = sfBandIndex[sfreq].s[12] - temp;
1242
i = (temp << 2) - temp + j * sb;
1244
for (; sb > 0; sb--) {
1245
is_pos[i] = is_pos[sfb];
1248
k[0][i] = k[0][sfb];
1249
k[1][i] = k[1][sfb];
1251
is_ratio[i] = is_ratio[sfb];
1254
} // for (; sb > 0 ...
1261
if (ro[1][i][ss] != 0.0f) {
1262
sb = (i << 4) + (i << 1) + ss;
1273
while (sfBandIndex[sfreq].l[i] <= sb)
1276
i = sfBandIndex[sfreq].l[i];
1277
for (; sfb < 8; sfb++) {
1278
sb = sfBandIndex[sfreq].l[sfb + 1]
1279
- sfBandIndex[sfreq].l[sfb];
1280
for (; sb > 0; sb--) {
1281
is_pos[i] = scalefac[1].l[sfb];
1284
i_stereo_k_values(is_pos[i],
1287
is_ratio[i] = TAN12[is_pos[i]];
1289
} // for (; sb>0 ...
1290
} // for (; sfb<8 ...
1292
} else { // if (gr_info.mixed_block_flag)
1293
for (int j = 0; j < 3; j++) {
1296
for (sfb = 12; sfb >= 0; sfb--) {
1297
temp = sfBandIndex[sfreq].s[sfb];
1298
lines = sfBandIndex[sfreq].s[sfb + 1] - temp;
1299
i = (temp << 2) - temp + (j + 1) * lines - 1;
1302
if (ro[1][i / 18][i % 18] != 0.0f) {
1303
// MDM: in java, array access is very
1305
// Is quicker to compute div and mod
1307
// if (ro[1][ss_div[i]][ss_mod[i]] !=
1315
} // while (lines > 0) */
1317
} // for (sfb=12 ...
1320
temp = sfBandIndex[sfreq].s[sfb];
1321
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
1322
i = (temp << 2) - temp + j * sb;
1323
for (; sb > 0; sb--) {
1324
is_pos[i] = scalefac[1].s[j][sfb];
1327
i_stereo_k_values(is_pos[i],
1330
is_ratio[i] = TAN12[is_pos[i]];
1332
} // for (; sb>0 ...
1336
temp = sfBandIndex[sfreq].s[10];
1337
temp2 = sfBandIndex[sfreq].s[11];
1339
sfb = (temp << 2) - temp + j * sb;
1340
sb = sfBandIndex[sfreq].s[12] - temp2;
1341
i = (temp2 << 2) - temp2 + j * sb;
1343
for (; sb > 0; sb--) {
1344
is_pos[i] = is_pos[sfb];
1347
k[0][i] = k[0][sfb];
1348
k[1][i] = k[1][sfb];
1350
is_ratio[i] = is_ratio[sfb];
1353
} // for (; sb>0 ...
1356
} else { // if (gr_info.window_switching_flag ...
1361
if (ro[1][i][ss] != 0.0f) {
1362
sb = (i << 4) + (i << 1) + ss;
1373
while (sfBandIndex[sfreq].l[i] <= sb)
1377
i = sfBandIndex[sfreq].l[i];
1378
for (; sfb < 21; sfb++) {
1379
sb = sfBandIndex[sfreq].l[sfb + 1]
1380
- sfBandIndex[sfreq].l[sfb];
1381
for (; sb > 0; sb--) {
1382
is_pos[i] = scalefac[1].l[sfb];
1385
i_stereo_k_values(is_pos[i], io_type, i);
1387
is_ratio[i] = TAN12[is_pos[i]];
1391
sfb = sfBandIndex[sfreq].l[20];
1392
for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0)
1393
&& (i < 576); sb--) {
1394
is_pos[i] = is_pos[sfb]; // error here : i >=576
1397
k[0][i] = k[0][sfb];
1398
k[1][i] = k[1][sfb];
1400
is_ratio[i] = is_ratio[sfb];
1403
} // if (gr_info.mixed_block_flag)
1404
} // if (gr_info.window_switching_flag ...
1408
for (sb = 0; sb < SBLIMIT; sb++)
1409
for (ss = 0; ss < SSLIMIT; ss++) {
1410
if (is_pos[i] == 7) {
1412
lr[0][sb][ss] = (ro[0][sb][ss] + ro[1][sb][ss]) * 0.707106781f;
1413
lr[1][sb][ss] = (ro[0][sb][ss] - ro[1][sb][ss]) * 0.707106781f;
1415
lr[0][sb][ss] = ro[0][sb][ss];
1416
lr[1][sb][ss] = ro[1][sb][ss];
1418
} else if (i_stereo) {
1421
lr[0][sb][ss] = ro[0][sb][ss] * k[0][i];
1422
lr[1][sb][ss] = ro[0][sb][ss] * k[1][i];
1424
lr[1][sb][ss] = ro[0][sb][ss]
1425
/ (float) (1 + is_ratio[i]);
1426
lr[0][sb][ss] = lr[1][sb][ss] * is_ratio[i];
1430
* else { System.out.println("Error in stereo
1443
private void antialias(int ch, int gr) {
1444
int sb18, ss, sb18lim;
1445
gr_info_s gr_info = (si.ch[ch].gr[gr]);
1446
// 31 alias-reduction operations between each pair of sub-bands
1447
// with 8 butterflies between each pair
1449
if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)
1450
&& !(gr_info.mixed_block_flag != 0))
1453
if ((gr_info.window_switching_flag != 0)
1454
&& (gr_info.mixed_block_flag != 0) && (gr_info.block_type == 2)) {
1460
for (sb18 = 0; sb18 < sb18lim; sb18 += 18) {
1461
for (ss = 0; ss < 8; ss++) {
1462
int src_idx1 = sb18 + 17 - ss;
1463
int src_idx2 = sb18 + 18 + ss;
1464
float bu = out_1d[src_idx1];
1465
float bd = out_1d[src_idx2];
1466
out_1d[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);
1467
out_1d[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);
1476
// MDM: tsOutCopy and rawout do not need initializing, so the arrays
1478
float[] tsOutCopy = new float[18];
1480
float[] rawout = new float[36];
1482
private void hybrid(int ch, int gr) {
1485
gr_info_s gr_info = (si.ch[ch].gr[gr]);
1490
for (sb18 = 0; sb18 < 576; sb18 += 18) {
1491
bt = ((gr_info.window_switching_flag != 0)
1492
&& (gr_info.mixed_block_flag != 0) && (sb18 < 36)) ? 0
1493
: gr_info.block_type;
1496
// Modif E.B 02/22/99
1497
for (int cc = 0; cc < 18; cc++)
1498
tsOutCopy[cc] = tsOut[cc + sb18];
1500
inv_mdct(tsOutCopy, rawout, bt);
1502
for (int cc = 0; cc < 18; cc++)
1503
tsOut[cc + sb18] = tsOutCopy[cc];
1509
tsOut[0 + sb18] = rawout[0] + prvblk[ch][sb18 + 0];
1510
prvblk[ch][sb18 + 0] = rawout[18];
1511
tsOut[1 + sb18] = rawout[1] + prvblk[ch][sb18 + 1];
1512
prvblk[ch][sb18 + 1] = rawout[19];
1513
tsOut[2 + sb18] = rawout[2] + prvblk[ch][sb18 + 2];
1514
prvblk[ch][sb18 + 2] = rawout[20];
1515
tsOut[3 + sb18] = rawout[3] + prvblk[ch][sb18 + 3];
1516
prvblk[ch][sb18 + 3] = rawout[21];
1517
tsOut[4 + sb18] = rawout[4] + prvblk[ch][sb18 + 4];
1518
prvblk[ch][sb18 + 4] = rawout[22];
1519
tsOut[5 + sb18] = rawout[5] + prvblk[ch][sb18 + 5];
1520
prvblk[ch][sb18 + 5] = rawout[23];
1521
tsOut[6 + sb18] = rawout[6] + prvblk[ch][sb18 + 6];
1522
prvblk[ch][sb18 + 6] = rawout[24];
1523
tsOut[7 + sb18] = rawout[7] + prvblk[ch][sb18 + 7];
1524
prvblk[ch][sb18 + 7] = rawout[25];
1525
tsOut[8 + sb18] = rawout[8] + prvblk[ch][sb18 + 8];
1526
prvblk[ch][sb18 + 8] = rawout[26];
1527
tsOut[9 + sb18] = rawout[9] + prvblk[ch][sb18 + 9];
1528
prvblk[ch][sb18 + 9] = rawout[27];
1529
tsOut[10 + sb18] = rawout[10] + prvblk[ch][sb18 + 10];
1530
prvblk[ch][sb18 + 10] = rawout[28];
1531
tsOut[11 + sb18] = rawout[11] + prvblk[ch][sb18 + 11];
1532
prvblk[ch][sb18 + 11] = rawout[29];
1533
tsOut[12 + sb18] = rawout[12] + prvblk[ch][sb18 + 12];
1534
prvblk[ch][sb18 + 12] = rawout[30];
1535
tsOut[13 + sb18] = rawout[13] + prvblk[ch][sb18 + 13];
1536
prvblk[ch][sb18 + 13] = rawout[31];
1537
tsOut[14 + sb18] = rawout[14] + prvblk[ch][sb18 + 14];
1538
prvblk[ch][sb18 + 14] = rawout[32];
1539
tsOut[15 + sb18] = rawout[15] + prvblk[ch][sb18 + 15];
1540
prvblk[ch][sb18 + 15] = rawout[33];
1541
tsOut[16 + sb18] = rawout[16] + prvblk[ch][sb18 + 16];
1542
prvblk[ch][sb18 + 16] = rawout[34];
1543
tsOut[17 + sb18] = rawout[17] + prvblk[ch][sb18 + 17];
1544
prvblk[ch][sb18 + 17] = rawout[35];
1551
private void do_downmix() {
1552
for (int sb = 0; sb < SSLIMIT; sb++) {
1553
for (int ss = 0; ss < SSLIMIT; ss += 3) {
1554
lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;
1555
lr[0][sb][ss + 1] = (lr[0][sb][ss + 1] + lr[1][sb][ss + 1]) * 0.5f;
1556
lr[0][sb][ss + 2] = (lr[0][sb][ss + 2] + lr[1][sb][ss + 2]) * 0.5f;
1565
public void inv_mdct(float[] in, float[] out, int block_type) {
1569
float tmpf_0, tmpf_1, tmpf_2, tmpf_3, tmpf_4, tmpf_5, tmpf_6, tmpf_7, tmpf_8, tmpf_9;
1570
float tmpf_10, tmpf_11, tmpf_12, tmpf_13, tmpf_14, tmpf_15, tmpf_16, tmpf_17;
1572
tmpf_0 = tmpf_1 = tmpf_2 = tmpf_3 = tmpf_4 = tmpf_5 = tmpf_6 = tmpf_7 = tmpf_8 = tmpf_9 = tmpf_10 = tmpf_11 = tmpf_12 = tmpf_13 = tmpf_14 = tmpf_15 = tmpf_16 = tmpf_17 = 0.0f;
1574
if (block_type == 2) {
1578
* Under MicrosoftVM 2922, This causes a GPF, or At best, an
1579
* ArrayIndexOutOfBoundsExceptin. for(int p=0;p<36;p+=9) { out[p] =
1580
* out[p+1] = out[p+2] = out[p+3] = out[p+4] = out[p+5] = out[p+6] =
1581
* out[p+7] = out[p+8] = 0.0f; }
1622
for (i = 0; i < 3; i++) {
1624
// Begin 12 point IDCT
1625
// Input aliasing for 12 pt IDCT
1626
in[15 + i] += in[12 + i];
1627
in[12 + i] += in[9 + i];
1628
in[9 + i] += in[6 + i];
1629
in[6 + i] += in[3 + i];
1630
in[3 + i] += in[0 + i];
1632
// Input aliasing on odd indices (for 6 point IDCT)
1633
in[15 + i] += in[9 + i];
1634
in[9 + i] += in[3 + i];
1636
// 3 point IDCT on even indices
1637
float pp1, pp2, sum;
1638
pp2 = in[12 + i] * 0.500000000f;
1639
pp1 = in[6 + i] * 0.866025403f;
1640
sum = in[0 + i] + pp2;
1641
tmpf_1 = in[0 + i] - in[12 + i];
1645
// End 3 point IDCT on even indices
1646
// 3 point IDCT on odd indices (for 6 point IDCT)
1647
pp2 = in[15 + i] * 0.500000000f;
1648
pp1 = in[9 + i] * 0.866025403f;
1649
sum = in[3 + i] + pp2;
1650
tmpf_4 = in[3 + i] - in[15 + i];
1653
// End 3 point IDCT on odd indices
1654
// Twiddle factors on odd indices (for 6 point IDCT)
1656
tmpf_3 *= 1.931851653f;
1657
tmpf_4 *= 0.707106781f;
1658
tmpf_5 *= 0.517638090f;
1660
// Output butterflies on 2 3 point IDCT's (for 6 point IDCT)
1661
float save = tmpf_0;
1663
tmpf_5 = save - tmpf_5;
1666
tmpf_4 = save - tmpf_4;
1669
tmpf_3 = save - tmpf_3;
1672
// Twiddle factors on indices (for 12 point IDCT)
1674
tmpf_0 *= 0.504314480f;
1675
tmpf_1 *= 0.541196100f;
1676
tmpf_2 *= 0.630236207f;
1677
tmpf_3 *= 0.821339815f;
1678
tmpf_4 *= 1.306562965f;
1679
tmpf_5 *= 3.830648788f;
1681
// End 12 point IDCT
1683
// Shift to 12 point modified IDCT, multiply by window type 2
1684
tmpf_8 = -tmpf_0 * 0.793353340f;
1685
tmpf_9 = -tmpf_0 * 0.608761429f;
1686
tmpf_7 = -tmpf_1 * 0.923879532f;
1687
tmpf_10 = -tmpf_1 * 0.382683432f;
1688
tmpf_6 = -tmpf_2 * 0.991444861f;
1689
tmpf_11 = -tmpf_2 * 0.130526192f;
1692
tmpf_1 = tmpf_4 * 0.382683432f;
1693
tmpf_2 = tmpf_5 * 0.608761429f;
1695
tmpf_3 = -tmpf_5 * 0.793353340f;
1696
tmpf_4 = -tmpf_4 * 0.923879532f;
1697
tmpf_5 = -tmpf_0 * 0.991444861f;
1699
tmpf_0 *= 0.130526192f;
1701
out[six_i + 6] += tmpf_0;
1702
out[six_i + 7] += tmpf_1;
1703
out[six_i + 8] += tmpf_2;
1704
out[six_i + 9] += tmpf_3;
1705
out[six_i + 10] += tmpf_4;
1706
out[six_i + 11] += tmpf_5;
1707
out[six_i + 12] += tmpf_6;
1708
out[six_i + 13] += tmpf_7;
1709
out[six_i + 14] += tmpf_8;
1710
out[six_i + 15] += tmpf_9;
1711
out[six_i + 16] += tmpf_10;
1712
out[six_i + 17] += tmpf_11;
1718
// input aliasing for 36 point IDCT
1737
// 18 point IDCT for odd indices
1738
// input aliasing for 18 point IDCT
1748
float tmp0, tmp1, tmp2, tmp3, tmp4, tmp0_, tmp1_, tmp2_, tmp3_;
1749
float tmp0o, tmp1o, tmp2o, tmp3o, tmp4o, tmp0_o, tmp1_o, tmp2_o, tmp3_o;
1751
// Fast 9 Point Inverse Discrete Cosine Transform
1753
// By Francois-Raymond Boyer
1754
// mailto:boyerf@iro.umontreal.ca
1755
// http://www.iro.umontreal.ca/~boyerf
1757
// The code has been optimized for Intel processors
1758
// (takes a lot of time to convert float to and from iternal FPU
1761
// It is a simple "factorization" of the IDCT matrix.
1763
// 9 point IDCT on even indices
1765
// 5 points on odd indices (not realy an IDCT)
1766
float i00 = in[0] + in[0];
1767
float iip12 = i00 + in[12];
1769
tmp0 = iip12 + in[4] * 1.8793852415718f + in[8] * 1.532088886238f
1770
+ in[16] * 0.34729635533386f;
1771
tmp1 = i00 + in[4] - in[8] - in[12] - in[12] - in[16];
1772
tmp2 = iip12 - in[4] * 0.34729635533386f - in[8] * 1.8793852415718f
1773
+ in[16] * 1.532088886238f;
1774
tmp3 = iip12 - in[4] * 1.532088886238f + in[8] * 0.34729635533386f
1775
- in[16] * 1.8793852415718f;
1776
tmp4 = in[0] - in[4] + in[8] - in[12] + in[16];
1778
// 4 points on even indices
1779
float i66_ = in[6] * 1.732050808f; // Sqrt[3]
1781
tmp0_ = in[2] * 1.9696155060244f + i66_ + in[10] * 1.2855752193731f
1782
+ in[14] * 0.68404028665134f;
1783
tmp1_ = (in[2] - in[10] - in[14]) * 1.732050808f;
1784
tmp2_ = in[2] * 1.2855752193731f - i66_ - in[10]
1785
* 0.68404028665134f + in[14] * 1.9696155060244f;
1786
tmp3_ = in[2] * 0.68404028665134f - i66_ + in[10]
1787
* 1.9696155060244f - in[14] * 1.2855752193731f;
1789
// 9 point IDCT on odd indices
1790
// 5 points on odd indices (not realy an IDCT)
1791
float i0 = in[0 + 1] + in[0 + 1];
1792
float i0p12 = i0 + in[12 + 1];
1794
tmp0o = i0p12 + in[4 + 1] * 1.8793852415718f + in[8 + 1]
1795
* 1.532088886238f + in[16 + 1] * 0.34729635533386f;
1796
tmp1o = i0 + in[4 + 1] - in[8 + 1] - in[12 + 1] - in[12 + 1]
1798
tmp2o = i0p12 - in[4 + 1] * 0.34729635533386f - in[8 + 1]
1799
* 1.8793852415718f + in[16 + 1] * 1.532088886238f;
1800
tmp3o = i0p12 - in[4 + 1] * 1.532088886238f + in[8 + 1]
1801
* 0.34729635533386f - in[16 + 1] * 1.8793852415718f;
1802
tmp4o = (in[0 + 1] - in[4 + 1] + in[8 + 1] - in[12 + 1] + in[16 + 1]) * 0.707106781f; // Twiddled
1804
// 4 points on even indices
1805
float i6_ = in[6 + 1] * 1.732050808f; // Sqrt[3]
1807
tmp0_o = in[2 + 1] * 1.9696155060244f + i6_ + in[10 + 1]
1808
* 1.2855752193731f + in[14 + 1] * 0.68404028665134f;
1809
tmp1_o = (in[2 + 1] - in[10 + 1] - in[14 + 1]) * 1.732050808f;
1810
tmp2_o = in[2 + 1] * 1.2855752193731f - i6_ - in[10 + 1]
1811
* 0.68404028665134f + in[14 + 1] * 1.9696155060244f;
1812
tmp3_o = in[2 + 1] * 0.68404028665134f - i6_ + in[10 + 1]
1813
* 1.9696155060244f - in[14 + 1] * 1.2855752193731f;
1815
// Twiddle factors on odd indices
1817
// Butterflies on 9 point IDCT's
1819
// twiddle factors for 36 point IDCT
1823
o = (tmp0o + tmp0_o) * 0.501909918f;
1827
o = (tmp1o + tmp1_o) * 0.517638090f;
1831
o = (tmp2o + tmp2_o) * 0.551688959f;
1835
o = (tmp3o + tmp3_o) * 0.610387294f;
1838
tmpf_4 = tmp4 + tmp4o;
1839
tmpf_13 = tmp4 - tmp4o;
1841
o = (tmp3o - tmp3_o) * 0.871723397f;
1845
o = (tmp2o - tmp2_o) * 1.183100792f;
1849
o = (tmp1o - tmp1_o) * 1.931851653f;
1853
o = (tmp0o - tmp0_o) * 5.736856623f;
1857
// end 36 point IDCT */
1858
// shift to modified IDCT
1859
win_bt = win[block_type];
1861
out[0] = -tmpf_9 * win_bt[0];
1862
out[1] = -tmpf_10 * win_bt[1];
1863
out[2] = -tmpf_11 * win_bt[2];
1864
out[3] = -tmpf_12 * win_bt[3];
1865
out[4] = -tmpf_13 * win_bt[4];
1866
out[5] = -tmpf_14 * win_bt[5];
1867
out[6] = -tmpf_15 * win_bt[6];
1868
out[7] = -tmpf_16 * win_bt[7];
1869
out[8] = -tmpf_17 * win_bt[8];
1870
out[9] = tmpf_17 * win_bt[9];
1871
out[10] = tmpf_16 * win_bt[10];
1872
out[11] = tmpf_15 * win_bt[11];
1873
out[12] = tmpf_14 * win_bt[12];
1874
out[13] = tmpf_13 * win_bt[13];
1875
out[14] = tmpf_12 * win_bt[14];
1876
out[15] = tmpf_11 * win_bt[15];
1877
out[16] = tmpf_10 * win_bt[16];
1878
out[17] = tmpf_9 * win_bt[17];
1879
out[18] = tmpf_8 * win_bt[18];
1880
out[19] = tmpf_7 * win_bt[19];
1881
out[20] = tmpf_6 * win_bt[20];
1882
out[21] = tmpf_5 * win_bt[21];
1883
out[22] = tmpf_4 * win_bt[22];
1884
out[23] = tmpf_3 * win_bt[23];
1885
out[24] = tmpf_2 * win_bt[24];
1886
out[25] = tmpf_1 * win_bt[25];
1887
out[26] = tmpf_0 * win_bt[26];
1888
out[27] = tmpf_0 * win_bt[27];
1889
out[28] = tmpf_1 * win_bt[28];
1890
out[29] = tmpf_2 * win_bt[29];
1891
out[30] = tmpf_3 * win_bt[30];
1892
out[31] = tmpf_4 * win_bt[31];
1893
out[32] = tmpf_5 * win_bt[32];
1894
out[33] = tmpf_6 * win_bt[33];
1895
out[34] = tmpf_7 * win_bt[34];
1896
out[35] = tmpf_8 * win_bt[35];
1900
private int counter = 0;
1902
private static final int SSLIMIT = 18;
1904
private static final int SBLIMIT = 32;
1906
// Size of the table of whole numbers raised to 4/3 power.
1907
// This may be adjusted for performance without any problems.
1908
// public static final int POW_TABLE_LIMIT=512;
1910
/** ********************************************************* */
1912
/** ********************************************************* */
1924
public SBI(int[] thel, int[] thes) {
1930
static class gr_info_s {
1931
public int part2_3_length = 0;
1933
public int big_values = 0;
1935
public int global_gain = 0;
1937
public int scalefac_compress = 0;
1939
public int window_switching_flag = 0;
1941
public int block_type = 0;
1943
public int mixed_block_flag = 0;
1945
public int[] table_select;
1947
public int[] subblock_gain;
1949
public int region0_count = 0;
1951
public int region1_count = 0;
1953
public int preflag = 0;
1955
public int scalefac_scale = 0;
1957
public int count1table_select = 0;
1962
public gr_info_s() {
1963
table_select = new int[3];
1964
subblock_gain = new int[3];
1968
static class temporaire {
1971
public gr_info_s[] gr;
1976
public temporaire() {
1978
gr = new gr_info_s[2];
1979
gr[0] = new gr_info_s();
1980
gr[1] = new gr_info_s();
1984
static class III_side_info_t {
1986
public int main_data_begin = 0;
1988
public int private_bits = 0;
1990
public temporaire[] ch;
1995
public III_side_info_t() {
1996
ch = new temporaire[2];
1997
ch[0] = new temporaire();
1998
ch[1] = new temporaire();
2002
static class temporaire2 {
2003
public int[] l; /* [cb] */
2005
public int[][] s; /* [window][cb] */
2010
public temporaire2() {
2016
// class III_scalefac_t
2018
// public temporaire2[] tab;
2020
// * Dummy Constructor
2022
// public III_scalefac_t()
2024
// tab = new temporaire2[2];
2028
private static final int slen[][] = {
2029
{ 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
2030
{ 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 } };
2032
public static final int pretab[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
2033
1, 1, 2, 2, 3, 3, 3, 2, 0 };
2035
private SBI[] sfBandIndex; // Init in the constructor.
2037
public static final float two_to_negative_half_pow[] = { 1.0000000000E+00f,
2038
7.0710678119E-01f, 5.0000000000E-01f, 3.5355339059E-01f,
2039
2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f,
2040
8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f,
2041
3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f,
2042
1.1048543456E-02f, 7.8125000000E-03f, 5.5242717280E-03f,
2043
3.9062500000E-03f, 2.7621358640E-03f, 1.9531250000E-03f,
2044
1.3810679320E-03f, 9.7656250000E-04f, 6.9053396600E-04f,
2045
4.8828125000E-04f, 3.4526698300E-04f, 2.4414062500E-04f,
2046
1.7263349150E-04f, 1.2207031250E-04f, 8.6316745750E-05f,
2047
6.1035156250E-05f, 4.3158372875E-05f, 3.0517578125E-05f,
2048
2.1579186438E-05f, 1.5258789062E-05f, 1.0789593219E-05f,
2049
7.6293945312E-06f, 5.3947966094E-06f, 3.8146972656E-06f,
2050
2.6973983047E-06f, 1.9073486328E-06f, 1.3486991523E-06f,
2051
9.5367431641E-07f, 6.7434957617E-07f, 4.7683715820E-07f,
2052
3.3717478809E-07f, 2.3841857910E-07f, 1.6858739404E-07f,
2053
1.1920928955E-07f, 8.4293697022E-08f, 5.9604644775E-08f,
2054
4.2146848511E-08f, 2.9802322388E-08f, 2.1073424255E-08f,
2055
1.4901161194E-08f, 1.0536712128E-08f, 7.4505805969E-09f,
2056
5.2683560639E-09f, 3.7252902985E-09f, 2.6341780319E-09f,
2057
1.8626451492E-09f, 1.3170890160E-09f, 9.3132257462E-10f,
2058
6.5854450798E-10f, 4.6566128731E-10f, 3.2927225399E-10f };
2060
public static final float t_43[] = create_t_43();
2062
static private float[] create_t_43() {
2063
float[] t43 = new float[8192];
2064
final double d43 = (4.0 / 3.0);
2066
for (int i = 0; i < 8192; i++) {
2067
t43[i] = (float) Math.pow(i, d43);
2072
public static final float io[][] = {
2073
{ 1.0000000000E+00f, 8.4089641526E-01f, 7.0710678119E-01f,
2074
5.9460355751E-01f, 5.0000000001E-01f, 4.2044820763E-01f,
2075
3.5355339060E-01f, 2.9730177876E-01f, 2.5000000001E-01f,
2076
2.1022410382E-01f, 1.7677669530E-01f, 1.4865088938E-01f,
2077
1.2500000000E-01f, 1.0511205191E-01f, 8.8388347652E-02f,
2078
7.4325444691E-02f, 6.2500000003E-02f, 5.2556025956E-02f,
2079
4.4194173826E-02f, 3.7162722346E-02f, 3.1250000002E-02f,
2080
2.6278012978E-02f, 2.2097086913E-02f, 1.8581361173E-02f,
2081
1.5625000001E-02f, 1.3139006489E-02f, 1.1048543457E-02f,
2082
9.2906805866E-03f, 7.8125000006E-03f, 6.5695032447E-03f,
2083
5.5242717285E-03f, 4.6453402934E-03f },
2084
{ 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f,
2085
3.5355339060E-01f, 2.5000000000E-01f, 1.7677669530E-01f,
2086
1.2500000000E-01f, 8.8388347650E-02f, 6.2500000001E-02f,
2087
4.4194173825E-02f, 3.1250000001E-02f, 2.2097086913E-02f,
2088
1.5625000000E-02f, 1.1048543456E-02f, 7.8125000002E-03f,
2089
5.5242717282E-03f, 3.9062500001E-03f, 2.7621358641E-03f,
2090
1.9531250001E-03f, 1.3810679321E-03f, 9.7656250004E-04f,
2091
6.9053396603E-04f, 4.8828125002E-04f, 3.4526698302E-04f,
2092
2.4414062501E-04f, 1.7263349151E-04f, 1.2207031251E-04f,
2093
8.6316745755E-05f, 6.1035156254E-05f, 4.3158372878E-05f,
2094
3.0517578127E-05f, 2.1579186439E-05f } };
2096
public static final float TAN12[] = { 0.0f, 0.26794919f, 0.57735027f, 1.0f,
2097
1.73205081f, 3.73205081f, 9.9999999e10f, -3.73205081f,
2098
-1.73205081f, -1.0f, -0.57735027f, -0.26794919f, 0.0f, 0.26794919f,
2099
0.57735027f, 1.0f };
2101
// REVIEW: in java, the array lookup may well be slower than
2102
// the actual calculation
2105
* private static final int ss_div[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2106
* 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2107
* 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
2108
* 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2109
* 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2110
* 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
2111
* 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
2112
* 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2113
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
2114
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
2115
* 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
2116
* 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
2117
* 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
2118
* 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
2119
* 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
2120
* 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
2121
* 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
2122
* 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
2123
* 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
2124
* 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
2125
* 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
2126
* 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
2127
* 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
2128
* 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
2129
* 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
2130
* 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
2131
* 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
2132
* 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
2133
* 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
2134
* 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 };
2135
* // 576 % 18 private static final int ss_mod[] = { 0, 1, 2, 3, 4, 5, 6,
2136
* 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
2137
* 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2138
* 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2139
* 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0,
2140
* 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4,
2141
* 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8,
2142
* 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2143
* 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2144
* 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2145
* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2146
* 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2147
* 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2148
* 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
2149
* 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2150
* 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1,
2151
* 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5,
2152
* 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
2153
* 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2154
* 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2155
* 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0,
2156
* 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4,
2157
* 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8,
2158
* 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2159
* 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2160
* 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2161
* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2162
* 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
2164
private static/* final */int reorder_table[][]/* = loadReorderTable() */; // SZD:
2172
* Loads the data for the reorder
2175
* private static int[][] loadReorderTable() // SZD: table will be generated {
2176
* try { Class elemType = int[][].class.getComponentType(); Object o =
2177
* JavaLayerUtils.deserializeArrayResource("l3reorder.ser", elemType, 6);
2178
* return (int[][])o; } catch (IOException ex) { throw new
2179
* ExceptionInInitializerError(ex); } }
2182
static int[] reorder(int scalefac_band[]) { // SZD: converted from LAME
2184
int ix[] = new int[576];
2185
for (int sfb = 0; sfb < 13; sfb++) {
2186
int start = scalefac_band[sfb];
2187
int end = scalefac_band[sfb + 1];
2188
for (int window = 0; window < 3; window++)
2189
for (int i = start; i < end; i++)
2190
ix[3 * i + window] = j++;
2196
* static final int reorder_table_data[][]; = { { 0, 4, 8, 1, 5, 9, 2, 6,
2197
* 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32,
2198
* 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49, 38, 44, 50,
2199
* 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 60, 66, 55, 61, 67, 56, 62, 68,
2200
* 57, 63, 69, 58, 64, 70, 59, 65, 71, 72, 80, 88, 73, 81, 89, 74, 82, 90,
2201
* 75, 83, 91, 76, 84, 92, 77, 85, 93, 78, 86, 94, 79, 87, 95, 96,106,116,
2202
* 97,107,117, 98,108,118, 99,109,119,100,110,120,101,
2203
* 111,121,102,112,122,103,113,123,104,114,124,105,115,125,126,140,
2204
* 154,127,141,155,128,142,156,129,143,157,130,144,158,131,145,159,
2205
* 132,146,160,133,147,161,134,148,162,135,149,163,136,150,164,137,
2206
* 151,165,138,152,166,139,153,167,168,186,204,169,187,205,170,188,
2207
* 206,171,189,207,172,190,208,173,191,209,174,192,210,175,193,211,
2208
* 176,194,212,177,195,213,178,196,214,179,197,215,180,198,216,181,
2209
* 199,217,182,200,218,183,201,219,184,202,220,185,203,221,222,248,
2210
* 274,223,249,275,224,250,276,225,251,277,226,252,278,227,253,279,
2211
* 228,254,280,229,255,281,230,256,282,231,257,283,232,258,284,233,
2212
* 259,285,234,260,286,235,261,287,236,262,288,237,263,289,238,264,
2213
* 290,239,265,291,240,266,292,241,267,293,242,268,294,243,269,295,
2214
* 244,270,296,245,271,297,246,272,298,247,273,299,300,332,364,301,
2215
* 333,365,302,334,366,303,335,367,304,336,368,305,337,369,306,338,
2216
* 370,307,339,371,308,340,372,309,341,373,310,342,374,311,343,375,
2217
* 312,344,376,313,345,377,314,346,378,315,347,379,316,348,380,317,
2218
* 349,381,318,350,382,319,351,383,320,352,384,321,353,385,322,354,
2219
* 386,323,355,387,324,356,388,325,357,389,326,358,390,327,359,391,
2220
* 328,360,392,329,361,393,330,362,394,331,363,395,396,438,480,397,
2221
* 439,481,398,440,482,399,441,483,400,442,484,401,443,485,402,444,
2222
* 486,403,445,487,404,446,488,405,447,489,406,448,490,407,449,491,
2223
* 408,450,492,409,451,493,410,452,494,411,453,495,412,454,496,413,
2224
* 455,497,414,456,498,415,457,499,416,458,500,417,459,501,418,460,
2225
* 502,419,461,503,420,462,504,421,463,505,422,464,506,423,465,507,
2226
* 424,466,508,425,467,509,426,468,510,427,469,511,428,470,512,429,
2227
* 471,513,430,472,514,431,473,515,432,474,516,433,475,517,434,476,
2228
* 518,435,477,519,436,478,520,437,479,521,522,540,558,523,541,559,
2229
* 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
2230
* 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
2231
* 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
2232
* 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15,
2233
* 19, 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37,
2234
* 43, 49, 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55,
2235
* 63, 71, 56, 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61,
2236
* 69, 77, 78, 88, 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83,
2237
* 93,103, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
2238
* 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
2239
* 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
2240
* 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
2241
* 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
2242
* 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
2243
* 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
2244
* 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
2245
* 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
2246
* 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
2247
* 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
2248
* 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
2249
* 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
2250
* 285,309,262,286,310,263,287,311,312,344,376,313,345,377,314,346,
2251
* 378,315,347,379,316,348,380,317,349,381,318,350,382,319,351,383,
2252
* 320,352,384,321,353,385,322,354,386,323,355,387,324,356,388,325,
2253
* 357,389,326,358,390,327,359,391,328,360,392,329,361,393,330,362,
2254
* 394,331,363,395,332,364,396,333,365,397,334,366,398,335,367,399,
2255
* 336,368,400,337,369,401,338,370,402,339,371,403,340,372,404,341,
2256
* 373,405,342,374,406,343,375,407,408,452,496,409,453,497,410,454,
2257
* 498,411,455,499,412,456,500,413,457,501,414,458,502,415,459,503,
2258
* 416,460,504,417,461,505,418,462,506,419,463,507,420,464,508,421,
2259
* 465,509,422,466,510,423,467,511,424,468,512,425,469,513,426,470,
2260
* 514,427,471,515,428,472,516,429,473,517,430,474,518,431,475,519,
2261
* 432,476,520,433,477,521,434,478,522,435,479,523,436,480,524,437,
2262
* 481,525,438,482,526,439,483,527,440,484,528,441,485,529,442,486,
2263
* 530,443,487,531,444,488,532,445,489,533,446,490,534,447,491,535,
2264
* 448,492,536,449,493,537,450,494,538,451,495,539,540,552,564,541,
2265
* 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
2266
* 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575}, { 0, 4,
2267
* 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15,
2268
* 19, 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37,
2269
* 43, 49, 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55,
2270
* 63, 71, 56, 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61,
2271
* 69, 77, 78, 88, 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83,
2272
* 93,103, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
2273
* 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
2274
* 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
2275
* 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
2276
* 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
2277
* 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
2278
* 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
2279
* 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
2280
* 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
2281
* 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
2282
* 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
2283
* 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
2284
* 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
2285
* 285,309,262,286,310,263,287,311,312,342,372,313,343,373,314,344,
2286
* 374,315,345,375,316,346,376,317,347,377,318,348,378,319,349,379,
2287
* 320,350,380,321,351,381,322,352,382,323,353,383,324,354,384,325,
2288
* 355,385,326,356,386,327,357,387,328,358,388,329,359,389,330,360,
2289
* 390,331,361,391,332,362,392,333,363,393,334,364,394,335,365,395,
2290
* 336,366,396,337,367,397,338,368,398,339,369,399,340,370,400,341,
2291
* 371,401,402,442,482,403,443,483,404,444,484,405,445,485,406,446,
2292
* 486,407,447,487,408,448,488,409,449,489,410,450,490,411,451,491,
2293
* 412,452,492,413,453,493,414,454,494,415,455,495,416,456,496,417,
2294
* 457,497,418,458,498,419,459,499,420,460,500,421,461,501,422,462,
2295
* 502,423,463,503,424,464,504,425,465,505,426,466,506,427,467,507,
2296
* 428,468,508,429,469,509,430,470,510,431,471,511,432,472,512,433,
2297
* 473,513,434,474,514,435,475,515,436,476,516,437,477,517,438,478,
2298
* 518,439,479,519,440,480,520,441,481,521,522,540,558,523,541,559,
2299
* 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
2300
* 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
2301
* 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
2302
* 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15,
2303
* 19, 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37,
2304
* 41, 45, 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51,
2305
* 57, 63, 52, 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69,
2306
* 77, 85, 70, 78, 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,100,110,
2307
* 91,101,111, 92,102,112, 93,103,113, 94,104,114, 95,105,115, 96,106,116,
2308
* 97, 107,117, 98,108,118, 99,109,119,120,132,144,121,133,145,122,134,
2309
* 146,123,135,147,124,136,148,125,137,149,126,138,150,127,139,151,
2310
* 128,140,152,129,141,153,130,142,154,131,143,155,156,170,184,157,
2311
* 171,185,158,172,186,159,173,187,160,174,188,161,175,189,162,176,
2312
* 190,163,177,191,164,178,192,165,179,193,166,180,194,167,181,195,
2313
* 168,182,196,169,183,197,198,216,234,199,217,235,200,218,236,201,
2314
* 219,237,202,220,238,203,221,239,204,222,240,205,223,241,206,224,
2315
* 242,207,225,243,208,226,244,209,227,245,210,228,246,211,229,247,
2316
* 212,230,248,213,231,249,214,232,250,215,233,251,252,274,296,253,
2317
* 275,297,254,276,298,255,277,299,256,278,300,257,279,301,258,280,
2318
* 302,259,281,303,260,282,304,261,283,305,262,284,306,263,285,307,
2319
* 264,286,308,265,287,309,266,288,310,267,289,311,268,290,312,269,
2320
* 291,313,270,292,314,271,293,315,272,294,316,273,295,317,318,348,
2321
* 378,319,349,379,320,350,380,321,351,381,322,352,382,323,353,383,
2322
* 324,354,384,325,355,385,326,356,386,327,357,387,328,358,388,329,
2323
* 359,389,330,360,390,331,361,391,332,362,392,333,363,393,334,364,
2324
* 394,335,365,395,336,366,396,337,367,397,338,368,398,339,369,399,
2325
* 340,370,400,341,371,401,342,372,402,343,373,403,344,374,404,345,
2326
* 375,405,346,376,406,347,377,407,408,464,520,409,465,521,410,466,
2327
* 522,411,467,523,412,468,524,413,469,525,414,470,526,415,471,527,
2328
* 416,472,528,417,473,529,418,474,530,419,475,531,420,476,532,421,
2329
* 477,533,422,478,534,423,479,535,424,480,536,425,481,537,426,482,
2330
* 538,427,483,539,428,484,540,429,485,541,430,486,542,431,487,543,
2331
* 432,488,544,433,489,545,434,490,546,435,491,547,436,492,548,437,
2332
* 493,549,438,494,550,439,495,551,440,496,552,441,497,553,442,498,
2333
* 554,443,499,555,444,500,556,445,501,557,446,502,558,447,503,559,
2334
* 448,504,560,449,505,561,450,506,562,451,507,563,452,508,564,453,
2335
* 509,565,454,510,566,455,511,567,456,512,568,457,513,569,458,514,
2336
* 570,459,515,571,460,516,572,461,517,573,462,518,574,463,519,575}, { 0, 4,
2337
* 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15,
2338
* 19, 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37,
2339
* 41, 45, 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51,
2340
* 57, 63, 52, 58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69,
2341
* 75, 81, 70, 76, 82, 71, 77, 83, 84, 94,104, 85, 95,105, 86, 96,106, 87,
2342
* 97,107, 88, 98,108, 89, 99,109, 90,100,110, 91,101,111, 92,102,112, 93,
2343
* 103,113,114,126,138,115,127,139,116,128,140,117,129,141,118,130,
2344
* 142,119,131,143,120,132,144,121,133,145,122,134,146,123,135,147,
2345
* 124,136,148,125,137,149,150,164,178,151,165,179,152,166,180,153,
2346
* 167,181,154,168,182,155,169,183,156,170,184,157,171,185,158,172,
2347
* 186,159,173,187,160,174,188,161,175,189,162,176,190,163,177,191,
2348
* 192,208,224,193,209,225,194,210,226,195,211,227,196,212,228,197,
2349
* 213,229,198,214,230,199,215,231,200,216,232,201,217,233,202,218,
2350
* 234,203,219,235,204,220,236,205,221,237,206,222,238,207,223,239,
2351
* 240,260,280,241,261,281,242,262,282,243,263,283,244,264,284,245,
2352
* 265,285,246,266,286,247,267,287,248,268,288,249,269,289,250,270,
2353
* 290,251,271,291,252,272,292,253,273,293,254,274,294,255,275,295,
2354
* 256,276,296,257,277,297,258,278,298,259,279,299,300,326,352,301,
2355
* 327,353,302,328,354,303,329,355,304,330,356,305,331,357,306,332,
2356
* 358,307,333,359,308,334,360,309,335,361,310,336,362,311,337,363,
2357
* 312,338,364,313,339,365,314,340,366,315,341,367,316,342,368,317,
2358
* 343,369,318,344,370,319,345,371,320,346,372,321,347,373,322,348,
2359
* 374,323,349,375,324,350,376,325,351,377,378,444,510,379,445,511,
2360
* 380,446,512,381,447,513,382,448,514,383,449,515,384,450,516,385,
2361
* 451,517,386,452,518,387,453,519,388,454,520,389,455,521,390,456,
2362
* 522,391,457,523,392,458,524,393,459,525,394,460,526,395,461,527,
2363
* 396,462,528,397,463,529,398,464,530,399,465,531,400,466,532,401,
2364
* 467,533,402,468,534,403,469,535,404,470,536,405,471,537,406,472,
2365
* 538,407,473,539,408,474,540,409,475,541,410,476,542,411,477,543,
2366
* 412,478,544,413,479,545,414,480,546,415,481,547,416,482,548,417,
2367
* 483,549,418,484,550,419,485,551,420,486,552,421,487,553,422,488,
2368
* 554,423,489,555,424,490,556,425,491,557,426,492,558,427,493,559,
2369
* 428,494,560,429,495,561,430,496,562,431,497,563,432,498,564,433,
2370
* 499,565,434,500,566,435,501,567,436,502,568,437,503,569,438,504,
2371
* 570,439,505,571,440,506,572,441,507,573,442,508,574,443,509,575}, { 0, 4,
2372
* 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15,
2373
* 19, 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37,
2374
* 41, 45, 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51,
2375
* 57, 63, 52, 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69,
2376
* 77, 85, 70, 78, 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,102,114,
2377
* 91,103,115, 92,104,116, 93,105,117, 94,106,118, 95,107,119, 96,108,120,
2378
* 97, 109,121, 98,110,122, 99,111,123,100,112,124,101,113,125,126,142,
2379
* 158,127,143,159,128,144,160,129,145,161,130,146,162,131,147,163,
2380
* 132,148,164,133,149,165,134,150,166,135,151,167,136,152,168,137,
2381
* 153,169,138,154,170,139,155,171,140,156,172,141,157,173,174,194,
2382
* 214,175,195,215,176,196,216,177,197,217,178,198,218,179,199,219,
2383
* 180,200,220,181,201,221,182,202,222,183,203,223,184,204,224,185,
2384
* 205,225,186,206,226,187,207,227,188,208,228,189,209,229,190,210,
2385
* 230,191,211,231,192,212,232,193,213,233,234,260,286,235,261,287,
2386
* 236,262,288,237,263,289,238,264,290,239,265,291,240,266,292,241,
2387
* 267,293,242,268,294,243,269,295,244,270,296,245,271,297,246,272,
2388
* 298,247,273,299,248,274,300,249,275,301,250,276,302,251,277,303,
2389
* 252,278,304,253,279,305,254,280,306,255,281,307,256,282,308,257,
2390
* 283,309,258,284,310,259,285,311,312,346,380,313,347,381,314,348,
2391
* 382,315,349,383,316,350,384,317,351,385,318,352,386,319,353,387,
2392
* 320,354,388,321,355,389,322,356,390,323,357,391,324,358,392,325,
2393
* 359,393,326,360,394,327,361,395,328,362,396,329,363,397,330,364,
2394
* 398,331,365,399,332,366,400,333,367,401,334,368,402,335,369,403,
2395
* 336,370,404,337,371,405,338,372,406,339,373,407,340,374,408,341,
2396
* 375,409,342,376,410,343,377,411,344,378,412,345,379,413,414,456,
2397
* 498,415,457,499,416,458,500,417,459,501,418,460,502,419,461,503,
2398
* 420,462,504,421,463,505,422,464,506,423,465,507,424,466,508,425,
2399
* 467,509,426,468,510,427,469,511,428,470,512,429,471,513,430,472,
2400
* 514,431,473,515,432,474,516,433,475,517,434,476,518,435,477,519,
2401
* 436,478,520,437,479,521,438,480,522,439,481,523,440,482,524,441,
2402
* 483,525,442,484,526,443,485,527,444,486,528,445,487,529,446,488,
2403
* 530,447,489,531,448,490,532,449,491,533,450,492,534,451,493,535,
2404
* 452,494,536,453,495,537,454,496,538,455,497,539,540,552,564,541,
2405
* 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
2406
* 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575} };
2409
private static final float cs[] = { 0.857492925712f, 0.881741997318f,
2410
0.949628649103f, 0.983314592492f, 0.995517816065f, 0.999160558175f,
2411
0.999899195243f, 0.999993155067f };
2413
private static final float ca[] = { -0.5144957554270f, -0.4717319685650f,
2414
-0.3133774542040f, -0.1819131996110f, -0.0945741925262f,
2415
-0.0409655828852f, -0.0141985685725f, -0.00369997467375f };
2417
/** ********************************************************* */
2418
/* END OF L3TABLE */
2419
/** ********************************************************* */
2421
/** ********************************************************* */
2423
/** ********************************************************* */
2425
/** ************************************************************ */
2427
/** ************************************************************ */
2429
/** ************************************************************ */
2431
/** ************************************************************ */
2432
public static final float win[][] = {
2433
{ -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f,
2434
-1.6280817573E-01f, -4.9999999679E-01f, -3.8388735032E-01f,
2435
-6.2061144372E-01f, -1.1659756083E+00f, -3.8720752656E+00f,
2436
-4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
2437
-7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f,
2438
-4.5426052317E-01f, -4.0715656898E-01f, -3.6969460527E-01f,
2439
-3.3876269197E-01f, -3.1242222492E-01f, -2.8939587111E-01f,
2440
-2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
2441
-2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f,
2442
-1.6905846094E-01f, -1.5350360518E-01f, -1.3758624925E-01f,
2443
-1.2103922149E-01f, -2.0710679058E-01f, -8.4752577594E-02f,
2444
-6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f },
2446
{ -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f,
2447
-1.6280817573E-01f, -4.9999999679E-01f, -3.8388735032E-01f,
2448
-6.2061144372E-01f, -1.1659756083E+00f, -3.8720752656E+00f,
2449
-4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
2450
-7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f,
2451
-4.5426052317E-01f, -4.0715656898E-01f, -3.6969460527E-01f,
2452
-3.3908542600E-01f, -3.1511810350E-01f, -2.9642226150E-01f,
2453
-2.8184548650E-01f, -5.4119610000E-01f, -2.6213228100E-01f,
2454
-2.5387916537E-01f, -2.3296291359E-01f, -1.9852728987E-01f,
2455
-1.5233534808E-01f, -9.6496400054E-02f, -3.3423828516E-02f,
2456
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2457
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
2459
{ -4.8300800645E-02f, -1.5715656932E-01f, -2.8325045177E-01f,
2460
-4.2953747763E-01f, -1.2071067795E+00f, -8.2426483178E-01f,
2461
-1.1451749106E+00f, -1.7695290101E+00f, -4.5470225061E+00f,
2462
-3.4890531002E+00f, -7.3296292804E-01f, -1.5076514758E-01f,
2463
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2464
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2465
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2466
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2467
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2468
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2469
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2470
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
2472
{ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2473
0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2474
-1.5076513660E-01f, -7.3296291107E-01f, -3.4890530566E+00f,
2475
-4.5470224727E+00f, -1.7695290031E+00f, -1.1451749092E+00f,
2476
-8.3137738100E-01f, -1.3065629650E+00f, -5.4142014250E-01f,
2477
-4.6528974900E-01f, -4.1066990750E-01f, -3.7004680800E-01f,
2478
-3.3876269197E-01f, -3.1242222492E-01f, -2.8939587111E-01f,
2479
-2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
2480
-2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f,
2481
-1.6905846094E-01f, -1.5350360518E-01f, -1.3758624925E-01f,
2482
-1.2103922149E-01f, -2.0710679058E-01f, -8.4752577594E-02f,
2483
-6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f } };
2485
/** ************************************************************ */
2486
/* END OF INV_MDCT */
2487
/** ************************************************************ */
2499
public Sftable(int[] thel, int[] thes) {
2505
public Sftable sftable;
2507
public static final int nr_of_sfb_block[][][] = {
2508
{ { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },
2509
{ { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },
2510
{ { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },
2511
{ { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } },
2512
{ { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } },
2513
{ { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } };