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 *----------------------------------------------------------------------
36 * Class Implementing Layer 3 Decoder.
40 // @LATTICE("FS<BR,BR<SF,LR<IR,IR<IP,IP<SF,LR<K,K<F,LR<VAR,LR<RO,RO<F,VAR<F,VAR<RAW,CSH<F,SAM<O,O<F,NS<SI,SI<CH,SFREQ<H,MAX<H,H<CH,FLCH<CH,FLCH<WC,SF<SFT,SFT<NS,NS<C,TS<RAW,O<TS,LY<F,NZ<VAR,C*,FS*,IP*,IR*,LR*,K*,O*,TS*,TS<BT,BT<GR,GR<SI,LR<S,S<ME,ME<CH,K<SH,K<LSF,LSF<H,LSF<CH,IP<SH,SH<J,J<S,S<ME,SH<SFREQ,SH<RO,IP<TMP2,LSF<H,TMP2<F,J*,SH*,O<RO2,RO2<RO3,RO3<RO4,RO4<RO5,O<RO1,RO1<RO5,RO5<RO6,RO6<RO7,RO7<RO8,RO8<RO9,RO9<SFREQ,RO9<F,RO1*,RO4*,RO5*,RO6*,RO9*,VAR<HD3,HD3<HD2,HD2<HD1,HD1<SI,HD1<SFREQ,HD1<RAW,HD2*,HD3*,SFB<GLSFD5,GLSFD5<NS,GLSFD5<GLSFD4,NS<GLSFD3,GLSFD4<GLSFD3,GLSFD3<GLSFD2,GLSFD2<GLSFD1,GLSFD1<SI,GLSFD5*,SF<GLSFF4,GLSFF4<GLSFF3,GLSFF3<GLSFF2,GLSFF2<GLSFF1,GLSFF1<SI,GLSFF4*,GLSFF3*,GLSFF2*,SF<GSF5,GSF5<GSF4,GSF4<GSF3,GSF3<GSF2,GSF2<GSF1,GSF1<SI,GSF5*,GSF4*,O<D3,D3<D2,D2<D1,D1<FLCH,D1*,D2*")
41 // 4th line added for hybrid.
42 // 5th added for stereo
43 // 6th added for reorder method
44 // 7th added for huffman_decode method
45 // 8th added for get_LSF_scale_data
46 // 9th added for get_LSF_scale_factors
47 // 10th added for get_scale_factors
48 // llth added for decode
49 // @LATTICE("IS1D*,RO<IS1D,IS1D<SI2,SI2<SI1,SI<P2S,SF1<CH0,SF0*,SFB_SH<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SI1<SF2,SF2<SFB,SF1<BR,LR*,OUT<LR,LR<RO,NZ*,SI<SF1,SI1<NZ,NZ<SI,SI1<SBI,SBI<SI,BUF<FT,SF1<SF0,SF0<HD1,BR<ST,ST,FT<SP,SP<OUT,OUT<SI1,SI1<SI,P2S<CH0,CH0<MAX0,MAX0<BR1,FS<BR1,BR1<BR,BR<HD1,HD1<HD,OUT*,BR1*,SI1*,MAX0*,CH0*,RAW,TS,F,C,K,LY,VAR,IR,IP,CSH,GLSFD3,GLSFD4,GLSFD5,GLSFF4,GLSFF2,GLSFF3,GLSFF1,GSF4,GSF5,GSF1,GSF2,GSF3,HD2,HD3,BT,GR,RO6,RO5,RO9,RO8,RO7,RO4,RO1,RO3,RO2,SH,ME,TMP2,S,LSF,J")
50 @LATTICE("SI0*,INIT*,ISR*,ISP*,HD<CH0,LR<ISR,ISR<ISP,SI1<SF2,NS*,CH0<ST,ST<INIT,IS1D*,RO1<RO,RO1*,RO<IS1D,IS1D<SI2,SI2<SI1,BR<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SF2<SFB,LR*,TSOUT*,OUT1<PREV,PREV<RAWFULL,RAWFULL<RAWOUT,RAWOUT<TSOUT,TSOUT<OUT0,OUT0<LR,ISP<RO1,NZ*,SI<SI0,SI0<SF15,SF15<SF1,BR1<NZ,NZ<BR,SI1<RT,RT<SBI,SBI<SI,BUF<FT,SF1<HD1,SF1<HD1,FT<SP,SP<OUT1,SI1<SI,SFB_SH<BR1,BR1<BR,HD1<HD,OUT0*,OUT1*,BR1*,SI1*,CH0*,RO*,RAWOUT*")
51 @METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN,RETURNLOC=OUT")
52 final class LayerIIIDecoder implements FrameDecoder {
53 static final double d43 = (4.0 / 3.0);
55 public int[] scalefac_buffer;
57 // MDM: removed, as this wasn't being used.
58 // private float CheckSumOut1d = 0.0f;
60 private int CheckSumHuff = 0;
64 private float[][][] ro;
66 private float[][][] lr;
68 private float[] inter; // 576 samples
70 private float[] out_1d; // 576 samples
72 private float[][] prevblck;
77 private int[] nonzero;
79 private SynthesisFilter filter1;
81 private SynthesisFilter filter2;
83 // private Obuffer buffer; // output buffer
85 private int which_channels;
87 private BitReserve br;
89 private III_side_info_t si;
91 // @LOC("SBT") private temporaire2[] III_scalefac_t;
93 private final temporaire2[] scalefac;
94 // private III_scalefac_t scalefac;
99 private int frame_start;
100 // @LOC("SI1") private int part2_start;
102 private final int channels;
104 private int first_channel;
106 private int last_channel;
111 private int part2_start;
114 private boolean initialized = false;
117 float[][] raw_full; // 18 left shfited since it will be copied into prevblck!
119 // constructor for the linear type system
120 public LayerIIIDecoder(Header h, @DELEGATE @LOC("VAR") SynthesisFilter filtera,
121 @DELEGATE @LOC("VAR") SynthesisFilter filterb, @LOC("VAR") int which_ch0) {
124 raw_full = new float[2][SBLIMIT * SSLIMIT];
129 huffcodetab.inithuff();
130 is_1d = new int[SBLIMIT * SSLIMIT + 4];
131 ro = new float[2][SBLIMIT][SSLIMIT];
132 lr = new float[2][SBLIMIT][SSLIMIT];
133 out_1d = new float[SBLIMIT * SSLIMIT];
134 inter = new float[SBLIMIT * SSLIMIT];
135 prevblck = new float[2][SBLIMIT * SSLIMIT];
136 k = new float[2][SBLIMIT * SSLIMIT];
137 nonzero = new int[2];
139 // removes unnecessary aliases
141 // III_scalefac_t = new temporaire2[2];
142 // III_scalefac_t[0] = new temporaire2();
143 // III_scalefac_t[1] = new temporaire2();
144 // scalefac = III_scalefac_t;
146 scalefac = new temporaire2[2];
147 scalefac[0] = new temporaire2();
148 scalefac[1] = new temporaire2();
152 sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
153 @LOC("VAR") int[] l0 =
154 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
156 @LOC("VAR") int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };
157 @LOC("VAR") int[] l1 =
158 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394,
160 @LOC("VAR") int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };
161 @LOC("VAR") int[] l2 =
162 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
164 @LOC("VAR") int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
166 @LOC("VAR") int[] l3 =
167 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342,
169 @LOC("VAR") int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };
170 @LOC("VAR") int[] l4 =
171 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330,
173 @LOC("VAR") int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };
174 @LOC("VAR") int[] l5 =
175 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448,
177 @LOC("VAR") int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };
179 @LOC("VAR") int[] l6 =
180 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
182 @LOC("VAR") int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
183 @LOC("VAR") int[] l7 =
184 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
186 @LOC("VAR") int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
187 @LOC("VAR") int[] l8 =
188 { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568,
189 570, 572, 574, 576 };
190 @LOC("VAR") int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 };
192 sfBandIndex[0] = new SBI(l0, s0);
193 sfBandIndex[1] = new SBI(l1, s1);
194 sfBandIndex[2] = new SBI(l2, s2);
196 sfBandIndex[3] = new SBI(l3, s3);
197 sfBandIndex[4] = new SBI(l4, s4);
198 sfBandIndex[5] = new SBI(l5, s5);
200 sfBandIndex[6] = new SBI(l6, s6);
201 sfBandIndex[7] = new SBI(l7, s7);
202 sfBandIndex[8] = new SBI(l8, s8);
203 // END OF L3TABLE INIT
205 if (reorder_table == null) { // SZD: generate LUT
206 reorder_table = new int[9][];
207 for (@LOC("I") int i = 0; i < 9; i++)
208 reorder_table[i] = reorder(sfBandIndex[i].s);
212 scalefac_buffer = new int[54];
213 // END OF scalefac_buffer
218 @LATTICE("THIS<C,THIS<IN,C*,THISLOC=THIS")
219 private void init(@LOC("THIS,LayerIIIDecoder.HD1") Header header) {
222 channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
223 max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
226 header.sample_frequency()
227 + ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6
231 switch (which_channels) {
232 case OutputChannels.LEFT_CHANNEL:
233 case OutputChannels.DOWNMIX_CHANNELS:
234 first_channel = last_channel = 0;
237 case OutputChannels.RIGHT_CHANNEL:
238 first_channel = last_channel = 1;
241 case OutputChannels.BOTH_CHANNELS:
248 first_channel = last_channel = 0;
251 for (@LOC("THIS,LayerIIIDecoder.CH0") int ch = 0; ch < 2; ch++)
252 for (@LOC("THIS,LayerIIIDecoder.CH0") int j = 0; j < 576; j++)
253 prevblck[ch][j] = 0.0f;
255 nonzero[0] = nonzero[1] = 576;
257 si = new III_side_info_t();
266 // REVIEW: these constructor arguments should be moved to the
267 // decodeFrame() method, where possible, so that one
268 // @LATTICE("THIS<VAR,THIS<I,THIS<J,J<CH,I*,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
269 // public LayerIIIDecoder(@LOC("VAR") Header header0, @LOC("VAR")
270 // SynthesisFilter filtera,
271 // @LOC("VAR") SynthesisFilter filterb, @LOC("VAR") int which_ch0) {
273 // huffcodetab.inithuff();
274 // is_1d = new int[SBLIMIT * SSLIMIT + 4];
275 // ro = new float[2][SBLIMIT][SSLIMIT];
276 // lr = new float[2][SBLIMIT][SSLIMIT];
277 // out_1d = new float[SBLIMIT * SSLIMIT];
278 // prevblck = new float[2][SBLIMIT * SSLIMIT];
279 // k = new float[2][SBLIMIT * SSLIMIT];
280 // nonzero = new int[2];
282 // // removes unnecessary aliases
283 // // III_scalefact_t
284 // // III_scalefac_t = new temporaire2[2];
285 // // III_scalefac_t[0] = new temporaire2();
286 // // III_scalefac_t[1] = new temporaire2();
287 // // scalefac = III_scalefac_t;
289 // scalefac = new temporaire2[2];
290 // scalefac[0] = new temporaire2();
291 // scalefac[1] = new temporaire2();
295 // sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
296 // @LOC("VAR") int[] l0 =
297 // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
300 // @LOC("VAR") int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132,
302 // @LOC("VAR") int[] l1 =
303 // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232,
306 // @LOC("VAR") int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136,
308 // @LOC("VAR") int[] l2 =
309 // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
312 // @LOC("VAR") int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
315 // @LOC("VAR") int[] l3 =
316 // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196,
319 // @LOC("VAR") int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136,
321 // @LOC("VAR") int[] l4 =
322 // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190,
325 // @LOC("VAR") int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126,
327 // @LOC("VAR") int[] l5 =
328 // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240,
331 // @LOC("VAR") int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138,
334 // @LOC("VAR") int[] l6 =
335 // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
338 // @LOC("VAR") int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
340 // @LOC("VAR") int[] l7 =
341 // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
344 // @LOC("VAR") int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
346 // @LOC("VAR") int[] l8 =
347 // { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400,
349 // 570, 572, 574, 576 };
350 // @LOC("VAR") int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164,
353 // sfBandIndex[0] = new SBI(l0, s0);
354 // sfBandIndex[1] = new SBI(l1, s1);
355 // sfBandIndex[2] = new SBI(l2, s2);
357 // sfBandIndex[3] = new SBI(l3, s3);
358 // sfBandIndex[4] = new SBI(l4, s4);
359 // sfBandIndex[5] = new SBI(l5, s5);
361 // sfBandIndex[6] = new SBI(l6, s6);
362 // sfBandIndex[7] = new SBI(l7, s7);
363 // sfBandIndex[8] = new SBI(l8, s8);
364 // // END OF L3TABLE INIT
366 // if (reorder_table == null) { // SZD: generate LUT
367 // reorder_table = new int[9][];
368 // for (@LOC("I") int i = 0; i < 9; i++)
369 // reorder_table[i] = reorder(sfBandIndex[i].s);
373 // @LOC("VAR") int[] ll0 = { 0, 6, 11, 16, 21 };
374 // @LOC("VAR") int[] ss0 = { 0, 6, 12 };
375 // sftable = new Sftable(ll0, ss0);
378 // // scalefac_buffer
379 // scalefac_buffer = new int[54];
380 // // END OF scalefac_buffer
382 // // header = header0;
383 // filter1 = filtera;
384 // filter2 = filterb;
385 // // buffer = buffer0;
386 // which_channels = which_ch0;
389 // channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
390 // max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
393 // header.sample_frequency()
394 // + ((header.version() == Header.MPEG1) ? 3 : (header.version() ==
395 // Header.MPEG25_LSF) ? 6
398 // if (channels == 2) {
399 // switch (which_channels) {
400 // case OutputChannels.LEFT_CHANNEL:
401 // case OutputChannels.DOWNMIX_CHANNELS:
402 // first_channel = last_channel = 0;
405 // case OutputChannels.RIGHT_CHANNEL:
406 // first_channel = last_channel = 1;
409 // case OutputChannels.BOTH_CHANNELS:
411 // first_channel = 0;
416 // first_channel = last_channel = 0;
419 // for (@LOC("CH") int ch = 0; ch < 2; ch++)
420 // for (@LOC("J") int j = 0; j < 576; j++)
421 // prevblck[ch][j] = 0.0f;
423 // nonzero[0] = nonzero[1] = 576;
425 // br = new BitReserve();
426 // si = new III_side_info_t();
430 * Notify decoder that a seek is being made.
432 @LATTICE("THIS<J,J<CH,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
433 public void seek_notify() {
435 for (@LOC("CH") int ch = 0; ch < 2; ch++)
436 for (@LOC("J") int j = 0; j < 576; j++)
437 prevblck[ch][j] = 0.0f;
438 br = new BitReserve();
441 public void decodeFrame(@LOC("IN") Header header) {
446 * Decode one frame, filling the buffer with the output samples.
449 // subband samples are buffered and passed to the
450 // SynthesisFilter in one go.
452 private float[] samples1 = new float[32];
454 private float[] samples2 = new float[32];
456 private int filter_pos;
459 * location hierarchy of decode() {header} {stream} {si} {br, flush_main,
460 * main_data_end,frame_start,nSlots,bytes_to_discard}* {gr,max_gr} // granule
461 * {ch,channels,first_channel, last_channel, which_channels} // channel
462 * {part2_start} {sb18, ss} {out_1d}* {sb}* {samples1,sample2}
465 // @LATTICE("BYTE<THIS,THIS<MAIN,MAIN<VAR,THIS<GR,GR<VAR,BYTE*,GR*,THISLOC=THIS,GLOBALLOC=VAR")
466 @LATTICE("HEADER<VAR,VAR<THIS,C<THIS,THIS<IN,THISLOC=THIS,C*,VAR*")
467 public void decode(@LOC("THIS,LayerIIIDecoder.HD") Header header) {
469 // if (!initialized) {
473 // overwrites once per a loop
474 SSJAVA.arrayinit(samples1, 0);
475 SSJAVA.arrayinit(samples2, 0);
476 SSJAVA.arrayinit(ro, 2, SBLIMIT, SSLIMIT, 0);
477 SSJAVA.arrayinit(lr, 2, SBLIMIT, SSLIMIT, 0);
478 SSJAVA.arrayinit(is_pos, 7);
479 SSJAVA.arrayinit(is_ratio, 0);
480 SSJAVA.arrayinit(out_1d, 0);
481 SSJAVA.arrayinit(inter, 0);
482 SSJAVA.arrayinit(k, 2, SBLIMIT * SSLIMIT, 0);
483 SSJAVA.arrayinit(is_1d, 0);
484 SSJAVA.arrayinit(tsOutCopy, 0);
485 SSJAVA.arrayinit(scalefac_buffer, 0);
486 SSJAVA.arrayinit(nonzero, 576);
487 SSJAVA.arrayinit(new_slen, 0);
489 SSJAVA.arrayinit(raw_full, 2, SBLIMIT * SSLIMIT, 0);
490 SSJAVA.arrayinit(rawout, 0);
492 // prevblck = new float[2][SBLIMIT * SSLIMIT];
493 si = new III_side_info_t();
496 @LOC("THIS,LayerIIIDecoder.HD1") int nSlots = header.slots();
498 @LOC("THIS,LayerIIIDecoder.CH0") int gr;
499 @LOC("THIS,LayerIIIDecoder.CH0") int ch;
501 @LOC("THIS,LayerIIIDecoder.CH0") int ss;
502 @LOC("THIS,LayerIIIDecoder.CH0") int sb;
503 @LOC("THIS,LayerIIIDecoder.CH0") int sb18;
505 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int main_data_end;
506 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int flush_main;
508 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int bytes_to_discard;
511 // modifications for linear type
512 get_side_info(header);
513 br = header.getBitReserve();
515 @LOC("THIS,LayerIIIDecoder.HD1") int version = header.version();
517 // additional codes for the definitely written property
518 filter_pos = (header.getIdx() * 4) & 0xf;
521 filter1.actual_write_pos = filter_pos;
522 filter2.actual_write_pos = filter_pos;
524 // here 'gr' and 'max_gr' should be higher than 'ch','channels', and more
525 for (gr = 0; gr < max_gr; gr++) { // two granules per channel
526 // in the loop body, access set={part2_start}
528 // 'ch', 'channels' should be higher than all locs in the below body
529 for (ch = 0; ch < channels; ch++) {
530 // part2_start = br.hsstell();
531 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_start_local = br.hsstell();
533 // grab scale factors from the main data.
534 // following the scale factors is the actual compressed data
535 if (version == Header.MPEG1)
536 get_scale_factors(header, ch, gr); // no need to care from this side
537 // here move scale factor data from 'br' buffer to 'scalefac' field
539 // MPEG-2 LSF, SZD: MPEG-2.5 LSF
540 get_LSF_scale_factors(header, ch, gr); // no need to care from this
543 // here, decoding the compressed audio data
544 huffman_decode(part2_start_local, ch, gr); // no need to care from this
546 // System.out.println("CheckSum HuffMan = " + CheckSumHuff);
547 dequantize_sample(/* ro[ch], */ch, gr); // no need to care from this
551 stereo(header, gr); // no need to care from this side
553 if ((which_channels == OutputChannels.DOWNMIX_CHANNELS) && (channels > 1)) {
557 for (ch = first_channel; ch <= last_channel; ch++) { // 'ch' and
561 reorder(/* lr[ch], */ch, gr);
564 // float CheckSumOut1d=0;
565 // for (int hb = 0;hb<576;hb++) {
566 // CheckSumOut1d = CheckSumOut1d + out_1d[hb];
568 // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
570 for (@LOC("THIS,LayerIIIDecoder.SI1") int index = 0; index < 576; index++) {
571 out_1d[index] = inter[index];
576 // float CheckSumOut1d=0;
577 // for (int hb = 0;hb<576;hb++) {
578 // CheckSumOut1d = CheckSumOut1d + out_1d[hb];
580 // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
582 for (sb18 = 18; sb18 < 576; sb18 += 36) {
583 // sb18 > ss, SSLIMIT, out1d
584 // Frequency inversion
585 for (ss = 1; ss < SSLIMIT; ss += 2) {
586 // 'ss','SSLIMIT' > out_1d
587 out_1d[sb18 + ss] = -out_1d[sb18 + ss]; // out1d*
591 // 'ch', 'which_channels' should be higher than if/else body!
592 // location set written by if/else body
593 // = {samples1, samples2, filter1, filter2}
594 if ((ch == 0) || (which_channels == OutputChannels.RIGHT_CHANNEL)) {
595 for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
597 for (sb18 = 0; sb18 < 576; sb18 += 18) {
598 samples1[sb] = out_1d[sb18 + ss]; // out_1d > samples1
599 // filter1.input_sample(out_1d[sb18+ss], sb);
600 sb++; // sb should be loc*
602 filter1.input_samples(samples1);
603 // System.out.println("filter1 writepos=" + filter1.actual_write_pos
604 // + " vidx=" + filter1.vidx);
605 filter1.calculate_pcm_samples();
608 for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
610 for (sb18 = 0; sb18 < 576; sb18 += 18) {
611 samples2[sb] = out_1d[sb18 + ss]; // out_1d > samples2
612 // filter2.input_sample(out_1d[sb18+ss], sb);
615 filter2.input_samples(samples2);
616 filter2.calculate_pcm_samples();
619 // System.out.println("#END CH=" + ch + " actual_write_pos=" +
620 // filter1.actual_write_pos);
624 if (gr < max_gr - 1) {
626 SSJAVA.arrayinit(prevblck, 2, SBLIMIT * SSLIMIT, 0);
627 // copy from raw_full to prev
628 SSJAVA.arraycopy(prevblck, raw_full, 2, SBLIMIT * SSLIMIT);
630 // for (int chidx = 0; chidx < 2; chidx++) {
631 // for (int sidx = 0; sidx < SBLIMIT * SSLIMIT; sidx++) {
632 // prevblck[chidx][sidx] = raw_full[chidx][sidx];
635 // System.out.println("#END GR=" + gr + " actual_write_pos=" +
636 // filter1.actual_write_pos);
641 SSJAVA.arrayinit(prevblck, 2, SBLIMIT * SSLIMIT, 0);
642 // copy from raw_full to prev
643 SSJAVA.arraycopy(prevblck, raw_full, 2, SBLIMIT * SSLIMIT);
645 // System.out.println("#END FRAME actual_write_pos=" +
646 // filter1.actual_write_pos);
651 // System.out.println("Counter = ................................."+counter);
652 // if (counter < 609)
654 // counter++; // count should be loc*
655 // buffer.write_buffer(1); // buffer!!!
657 // else if (counter == 609)
669 * Reads the side info from the stream, assuming the entire. frame has been
670 * read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)
672 @LATTICE("OUT<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
673 private boolean get_side_info(@LOC("THIS,LayerIIIDecoder.HD1") Header header) {
675 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.TEMP") SideInfoBuffer sib =
676 header.getSideInfoBuffer();
677 @LOC("THIS,LayerIIIDecoder.SF1") int version = header.version();
679 @LOC("THIS,LayerIIIDecoder.SI0") int ch;
680 @LOC("THIS,LayerIIIDecoder.SI0") int gr;
681 // System.out.println("#get_side_info");
682 if (version == Header.MPEG1) {
684 si.main_data_begin = sib.get_bits(9);
686 si.private_bits = sib.get_bits(5);
688 si.private_bits = sib.get_bits(3);
690 for (ch = 0; ch < channels; ch++) {
691 si.ch[ch].scfsi[0] = sib.get_bits(1);
692 si.ch[ch].scfsi[1] = sib.get_bits(1);
693 si.ch[ch].scfsi[2] = sib.get_bits(1);
694 si.ch[ch].scfsi[3] = sib.get_bits(1);
697 // System.out.println("BEFORE GR,CH");
699 for (gr = 0; gr < 2; gr++) {
700 // System.out.println("GR=" + gr);
701 for (ch = 0; ch < channels; ch++) {
702 // System.out.println("CH");
703 si.ch[ch].gr[gr].part2_3_length = sib.get_bits(12);
704 si.ch[ch].gr[gr].big_values = sib.get_bits(9);
705 si.ch[ch].gr[gr].global_gain = sib.get_bits(8);
706 si.ch[ch].gr[gr].scalefac_compress = sib.get_bits(4);
707 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.TEMP") int cond = sib.get_bits(1);
708 // si.ch[ch].gr[gr].window_switching_flag = sib.get_bits(1);
709 // if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {
711 si.ch[ch].gr[gr].block_type = sib.get_bits(2);
712 si.ch[ch].gr[gr].mixed_block_flag = sib.get_bits(1);
714 si.ch[ch].gr[gr].table_select[0] = sib.get_bits(5);
715 si.ch[ch].gr[gr].table_select[1] = sib.get_bits(5);
717 si.ch[ch].gr[gr].subblock_gain[0] = sib.get_bits(3);
718 si.ch[ch].gr[gr].subblock_gain[1] = sib.get_bits(3);
719 si.ch[ch].gr[gr].subblock_gain[2] = sib.get_bits(3);
721 // Set region_count parameters since they are implicit
724 if (si.ch[ch].gr[gr].block_type == 0) {
725 // Side info bad: block_type == 0 in split block
727 } else if (si.ch[ch].gr[gr].block_type == 2 && si.ch[ch].gr[gr].mixed_block_flag == 0) {
728 si.ch[ch].gr[gr].region0_count = 8;
730 si.ch[ch].gr[gr].region0_count = 7;
732 si.ch[ch].gr[gr].region1_count = 20 - si.ch[ch].gr[gr].region0_count;
734 si.ch[ch].gr[gr].table_select[0] = sib.get_bits(5);
735 si.ch[ch].gr[gr].table_select[1] = sib.get_bits(5);
736 si.ch[ch].gr[gr].table_select[2] = sib.get_bits(5);
737 si.ch[ch].gr[gr].region0_count = sib.get_bits(4);
738 si.ch[ch].gr[gr].region1_count = sib.get_bits(3);
739 si.ch[ch].gr[gr].block_type = 0;
742 si.ch[ch].gr[gr].window_switching_flag = cond;
744 si.ch[ch].gr[gr].preflag = sib.get_bits(1);
745 si.ch[ch].gr[gr].scalefac_scale = sib.get_bits(1);
746 si.ch[ch].gr[gr].count1table_select = sib.get_bits(1);
750 } else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF
752 si.main_data_begin = sib.get_bits(8);
754 si.private_bits = sib.get_bits(1);
756 si.private_bits = sib.get_bits(2);
758 for (ch = 0; ch < channels; ch++) {
760 si.ch[ch].gr[0].part2_3_length = sib.get_bits(12);
761 si.ch[ch].gr[0].big_values = sib.get_bits(9);
762 si.ch[ch].gr[0].global_gain = sib.get_bits(8);
763 si.ch[ch].gr[0].scalefac_compress = sib.get_bits(9);
765 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.TEMP") int cond = sib.get_bits(1);
766 // si.ch[ch].gr[0].window_switching_flag = sib.get_bits(1);
767 // if ((si.ch[ch].gr[0].window_switching_flag) != 0) {
770 si.ch[ch].gr[0].block_type = sib.get_bits(2);
771 si.ch[ch].gr[0].mixed_block_flag = sib.get_bits(1);
772 si.ch[ch].gr[0].table_select[0] = sib.get_bits(5);
773 si.ch[ch].gr[0].table_select[1] = sib.get_bits(5);
775 si.ch[ch].gr[0].subblock_gain[0] = sib.get_bits(3);
776 si.ch[ch].gr[0].subblock_gain[1] = sib.get_bits(3);
777 si.ch[ch].gr[0].subblock_gain[2] = sib.get_bits(3);
779 // Set region_count parameters since they are implicit in
782 if (si.ch[ch].gr[0].block_type == 0) {
783 // Side info bad: block_type == 0 in split block
785 } else if (si.ch[ch].gr[0].block_type == 2 && si.ch[ch].gr[0].mixed_block_flag == 0) {
786 si.ch[ch].gr[0].region0_count = 8;
788 si.ch[ch].gr[0].region0_count = 7;
789 si.ch[ch].gr[0].region1_count = 20 - si.ch[ch].gr[0].region0_count;
793 si.ch[ch].gr[0].table_select[0] = sib.get_bits(5);
794 si.ch[ch].gr[0].table_select[1] = sib.get_bits(5);
795 si.ch[ch].gr[0].table_select[2] = sib.get_bits(5);
796 si.ch[ch].gr[0].region0_count = sib.get_bits(4);
797 si.ch[ch].gr[0].region1_count = sib.get_bits(3);
798 si.ch[ch].gr[0].block_type = 0;
801 si.ch[ch].gr[gr].window_switching_flag = cond;
804 si.ch[ch].gr[0].scalefac_scale = sib.get_bits(1);
805 si.ch[ch].gr[0].count1table_select = sib.get_bits(1);
806 } // for(ch=0; ch<channels; ch++)
807 } // if (header.version() == MPEG1)
814 @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
815 @PCLOC("THIS,LayerIIIDecoder.SF15")
816 private void get_scale_factors(@LOC("THIS,LayerIIIDecoder.SF1") Header header,
817 @LOC("THIS,LayerIIIDecoder.SF1") int ch, @LOC("THIS,LayerIIIDecoder.SF1") int gr) {
819 // gr_info_s gr_info = (si.ch[ch].gr[gr]); remove alias
821 @LOC("THIS,LayerIIIDecoder.NS") int sfb;
822 @LOC("THIS,LayerIIIDecoder.NS") int window;
823 @LOC("THIS,LayerIIIDecoder.NS") int scale_comp = si.ch[ch].gr[gr].scalefac_compress;
824 @LOC("THIS,LayerIIIDecoder.NS") int length0 = slen[0][scale_comp];
825 @LOC("THIS,LayerIIIDecoder.NS") int length1 = slen[1][scale_comp];
827 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
828 if ((si.ch[ch].gr[gr].mixed_block_flag) != 0) { // MIXED
829 for (sfb = 0; sfb < 8; sfb++)
830 scalefac[ch].l[sfb] = br.hgetbits(slen[0][si.ch[ch].gr[gr].scalefac_compress]);
831 for (sfb = 3; sfb < 6; sfb++)
832 for (window = 0; window < 3; window++)
833 scalefac[ch].s[window][sfb] = br.hgetbits(slen[0][si.ch[ch].gr[gr].scalefac_compress]);
834 for (sfb = 6; sfb < 12; sfb++)
835 for (window = 0; window < 3; window++)
836 scalefac[ch].s[window][sfb] = br.hgetbits(slen[1][si.ch[ch].gr[gr].scalefac_compress]);
837 for (sfb = 12, window = 0; window < 3; window++)
838 scalefac[ch].s[window][sfb] = 0;
842 scalefac[ch].s[0][0] = br.hgetbits(length0);
843 scalefac[ch].s[1][0] = br.hgetbits(length0);
844 scalefac[ch].s[2][0] = br.hgetbits(length0);
845 scalefac[ch].s[0][1] = br.hgetbits(length0);
846 scalefac[ch].s[1][1] = br.hgetbits(length0);
847 scalefac[ch].s[2][1] = br.hgetbits(length0);
848 scalefac[ch].s[0][2] = br.hgetbits(length0);
849 scalefac[ch].s[1][2] = br.hgetbits(length0);
850 scalefac[ch].s[2][2] = br.hgetbits(length0);
851 scalefac[ch].s[0][3] = br.hgetbits(length0);
852 scalefac[ch].s[1][3] = br.hgetbits(length0);
853 scalefac[ch].s[2][3] = br.hgetbits(length0);
854 scalefac[ch].s[0][4] = br.hgetbits(length0);
855 scalefac[ch].s[1][4] = br.hgetbits(length0);
856 scalefac[ch].s[2][4] = br.hgetbits(length0);
857 scalefac[ch].s[0][5] = br.hgetbits(length0);
858 scalefac[ch].s[1][5] = br.hgetbits(length0);
859 scalefac[ch].s[2][5] = br.hgetbits(length0);
860 scalefac[ch].s[0][6] = br.hgetbits(length1);
861 scalefac[ch].s[1][6] = br.hgetbits(length1);
862 scalefac[ch].s[2][6] = br.hgetbits(length1);
863 scalefac[ch].s[0][7] = br.hgetbits(length1);
864 scalefac[ch].s[1][7] = br.hgetbits(length1);
865 scalefac[ch].s[2][7] = br.hgetbits(length1);
866 scalefac[ch].s[0][8] = br.hgetbits(length1);
867 scalefac[ch].s[1][8] = br.hgetbits(length1);
868 scalefac[ch].s[2][8] = br.hgetbits(length1);
869 scalefac[ch].s[0][9] = br.hgetbits(length1);
870 scalefac[ch].s[1][9] = br.hgetbits(length1);
871 scalefac[ch].s[2][9] = br.hgetbits(length1);
872 scalefac[ch].s[0][10] = br.hgetbits(length1);
873 scalefac[ch].s[1][10] = br.hgetbits(length1);
874 scalefac[ch].s[2][10] = br.hgetbits(length1);
875 scalefac[ch].s[0][11] = br.hgetbits(length1);
876 scalefac[ch].s[1][11] = br.hgetbits(length1);
877 scalefac[ch].s[2][11] = br.hgetbits(length1);
878 scalefac[ch].s[0][12] = 0;
879 scalefac[ch].s[1][12] = 0;
880 scalefac[ch].s[2][12] = 0;
883 } else { // LONG types 0,1,3
885 if ((si.ch[ch].scfsi[0] == 0) || (gr == 0)) {
886 scalefac[ch].l[0] = br.hgetbits(length0);
887 scalefac[ch].l[1] = br.hgetbits(length0);
888 scalefac[ch].l[2] = br.hgetbits(length0);
889 scalefac[ch].l[3] = br.hgetbits(length0);
890 scalefac[ch].l[4] = br.hgetbits(length0);
891 scalefac[ch].l[5] = br.hgetbits(length0);
893 if ((si.ch[ch].scfsi[1] == 0) || (gr == 0)) {
894 scalefac[ch].l[6] = br.hgetbits(length0);
895 scalefac[ch].l[7] = br.hgetbits(length0);
896 scalefac[ch].l[8] = br.hgetbits(length0);
897 scalefac[ch].l[9] = br.hgetbits(length0);
898 scalefac[ch].l[10] = br.hgetbits(length0);
900 if ((si.ch[ch].scfsi[2] == 0) || (gr == 0)) {
901 scalefac[ch].l[11] = br.hgetbits(length1);
902 scalefac[ch].l[12] = br.hgetbits(length1);
903 scalefac[ch].l[13] = br.hgetbits(length1);
904 scalefac[ch].l[14] = br.hgetbits(length1);
905 scalefac[ch].l[15] = br.hgetbits(length1);
907 if ((si.ch[ch].scfsi[3] == 0) || (gr == 0)) {
908 scalefac[ch].l[16] = br.hgetbits(length1);
909 scalefac[ch].l[17] = br.hgetbits(length1);
910 scalefac[ch].l[18] = br.hgetbits(length1);
911 scalefac[ch].l[19] = br.hgetbits(length1);
912 scalefac[ch].l[20] = br.hgetbits(length1);
915 scalefac[ch].l[21] = 0;
916 scalefac[ch].l[22] = 0;
923 // MDM: new_slen is fully initialized before use, no need
924 // to reallocate array.
926 private int[] new_slen = new int[4];
929 @LATTICE("M<THIS,THIS<IN,THIS<C,C*,M*,THISLOC=THIS,GLOBALLOC=THIS")
930 @PCLOC("THIS,LayerIIIDecoder.SI0")
931 private void get_LSF_scale_data(@LOC("THIS,LayerIIIDecoder.SF15") Header header,
932 @LOC("THIS,LayerIIIDecoder.SF15") int ch, @LOC("THIS,LayerIIIDecoder.SF15") int gr) {
934 @LOC("THIS,LayerIIIDecoder.SI0") int mode_ext = header.mode_extension();
935 // @LOC("THIS,LayerIIIDecoder.GLSFD1") gr_info_s gr_info =
936 // (si.ch[ch].gr[gr]); // remove alias
938 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR,gr_info_s.V") int scalefac_comp =
939 si.ch[ch].gr[gr].scalefac_compress;
940 @LOC("THIS,LayerIIIDecoder.NS") int blocktypenumber;
942 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR,gr_info_s.V") int int_scalefac_comp;
943 @LOC("THIS,LayerIIIDecoder.SFB_SH") int m;
944 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR,gr_info_s.V") int blocknumber =
947 if (si.ch[ch].gr[gr].block_type == 2) {
948 if (si.ch[ch].gr[gr].mixed_block_flag == 0) {
950 } else if (si.ch[ch].gr[gr].mixed_block_flag == 1) {
959 if (!(((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
961 if (scalefac_comp < 400) {
963 new_slen[0] = (scalefac_comp >>> 4) / 5;
964 new_slen[1] = (scalefac_comp >>> 4) % 5;
965 new_slen[2] = (scalefac_comp & 0xF) >>> 2;
966 new_slen[3] = (scalefac_comp & 3);
967 si.ch[ch].gr[gr].preflag = 0;
970 } else if (scalefac_comp < 500) {
972 new_slen[0] = ((scalefac_comp - 400) >>> 2) / 5;
973 new_slen[1] = ((scalefac_comp - 400) >>> 2) % 5;
974 new_slen[2] = (scalefac_comp - 400) & 3;
976 si.ch[ch].gr[gr].preflag = 0;
979 } else if (scalefac_comp < 512) {
981 new_slen[0] = (scalefac_comp - 500) / 3;
982 new_slen[1] = (scalefac_comp - 500) % 3;
985 si.ch[ch].gr[gr].preflag = 1;
990 if ((((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
991 int_scalefac_comp = scalefac_comp >>> 1;
993 if (int_scalefac_comp < 180) {
994 new_slen[0] = int_scalefac_comp / 36;
995 new_slen[1] = (int_scalefac_comp % 36) / 6;
996 new_slen[2] = (int_scalefac_comp % 36) % 6;
998 si.ch[ch].gr[gr].preflag = 0;
1000 } else if (int_scalefac_comp < 244) {
1001 new_slen[0] = ((int_scalefac_comp - 180) & 0x3F) >>> 4;
1002 new_slen[1] = ((int_scalefac_comp - 180) & 0xF) >>> 2;
1003 new_slen[2] = (int_scalefac_comp - 180) & 3;
1005 si.ch[ch].gr[gr].preflag = 0;
1007 } else if (int_scalefac_comp < 255) {
1008 new_slen[0] = (int_scalefac_comp - 244) / 3;
1009 new_slen[1] = (int_scalefac_comp - 244) % 3;
1012 si.ch[ch].gr[gr].preflag = 0;
1017 // for (@LOC("THIS,LayerIIIDecoder.NS") int x = 0; x < 45; x++)
1018 // // why 45, not 54?
1019 // scalefac_buffer[x] = 0;
1022 for (@LOC("THIS,LayerIIIDecoder.NS") int i = 0; i < 4; i++) {
1023 @LOC("THIS,LayerIIIDecoder.NS") int jmax = nr_of_sfb_block[blocknumber][blocktypenumber][i];
1024 for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < jmax; j++) {
1025 scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);
1028 } // for (unint32 j ...
1029 } // for (uint32 i ...
1035 @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
1036 @PCLOC("THIS,LayerIIIDecoder.SF15")
1037 private void get_LSF_scale_factors(@LOC("THIS,LayerIIIDecoder.SF1") Header header,
1038 @LOC("THIS,LayerIIIDecoder.SF1") int ch, @LOC("THIS,LayerIIIDecoder.SF1") int gr) {
1040 @LOC("THIS,LayerIIIDecoder.SFB_SH") int sfb;
1041 @LOC("THIS,LayerIIIDecoder.SFB_SH") int m = 0;
1042 @LOC("THIS,LayerIIIDecoder.SFB_SH") int window;
1043 // gr_info_s gr_info = (si.ch[ch].gr[gr]); // remove alias
1045 get_LSF_scale_data(header, ch, gr);
1047 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
1048 if (si.ch[ch].gr[gr].mixed_block_flag != 0) { // MIXED
1049 for (sfb = 0; sfb < 8; sfb++) {
1050 scalefac[ch].l[sfb] = scalefac_buffer[m];
1053 for (sfb = 3; sfb < 12; sfb++) {
1054 for (window = 0; window < 3; window++) {
1055 scalefac[ch].s[window][sfb] = scalefac_buffer[m];
1059 for (window = 0; window < 3; window++)
1060 scalefac[ch].s[window][12] = 0;
1064 for (sfb = 0; sfb < 12; sfb++) {
1065 for (window = 0; window < 3; window++) {
1066 scalefac[ch].s[window][sfb] = scalefac_buffer[m];
1071 for (window = 0; window < 3; window++)
1072 scalefac[ch].s[window][12] = 0;
1074 } else { // LONG types 0,1,3
1076 for (sfb = 0; sfb < 21; sfb++) {
1077 scalefac[ch].l[sfb] = scalefac_buffer[m];
1080 scalefac[ch].l[21] = 0; // Jeff
1081 scalefac[ch].l[22] = 0;
1105 @LATTICE("VAR<OUT,OUT<THIS,THIS<RE,THISLOC=THIS,GLOBALLOC=OUT,RETURNLOC=OUT")
1106 private void huffman_decode(@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_start_local,
1107 @LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
1109 @LOC("THIS,LayerIIIDecoder.IS1D") int x[] = new int[1];
1110 @LOC("THIS,LayerIIIDecoder.IS1D") int y[] = new int[1];
1111 @LOC("THIS,LayerIIIDecoder.IS1D") int v[] = new int[1];
1112 @LOC("THIS,LayerIIIDecoder.IS1D") int w[] = new int[1];
1114 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_3_end =
1115 part2_start_local + si.ch[ch].gr[gr].part2_3_length;
1116 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int num_bits;
1117 @LOC("THIS,LayerIIIDecoder.SI1") int region1Start;
1118 @LOC("THIS,LayerIIIDecoder.SI1") int region2Start;
1119 @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int index;
1121 @LOC("THIS,LayerIIIDecoder.SI1") int buf;
1122 @LOC("THIS,LayerIIIDecoder.SI1") int buf1;
1124 // Find region boundary for short block case
1126 if (((si.ch[ch].gr[gr].window_switching_flag) != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
1129 // MS: Extrahandling for 8KHZ
1130 region1Start = (sfreq == 8) ? 72 : 36; // sfb[9/3]*3=36 or in case
1132 region2Start = 576; // No Region2 for short block case
1134 } else { // Find region boundary for long block case
1136 buf = si.ch[ch].gr[gr].region0_count + 1;
1137 buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;
1139 if (buf1 > sfBandIndex[sfreq].l.length - 1)
1140 buf1 = sfBandIndex[sfreq].l.length - 1;
1142 region1Start = sfBandIndex[sfreq].l[buf];
1143 region2Start = sfBandIndex[sfreq].l[buf1]; /* MI */
1147 // Read bigvalues area
1148 TERMINATE: for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
1151 @LOC("THIS,LayerIIIDecoder.SI2") int htIdx;
1152 if (i < region1Start) {
1153 htIdx = si.ch[ch].gr[gr].table_select[0];
1154 // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
1155 } else if (i < region2Start) {
1156 htIdx = si.ch[ch].gr[gr].table_select[1];
1157 // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];
1159 htIdx = si.ch[ch].gr[gr].table_select[2];
1160 // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];
1163 huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
1164 // if (index >= is_1d.length)
1165 // System.out.println("i0="+i+"/"+(si.ch[ch].gr[gr].big_values<<1)+" Index="+index+" is_1d="+is_1d.length);
1167 is_1d[index++] = x[0];
1168 is_1d[index++] = y[0];
1170 CheckSumHuff = CheckSumHuff + x[0] + y[0];
1171 // System.out.println("x = " + x[0] + " y = " + y[0]);
1176 @LOC("THIS,LayerIIIDecoder.SI2") int htIdx = si.ch[ch].gr[gr].count1table_select + 32;
1177 // h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
1178 num_bits = br.hsstell();
1180 TERMINATE: while ((num_bits < part2_3_end) && (index < 576)) {
1182 huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
1184 is_1d[index++] = v[0];
1185 is_1d[index++] = w[0];
1186 is_1d[index++] = x[0];
1187 is_1d[index++] = y[0];
1188 CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];
1189 // System.out.println("v = "+v[0]+" w = "+w[0]);
1190 // System.out.println("x = "+x[0]+" y = "+y[0]);
1191 num_bits = br.hsstell();
1194 if (num_bits > part2_3_end) {
1195 br.rewindNbits(num_bits - part2_3_end);
1199 num_bits = br.hsstell();
1201 // Dismiss stuffing bits
1202 if (num_bits < part2_3_end)
1203 br.hgetbits(part2_3_end - num_bits);
1208 nonzero[ch] = index;
1215 // may not be necessary
1216 for (; index < 576; index++)
1220 @LATTICE("THIS,IN,THISLOC=THIS,RETURNLOC=THIS")
1221 private int huffcodetab_huffman_decoder(@LOC("IN") int h) {
1222 // TODO need to move huffmancodetab implementation here
1229 @PCLOC("THIS,LayerIIIDecoder.LR")
1230 private void i_stereo_k_values(@LOC("THIS,LayerIIIDecoder.LR") int is_pos,
1231 @LOC("THIS,LayerIIIDecoder.LR") int io_type, @LOC("THIS,LayerIIIDecoder.LR") int i) {
1235 } else if ((is_pos & 1) != 0) {
1236 k[0][i] = io[io_type][(is_pos + 1) >>> 1];
1240 k[1][i] = io[io_type][is_pos >>> 1];
1247 // @LATTICE("OUT<QUO,QUO<REST,REST<IDX,IDX<VAR,VAR<CB,CB<J,CB<GR,GR<IN,J<IN,QUO*,REST*,IDX*,CB*,J*,THISLOC=IN,GLOBALLOC=IN")
1248 @LATTICE("THIS,THISLOC=THIS,GLOBALLOC=THIS")
1250 private void dequantize_sample(
1251 /* @LOC("OUT") float xr[][], */@LOC("THIS,LayerIIIDecoder.SI") int ch,
1252 @LOC("THIS,LayerIIIDecoder.SI") int gr) {
1254 // @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]); remove alias!
1255 @LOC("THIS,LayerIIIDecoder.SI1") int cb = 0;
1257 @LOC("THIS,LayerIIIDecoder.SI1") int next_cb_boundary;
1258 @LOC("THIS,LayerIIIDecoder.SI1") int cb_begin = 0;
1259 @LOC("THIS,LayerIIIDecoder.SI1") int cb_width = 0;
1260 @LOC("THIS,LayerIIIDecoder.SI1") float g_gain;
1262 @LOC("THIS,LayerIIIDecoder.SI1") int index = 0;
1263 @LOC("THIS,LayerIIIDecoder.SI1") int t_index;
1264 @LOC("THIS,LayerIIIDecoder.NZ") int j;
1266 // float[][] xr_1d = xr;//substituted xr for instances of xr_1d to decrease
1269 // choose correct scalefactor band per block type, initalize boundary
1271 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
1272 if (si.ch[ch].gr[gr].mixed_block_flag != 0)
1273 next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
1275 cb_width = sfBandIndex[sfreq].s[1];
1276 next_cb_boundary = (cb_width << 2) - cb_width;
1280 next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
1283 // Compute overall (global) scaling.
1285 g_gain = (float) Math.pow(2.0, (0.25 * (si.ch[ch].gr[gr].global_gain - 210.0)));
1287 for (j = 0; j < nonzero[ch]; j++) {
1288 // Modif E.B 02/22/99
1289 @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
1290 @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
1291 if (is_1d[j] == 0) {
1292 ro[ch][quotien][reste] = 0.0f;
1294 @LOC("THIS,LayerIIIDecoder.IS1D") int abv = is_1d[j];
1295 // Pow Array fix (11/17/04)
1296 if (abv < t_43.length) {
1298 ro[ch][quotien][reste] = g_gain * t_43[abv];
1300 if (-abv < t_43.length)
1301 ro[ch][quotien][reste] = -g_gain * t_43[-abv];
1303 ro[ch][quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
1307 ro[ch][quotien][reste] = g_gain * (float) Math.pow(abv, d43);
1309 ro[ch][quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
1314 // apply formula per block type
1315 for (j = 0; j < nonzero[ch]; j++) {
1316 // Modif E.B 02/22/99
1317 @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
1318 @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
1320 if (index == next_cb_boundary) { /* Adjust critical band boundary */
1321 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
1322 if (si.ch[ch].gr[gr].mixed_block_flag != 0) {
1324 if (index == sfBandIndex[sfreq].l[8]) {
1325 next_cb_boundary = sfBandIndex[sfreq].s[4];
1326 next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
1328 cb_width = sfBandIndex[sfreq].s[4] - sfBandIndex[sfreq].s[3];
1330 cb_begin = sfBandIndex[sfreq].s[3];
1331 cb_begin = (cb_begin << 2) - cb_begin;
1333 } else if (index < sfBandIndex[sfreq].l[8]) {
1335 next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
1339 next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
1340 next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
1342 cb_begin = sfBandIndex[sfreq].s[cb];
1343 cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
1344 cb_begin = (cb_begin << 2) - cb_begin;
1349 next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
1350 next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
1352 cb_begin = sfBandIndex[sfreq].s[cb];
1353 cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
1354 cb_begin = (cb_begin << 2) - cb_begin;
1357 } else { // long blocks
1359 next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
1364 // Do long/short dependent scaling operations
1366 if ((si.ch[ch].gr[gr].window_switching_flag != 0)
1367 && (((si.ch[ch].gr[gr].block_type == 2) && (si.ch[ch].gr[gr].mixed_block_flag == 0)) || ((si.ch[ch].gr[gr].block_type == 2)
1368 && (si.ch[ch].gr[gr].mixed_block_flag != 0) && (j >= 36)))) {
1370 t_index = (index - cb_begin) / cb_width;
1372 * xr[sb][ss] *= pow(2.0, ((-2.0 * gr_info.subblock_gain[t_index]) -(0.5
1373 * * (1.0 + gr_info.scalefac_scale) scalefac[ch].s[t_index][cb])));
1375 @LOC("THIS,LayerIIIDecoder.SI1") int idx =
1376 scalefac[ch].s[t_index][cb] << si.ch[ch].gr[gr].scalefac_scale;
1377 idx += (si.ch[ch].gr[gr].subblock_gain[t_index] << 2);
1379 ro[ch][quotien][reste] *= two_to_negative_half_pow[idx];
1381 } else { // LONG block types 0,1,3 & 1st 2 subbands of switched blocks
1383 * xr[sb][ss] *= pow(2.0, -0.5 * (1.0+gr_info.scalefac_scale)
1384 * (scalefac[ch].l[cb] + gr_info.preflag * pretab[cb]));
1386 @LOC("THIS,LayerIIIDecoder.SI1") int idx = scalefac[ch].l[cb];
1388 if (si.ch[ch].gr[gr].preflag != 0)
1391 idx = idx << si.ch[ch].gr[gr].scalefac_scale;
1392 ro[ch][quotien][reste] *= two_to_negative_half_pow[idx];
1397 for (j = nonzero[ch]; j < 576; j++) {
1398 // Modif E.B 02/22/99
1399 @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
1400 @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
1405 ro[ch][quotien][reste] = 0.0f;
1415 // @LATTICE("THIS<I,I<GR,GR<IN,I*,THISLOC=THIS,GLOBALLOC=IN")
1416 @LATTICE("THIS,THISLOC=THIS,GLOBALLOC=THIS")
1417 private void reorder(/* @LOC("IN") float xr[][], */@LOC("THIS,LayerIIIDecoder.CH0") int ch,
1418 @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
1419 // the purpose of reordering: move 'short samples' back to their original
1421 // after reorder, the samples are no long ordered by frequency
1423 // the format of input data to reorder:
1424 // three small chunks of 192 samples each are combined to 576 samples
1425 // ordered by frequency
1427 // gr_info_s gr_info = (si.ch[ch].gr[gr]); //remove alias
1429 @LOC("THIS,LayerIIIDecoder.SI1") int index;
1431 @LOC("THIS,LayerIIIDecoder.SI1") int freq;
1432 @LOC("THIS,LayerIIIDecoder.SI1") int freq3;
1433 @LOC("THIS,LayerIIIDecoder.SI1") int sfb;
1434 @LOC("THIS,LayerIIIDecoder.SI1") int sfb_start;
1435 @LOC("THIS,LayerIIIDecoder.SI1") int sfb_lines;
1436 @LOC("THIS,LayerIIIDecoder.SI1") int src_line;
1437 @LOC("THIS,LayerIIIDecoder.SI1") int des_line;
1438 // float[][] xr_1d = xr; subbed in xr for xr_1d so as not to create extra
1441 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
1443 // for (index = 0; index < 576; index++) {
1444 // inter[index] = 0.0f;
1447 if (si.ch[ch].gr[gr].mixed_block_flag != 0) {
1448 // NO REORDER FOR LOW 2 SUBBANDS
1449 for (index = 0; index < 36; index++) {
1450 // Modif E.B 02/22/99
1451 @LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
1452 @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
1453 inter[index] = lr[ch][quotien][reste];
1455 // REORDERING FOR REST SWITCHED SHORT
1457 * for( sfb=3,sfb_start=sfBandIndex[sfreq].s[3],
1458 * sfb_lines=sfBandIndex[sfreq].s[4] - sfb_start; sfb < 13;
1459 * sfb++,sfb_start = sfBandIndex[sfreq].s[sfb], sfb_lines =
1460 * sfBandIndex[sfreq].s[sfb+1] - sfb_start ) {
1462 for (sfb = 3; sfb < 13; sfb++) {
1463 // System.out.println("sfreq="+sfreq+" sfb="+sfb+" sfBandIndex="+sfBandIndex.length+" sfBandIndex[sfreq].s="+sfBandIndex[sfreq].s.length);
1464 sfb_start = sfBandIndex[sfreq].s[sfb];
1465 sfb_lines = sfBandIndex[sfreq].s[sfb + 1] - sfb_start;
1467 @LOC("THIS,LayerIIIDecoder.SI1") int sfb_start3 = (sfb_start << 2) - sfb_start;
1469 for (freq = 0, freq3 = 0; freq < sfb_lines; freq++, freq3 += 3) {
1471 src_line = sfb_start3 + freq;
1472 des_line = sfb_start3 + freq3;
1473 // Modif E.B 02/22/99
1474 @LOC("THIS,LayerIIIDecoder.SI1") int reste = src_line % SSLIMIT;
1475 @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((src_line - reste) / SSLIMIT);
1477 inter[des_line] = lr[ch][quotien][reste];
1478 src_line += sfb_lines;
1481 reste = src_line % SSLIMIT;
1482 quotien = (int) ((src_line - reste) / SSLIMIT);
1484 inter[des_line] = lr[ch][quotien][reste];
1485 src_line += sfb_lines;
1488 reste = src_line % SSLIMIT;
1489 quotien = (int) ((src_line - reste) / SSLIMIT);
1491 inter[des_line] = lr[ch][quotien][reste];
1495 } else { // pure short
1496 for (index = 0; index < 576; index++) {
1497 @LOC("THIS,LayerIIIDecoder.SI1") int j = reorder_table[sfreq][index];
1498 @LOC("THIS,LayerIIIDecoder.SI1") int reste = j % SSLIMIT;
1499 @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((j - reste) / SSLIMIT);
1500 inter[index] = lr[ch][quotien][reste];
1503 } else { // long blocks
1504 for (index = 0; index < 576; index++) {
1505 // Modif E.B 02/22/99
1506 @LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
1507 @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
1508 inter[index] = lr[ch][quotien][reste];
1518 int[] is_pos = new int[576];
1520 float[] is_ratio = new float[576];
1523 @LATTICE("IO<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
1524 private void stereo(@LOC("THIS,LayerIIIDecoder.HD1") Header header,
1525 @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
1526 @LOC("THIS,LayerIIIDecoder.RO1") int sb;
1527 @LOC("THIS,LayerIIIDecoder.RO1") int ss;
1529 if (channels == 1) { // mono , bypass xr[0][][] to lr[0][][]
1531 for (sb = 0; sb < SBLIMIT; sb++)
1532 for (ss = 0; ss < SSLIMIT; ss += 3) {
1533 lr[0][sb][ss] = ro[0][sb][ss];
1534 lr[0][sb][ss + 1] = ro[0][sb][ss + 1];
1535 lr[0][sb][ss + 2] = ro[0][sb][ss + 2];
1540 // gr_info_s gr_info = (si.ch[0].gr[gr]); remove alias
1541 @LOC("THIS,LayerIIIDecoder.SF1") int mode_ext = header.mode_extension();
1543 @LOC("THIS,LayerIIIDecoder.RO1") int sfb;
1544 @LOC("THIS,LayerIIIDecoder.RO1") int i;
1545 @LOC("THIS,LayerIIIDecoder.RO1") int lines;
1546 @LOC("THIS,LayerIIIDecoder.RO1") int temp;
1547 @LOC("THIS,LayerIIIDecoder.RO1") int temp2;
1549 @LOC("THIS,LayerIIIDecoder.SF15") boolean ms_stereo =
1550 ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x2) != 0));
1551 @LOC("THIS,LayerIIIDecoder.SF15") boolean i_stereo =
1552 ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x1) != 0));
1553 @LOC("THIS,LayerIIIDecoder.SF15") boolean lsf =
1554 ((header.version() == Header.MPEG2_LSF || header.version() == Header.MPEG25_LSF)); // SZD
1556 @LOC("THIS,LayerIIIDecoder.LR") int io_type = (si.ch[0].gr[gr].scalefac_compress & 1);
1559 // for (i = 0; i < 576; i++) {
1561 // is_ratio[i] = 0.0f;
1565 if ((si.ch[0].gr[gr].window_switching_flag != 0) && (si.ch[0].gr[gr].block_type == 2)) {
1566 if (si.ch[0].gr[gr].mixed_block_flag != 0) {
1568 @LOC("THIS,LayerIIIDecoder.RO1") int max_sfb = 0;
1570 for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
1571 @LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
1573 TERMINATE: for (sfb = 12; sfb >= 3; sfb--) {
1574 i = sfBandIndex[sfreq].s[sfb];
1575 lines = sfBandIndex[sfreq].s[sfb + 1] - i;
1576 i = (i << 2) - i + (j + 1) * lines - 1;
1577 TERMINATE: while (lines > 0) {
1578 if (ro[1][i / 18][i % 18] != 0.0f) {
1579 // MDM: in java, array access is very slow.
1580 // Is quicker to compute div and mod values.
1581 // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
1590 } // while (lines > 0)
1592 } // for (sfb=12 ...
1599 temp = sfBandIndex[sfreq].s[sfb];
1600 sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
1601 i = (temp << 2) - temp + j * sb;
1603 TERMINATE: for (; sb > 0; sb--) {
1604 is_pos[i] = scalefac[1].s[j][sfb];
1607 i_stereo_k_values(is_pos[i], io_type, i);
1609 is_ratio[i] = TAN12[is_pos[i]];
1614 } // while (sfb < 12)
1615 sfb = sfBandIndex[sfreq].s[10];
1616 sb = sfBandIndex[sfreq].s[11] - sfb;
1617 sfb = (sfb << 2) - sfb + j * sb;
1618 temp = sfBandIndex[sfreq].s[11];
1619 sb = sfBandIndex[sfreq].s[12] - temp;
1620 i = (temp << 2) - temp + j * sb;
1621 TERMINATE: for (; sb > 0; sb--) {
1622 is_pos[i] = is_pos[sfb];
1625 k[0][i] = k[0][sfb];
1626 k[1][i] = k[1][sfb];
1628 is_ratio[i] = is_ratio[sfb];
1631 } // for (; sb > 0 ...
1637 TERMINATE: while (i >= 0) {
1638 if (ro[1][i][ss] != 0.0f) {
1639 sb = (i << 4) + (i << 1) + ss;
1650 while (sfBandIndex[sfreq].l[i] <= sb)
1653 i = sfBandIndex[sfreq].l[i];
1654 for (; sfb < 8; sfb++) {
1655 sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
1656 TERMINATE: for (; sb > 0; sb--) {
1657 is_pos[i] = scalefac[1].l[sfb];
1660 i_stereo_k_values(is_pos[i], io_type, i);
1662 is_ratio[i] = TAN12[is_pos[i]];
1664 } // for (; sb>0 ...
1665 } // for (; sfb<8 ...
1667 } else { // if (gr_info.mixed_block_flag)
1668 for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
1669 @LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
1671 TERMINATE: for (sfb = 12; sfb >= 0; sfb--) {
1672 temp = sfBandIndex[sfreq].s[sfb];
1673 lines = sfBandIndex[sfreq].s[sfb + 1] - temp;
1674 i = (temp << 2) - temp + (j + 1) * lines - 1;
1675 TERMINATE: while (lines > 0) {
1676 if (ro[1][i / 18][i % 18] != 0.0f) {
1677 // MDM: in java, array access is very slow.
1678 // Is quicker to compute div and mod values.
1679 // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
1686 } // while (lines > 0) */
1688 } // for (sfb=12 ...
1691 temp = sfBandIndex[sfreq].s[sfb];
1692 sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
1693 i = (temp << 2) - temp + j * sb;
1694 TERMINATE: for (; sb > 0; sb--) {
1695 is_pos[i] = scalefac[1].s[j][sfb];
1698 i_stereo_k_values(is_pos[i], io_type, i);
1700 is_ratio[i] = TAN12[is_pos[i]];
1702 } // for (; sb>0 ...
1706 temp = sfBandIndex[sfreq].s[10];
1707 temp2 = sfBandIndex[sfreq].s[11];
1709 sfb = (temp << 2) - temp + j * sb;
1710 sb = sfBandIndex[sfreq].s[12] - temp2;
1711 i = (temp2 << 2) - temp2 + j * sb;
1712 TERMINATE: for (; sb > 0; sb--) {
1713 is_pos[i] = is_pos[sfb];
1716 k[0][i] = k[0][sfb];
1717 k[1][i] = k[1][sfb];
1719 is_ratio[i] = is_ratio[sfb];
1722 } // for (; sb>0 ...
1725 } else { // if (gr_info.window_switching_flag ...
1729 TERMINATE: while (i >= 0) {
1730 if (ro[1][i][ss] != 0.0f) {
1731 sb = (i << 4) + (i << 1) + ss;
1742 while (sfBandIndex[sfreq].l[i] <= sb)
1746 i = sfBandIndex[sfreq].l[i];
1747 for (; sfb < 21; sfb++) {
1748 sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
1749 TERMINATE: for (; sb > 0; sb--) {
1750 is_pos[i] = scalefac[1].l[sfb];
1753 i_stereo_k_values(is_pos[i], io_type, i);
1755 is_ratio[i] = TAN12[is_pos[i]];
1759 sfb = sfBandIndex[sfreq].l[20];
1760 TERMINATE: for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
1761 is_pos[i] = is_pos[sfb]; // error here : i >=576
1764 k[0][i] = k[0][sfb];
1765 k[1][i] = k[1][sfb];
1767 is_ratio[i] = is_ratio[sfb];
1770 } // if (gr_info.mixed_block_flag)
1771 } // if (gr_info.window_switching_flag ...
1775 for (sb = 0; sb < SBLIMIT; sb++)
1776 for (ss = 0; ss < SSLIMIT; ss++) {
1777 if (is_pos[i] == 7) {
1779 lr[0][sb][ss] = (ro[0][sb][ss] + ro[1][sb][ss]) * 0.707106781f;
1780 lr[1][sb][ss] = (ro[0][sb][ss] - ro[1][sb][ss]) * 0.707106781f;
1782 lr[0][sb][ss] = ro[0][sb][ss];
1783 lr[1][sb][ss] = ro[1][sb][ss];
1785 } else if (i_stereo) {
1788 lr[0][sb][ss] = ro[0][sb][ss] * k[0][i];
1789 lr[1][sb][ss] = ro[0][sb][ss] * k[1][i];
1791 lr[1][sb][ss] = ro[0][sb][ss] / (float) (1 + is_ratio[i]);
1792 lr[0][sb][ss] = lr[1][sb][ss] * is_ratio[i];
1796 * else { System.out.println("Error in stereo processing\n"); }
1808 // @LATTICE("THIS<SRC,SRC<SS,SS<SB18,SB18<SB18LIM,SB18LIM<GR,GR<IN,SB18*,SS*,THISLOC=THIS")
1809 @LATTICE("VAR<THIS,THIS<C,C<IN,THISLOC=THIS,C*")
1810 private void antialias(@LOC("THIS,LayerIIIDecoder.SI") int ch,
1811 @LOC("THIS,LayerIIIDecoder.SI") int gr) {
1813 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR2") int sb18;
1814 @LOC("THIS,LayerIIIDecoder.SI1") int ss;
1815 @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR2") int sb18lim;
1817 // @LOC("THIS,LayerIIIDecoder.SI,III_side_info_t.CH,temporaire.GR1")
1818 // gr_info_s gr_info =
1819 // (si.ch[ch].gr[gr]);
1820 // 31 alias-reduction operations between each pair of sub-bands
1821 // with 8 butterflies between each pair
1823 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)
1824 && !(si.ch[ch].gr[gr].mixed_block_flag != 0))
1827 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].mixed_block_flag != 0)
1828 && (si.ch[ch].gr[gr].block_type == 2)) {
1834 for (sb18 = 0; sb18 < sb18lim; sb18 += 18) {
1835 for (ss = 0; ss < 8; ss++) {
1836 @LOC("THIS,LayerIIIDecoder.SI1") int src_idx1 = sb18 + 17 - ss;
1837 @LOC("THIS,LayerIIIDecoder.SI1") int src_idx2 = sb18 + 18 + ss;
1838 @LOC("THIS,LayerIIIDecoder.OUT0") float bu = inter[src_idx1];
1839 @LOC("THIS,LayerIIIDecoder.OUT0") float bd = inter[src_idx2];
1840 inter[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);
1841 inter[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);
1850 // MDM: tsOutCopy and rawout do not need initializing, so the arrays
1853 float[] tsOutCopy = new float[18];
1855 float[] rawout = new float[36];
1857 @LATTICE("THIS<SB,SB*,THISLOC=THIS")
1858 private void hybrid(@LOC("THIS,LayerIIIDecoder.SI") int ch, @LOC("THIS,LayerIIIDecoder.SI") int gr) {
1860 @LOC("THIS,LayerIIIDecoder.SI1") int bt;
1861 @LOC("THIS,LayerIIIDecoder.SI1") int sb18;
1862 // gr_info_s gr_info = (si.ch[ch].gr[gr]); //remove alias
1863 // @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut; //remove alias
1865 // float[][] prvblk;
1867 for (sb18 = 0; sb18 < 576; sb18 += 18) {
1868 if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].mixed_block_flag != 0)
1872 bt = si.ch[ch].gr[gr].block_type;
1876 // Modif E.B 02/22/99
1877 for (@LOC("THIS,LayerIIIDecoder.SI1") int cc = 0; cc < 18; cc++) {
1878 // tsOutCopy[cc] = out_1d[cc + sb18];
1879 tsOutCopy[cc] = inter[cc + sb18];
1884 for (@LOC("THIS,LayerIIIDecoder.SI1") int cc = 0; cc < 18; cc++) {
1885 out_1d[cc + sb18] = tsOutCopy[cc];
1891 out_1d[0 + sb18] = rawout[0] + prevblck[ch][sb18 + 0];
1892 out_1d[1 + sb18] = rawout[1] + prevblck[ch][sb18 + 1];
1893 out_1d[2 + sb18] = rawout[2] + prevblck[ch][sb18 + 2];
1894 out_1d[3 + sb18] = rawout[3] + prevblck[ch][sb18 + 3];
1895 out_1d[4 + sb18] = rawout[4] + prevblck[ch][sb18 + 4];
1896 out_1d[5 + sb18] = rawout[5] + prevblck[ch][sb18 + 5];
1897 out_1d[6 + sb18] = rawout[6] + prevblck[ch][sb18 + 6];
1898 out_1d[7 + sb18] = rawout[7] + prevblck[ch][sb18 + 7];
1899 out_1d[8 + sb18] = rawout[8] + prevblck[ch][sb18 + 8];
1900 out_1d[9 + sb18] = rawout[9] + prevblck[ch][sb18 + 9];
1901 out_1d[10 + sb18] = rawout[10] + prevblck[ch][sb18 + 10];
1902 out_1d[11 + sb18] = rawout[11] + prevblck[ch][sb18 + 11];
1903 out_1d[12 + sb18] = rawout[12] + prevblck[ch][sb18 + 12];
1904 out_1d[13 + sb18] = rawout[13] + prevblck[ch][sb18 + 13];
1905 out_1d[14 + sb18] = rawout[14] + prevblck[ch][sb18 + 14];
1906 out_1d[15 + sb18] = rawout[15] + prevblck[ch][sb18 + 15];
1907 out_1d[16 + sb18] = rawout[16] + prevblck[ch][sb18 + 16];
1908 out_1d[17 + sb18] = rawout[17] + prevblck[ch][sb18 + 17];
1909 raw_full[ch][sb18 + 0] = rawout[18];
1910 raw_full[ch][sb18 + 1] = rawout[19];
1911 raw_full[ch][sb18 + 2] = rawout[20];
1912 raw_full[ch][sb18 + 3] = rawout[21];
1913 raw_full[ch][sb18 + 4] = rawout[22];
1914 raw_full[ch][sb18 + 5] = rawout[23];
1915 raw_full[ch][sb18 + 6] = rawout[24];
1916 raw_full[ch][sb18 + 7] = rawout[25];
1917 raw_full[ch][sb18 + 8] = rawout[26];
1918 raw_full[ch][sb18 + 9] = rawout[27];
1919 raw_full[ch][sb18 + 10] = rawout[28];
1920 raw_full[ch][sb18 + 11] = rawout[29];
1921 raw_full[ch][sb18 + 12] = rawout[30];
1922 raw_full[ch][sb18 + 13] = rawout[31];
1923 raw_full[ch][sb18 + 14] = rawout[32];
1924 raw_full[ch][sb18 + 15] = rawout[33];
1925 raw_full[ch][sb18 + 16] = rawout[34];
1926 raw_full[ch][sb18 + 17] = rawout[35];
1928 // original implementation:
1929 // out_1d[0 + sb18] = rawout[0] + prevblck[ch][sb18 + 0];
1930 // prevblck[ch][sb18 + 0] = rawout[18];
1931 // out_1d[1 + sb18] = rawout[1] + prevblck[ch][sb18 + 1];
1932 // prevblck[ch][sb18 + 1] = rawout[19];
1933 // out_1d[2 + sb18] = rawout[2] + prevblck[ch][sb18 + 2];
1934 // prevblck[ch][sb18 + 2] = rawout[20];
1935 // out_1d[3 + sb18] = rawout[3] + prevblck[ch][sb18 + 3];
1936 // prevblck[ch][sb18 + 3] = rawout[21];
1937 // out_1d[4 + sb18] = rawout[4] + prevblck[ch][sb18 + 4];
1938 // prevblck[ch][sb18 + 4] = rawout[22];
1939 // out_1d[5 + sb18] = rawout[5] + prevblck[ch][sb18 + 5];
1940 // prevblck[ch][sb18 + 5] = rawout[23];
1941 // out_1d[6 + sb18] = rawout[6] + prevblck[ch][sb18 + 6];
1942 // prevblck[ch][sb18 + 6] = rawout[24];
1943 // out_1d[7 + sb18] = rawout[7] + prevblck[ch][sb18 + 7];
1944 // prevblck[ch][sb18 + 7] = rawout[25];
1945 // out_1d[8 + sb18] = rawout[8] + prevblck[ch][sb18 + 8];
1946 // prevblck[ch][sb18 + 8] = rawout[26];
1947 // out_1d[9 + sb18] = rawout[9] + prevblck[ch][sb18 + 9];
1948 // prevblck[ch][sb18 + 9] = rawout[27];
1949 // out_1d[10 + sb18] = rawout[10] + prevblck[ch][sb18 + 10];
1950 // prevblck[ch][sb18 + 10] = rawout[28];
1951 // out_1d[11 + sb18] = rawout[11] + prevblck[ch][sb18 + 11];
1952 // prevblck[ch][sb18 + 11] = rawout[29];
1953 // out_1d[12 + sb18] = rawout[12] + prevblck[ch][sb18 + 12];
1954 // prevblck[ch][sb18 + 12] = rawout[30];
1955 // out_1d[13 + sb18] = rawout[13] + prevblck[ch][sb18 + 13];
1956 // prevblck[ch][sb18 + 13] = rawout[31];
1957 // out_1d[14 + sb18] = rawout[14] + prevblck[ch][sb18 + 14];
1958 // prevblck[ch][sb18 + 14] = rawout[32];
1959 // out_1d[15 + sb18] = rawout[15] + prevblck[ch][sb18 + 15];
1960 // prevblck[ch][sb18 + 15] = rawout[33];
1961 // out_1d[16 + sb18] = rawout[16] + prevblck[ch][sb18 + 16];
1962 // prevblck[ch][sb18 + 16] = rawout[34];
1963 // out_1d[17 + sb18] = rawout[17] + prevblck[ch][sb18 + 17];
1964 // prevblck[ch][sb18 + 17] = rawout[35];
1972 private void do_downmix() {
1973 for (@LOC("THIS,LayerIIIDecoder.ISR") int sb = 0; sb < SSLIMIT; sb++) {
1974 for (@LOC("THIS,LayerIIIDecoder.ISR") int ss = 0; ss < SSLIMIT; ss += 3) {
1975 lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;
1976 lr[0][sb][ss + 1] = (lr[0][sb][ss + 1] + lr[1][sb][ss + 1]) * 0.5f;
1977 lr[0][sb][ss + 2] = (lr[0][sb][ss + 2] + lr[1][sb][ss + 2]) * 0.5f;
1985 // @LATTICE("OUT<6I,OUT<TMPF,TMPF<EO,EO<TMP,TMP<SUM,TMP<IIP,IIP<I00,I00<SH,SUM<PP,PP<SH,SH<I,I<IN,TMPF*,SH*,I*,6I*,GLOBALLOC=IN,THISLOC=IN")
1986 // public void inv_mdct(@LOC("SH") float[] in, @LOC("OUT") float[] out,
1987 // @LOC("IN") int block_type) {//remove alias
1989 @LATTICE("THIS,THISLOC=THIS")
1990 public void inv_mdct(@LOC("THIS,LayerIIIDecoder.TSOUT") int block_type) {
1992 @LOC("THIS,LayerIIIDecoder.TSOUT") int i;
1994 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_0;
1995 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_1;
1996 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_2;
1997 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_3;
1998 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_4;
1999 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_5;
2000 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_6;
2001 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_7;
2002 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_8;
2003 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_9;
2004 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_10;
2005 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_11;
2006 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_12;
2007 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_13;
2008 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_14;
2009 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_15;
2010 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_16;
2011 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_17;
2028 tmpf_15 = tmpf_16 = tmpf_17 = 0.0f;
2030 if (block_type == 2) {
2034 * Under MicrosoftVM 2922, This causes a GPF, or At best, an
2035 * ArrayIndexOutOfBoundsExceptin. for(int p=0;p<36;p+=9) { out[p] =
2036 * out[p+1] = out[p+2] = out[p+3] = out[p+4] = out[p+5] = out[p+6] =
2037 * out[p+7] = out[p+8] = 0.0f; }
2076 @LOC("THIS,LayerIIIDecoder.TSOUT") int six_i = 0;
2078 for (i = 0; i < 3; i++) {
2080 // Begin 12 point IDCT
2081 // Input aliasing for 12 pt IDCT
2082 tsOutCopy[15 + i] += tsOutCopy[12 + i];
2083 tsOutCopy[12 + i] += tsOutCopy[9 + i];
2084 tsOutCopy[9 + i] += tsOutCopy[6 + i];
2085 tsOutCopy[6 + i] += tsOutCopy[3 + i];
2086 tsOutCopy[3 + i] += tsOutCopy[0 + i];
2088 // Input aliasing on odd indices (for 6 point IDCT)
2089 tsOutCopy[15 + i] += tsOutCopy[9 + i];
2090 tsOutCopy[9 + i] += tsOutCopy[3 + i];
2092 // 3 point IDCT on even indices
2093 @LOC("THIS,LayerIIIDecoder.TSOUT") float pp1;
2094 @LOC("THIS,LayerIIIDecoder.TSOUT") float pp2;
2095 @LOC("THIS,LayerIIIDecoder.TSOUT") float sum;
2096 pp2 = tsOutCopy[12 + i] * 0.500000000f;
2097 pp1 = tsOutCopy[6 + i] * 0.866025403f;
2098 sum = tsOutCopy[0 + i] + pp2;
2099 tmpf_1 = tsOutCopy[0 + i] - tsOutCopy[12 + i];
2103 // End 3 point IDCT on even indices
2104 // 3 point IDCT on odd indices (for 6 point IDCT)
2105 pp2 = tsOutCopy[15 + i] * 0.500000000f;
2106 pp1 = tsOutCopy[9 + i] * 0.866025403f;
2107 sum = tsOutCopy[3 + i] + pp2;
2108 tmpf_4 = tsOutCopy[3 + i] - tsOutCopy[15 + i];
2111 // End 3 point IDCT on odd indices
2112 // Twiddle factors on odd indices (for 6 point IDCT)
2114 tmpf_3 *= 1.931851653f;
2115 tmpf_4 *= 0.707106781f;
2116 tmpf_5 *= 0.517638090f;
2118 // Output butterflies on 2 3 point IDCT's (for 6 point IDCT)
2119 @LOC("THIS,LayerIIIDecoder.TSOUT") float save = tmpf_0;
2121 tmpf_5 = save - tmpf_5;
2124 tmpf_4 = save - tmpf_4;
2127 tmpf_3 = save - tmpf_3;
2130 // Twiddle factors on indices (for 12 point IDCT)
2132 tmpf_0 *= 0.504314480f;
2133 tmpf_1 *= 0.541196100f;
2134 tmpf_2 *= 0.630236207f;
2135 tmpf_3 *= 0.821339815f;
2136 tmpf_4 *= 1.306562965f;
2137 tmpf_5 *= 3.830648788f;
2139 // End 12 point IDCT
2141 // Shift to 12 point modified IDCT, multiply by window type 2
2142 tmpf_8 = -tmpf_0 * 0.793353340f;
2143 tmpf_9 = -tmpf_0 * 0.608761429f;
2144 tmpf_7 = -tmpf_1 * 0.923879532f;
2145 tmpf_10 = -tmpf_1 * 0.382683432f;
2146 tmpf_6 = -tmpf_2 * 0.991444861f;
2147 tmpf_11 = -tmpf_2 * 0.130526192f;
2150 tmpf_1 = tmpf_4 * 0.382683432f;
2151 tmpf_2 = tmpf_5 * 0.608761429f;
2153 tmpf_3 = -tmpf_5 * 0.793353340f;
2154 tmpf_4 = -tmpf_4 * 0.923879532f;
2155 tmpf_5 = -tmpf_0 * 0.991444861f;
2157 tmpf_0 *= 0.130526192f;
2159 rawout[six_i + 6] += tmpf_0;
2160 rawout[six_i + 7] += tmpf_1;
2161 rawout[six_i + 8] += tmpf_2;
2162 rawout[six_i + 9] += tmpf_3;
2163 rawout[six_i + 10] += tmpf_4;
2164 rawout[six_i + 11] += tmpf_5;
2165 rawout[six_i + 12] += tmpf_6;
2166 rawout[six_i + 13] += tmpf_7;
2167 rawout[six_i + 14] += tmpf_8;
2168 rawout[six_i + 15] += tmpf_9;
2169 rawout[six_i + 16] += tmpf_10;
2170 rawout[six_i + 17] += tmpf_11;
2176 // input aliasing for 36 point IDCT
2177 tsOutCopy[17] += tsOutCopy[16];
2178 tsOutCopy[16] += tsOutCopy[15];
2179 tsOutCopy[15] += tsOutCopy[14];
2180 tsOutCopy[14] += tsOutCopy[13];
2181 tsOutCopy[13] += tsOutCopy[12];
2182 tsOutCopy[12] += tsOutCopy[11];
2183 tsOutCopy[11] += tsOutCopy[10];
2184 tsOutCopy[10] += tsOutCopy[9];
2185 tsOutCopy[9] += tsOutCopy[8];
2186 tsOutCopy[8] += tsOutCopy[7];
2187 tsOutCopy[7] += tsOutCopy[6];
2188 tsOutCopy[6] += tsOutCopy[5];
2189 tsOutCopy[5] += tsOutCopy[4];
2190 tsOutCopy[4] += tsOutCopy[3];
2191 tsOutCopy[3] += tsOutCopy[2];
2192 tsOutCopy[2] += tsOutCopy[1];
2193 tsOutCopy[1] += tsOutCopy[0];
2195 // 18 point IDCT for odd indices
2196 // input aliasing for 18 point IDCT
2197 tsOutCopy[17] += tsOutCopy[15];
2198 tsOutCopy[15] += tsOutCopy[13];
2199 tsOutCopy[13] += tsOutCopy[11];
2200 tsOutCopy[11] += tsOutCopy[9];
2201 tsOutCopy[9] += tsOutCopy[7];
2202 tsOutCopy[7] += tsOutCopy[5];
2203 tsOutCopy[5] += tsOutCopy[3];
2204 tsOutCopy[3] += tsOutCopy[1];
2206 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0;
2207 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1;
2208 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2;
2209 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3;
2210 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp4;
2211 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0_;
2212 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1_;
2213 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2_;
2214 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3_;
2215 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0o;
2216 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1o;
2217 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2o;
2218 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3o;
2219 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp4o;
2220 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0_o;
2221 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1_o;
2222 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2_o;
2223 @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3_o;
2225 // Fast 9 Point Inverse Discrete Cosine Transform
2227 // By Francois-Raymond Boyer
2228 // mailto:boyerf@iro.umontreal.ca
2229 // http://www.iro.umontreal.ca/~boyerf
2231 // The code has been optimized for Intel processors
2232 // (takes a lot of time to convert float to and from iternal FPU
2235 // It is a simple "factorization" of the IDCT matrix.
2237 // 9 point IDCT on even indices
2239 // 5 points on odd indices (not realy an IDCT)
2240 @LOC("THIS,LayerIIIDecoder.TSOUT") float i00 = tsOutCopy[0] + tsOutCopy[0];
2241 @LOC("THIS,LayerIIIDecoder.TSOUT") float iip12 = i00 + tsOutCopy[12];
2244 iip12 + tsOutCopy[4] * 1.8793852415718f + tsOutCopy[8] * 1.532088886238f + tsOutCopy[16]
2245 * 0.34729635533386f;
2246 tmp1 = i00 + tsOutCopy[4] - tsOutCopy[8] - tsOutCopy[12] - tsOutCopy[12] - tsOutCopy[16];
2248 iip12 - tsOutCopy[4] * 0.34729635533386f - tsOutCopy[8] * 1.8793852415718f
2249 + tsOutCopy[16] * 1.532088886238f;
2251 iip12 - tsOutCopy[4] * 1.532088886238f + tsOutCopy[8] * 0.34729635533386f - tsOutCopy[16]
2253 tmp4 = tsOutCopy[0] - tsOutCopy[4] + tsOutCopy[8] - tsOutCopy[12] + tsOutCopy[16];
2255 // 4 points on even indices
2256 @LOC("THIS,LayerIIIDecoder.TSOUT") float i66_ = tsOutCopy[6] * 1.732050808f; // Sqrt[3]
2259 tsOutCopy[2] * 1.9696155060244f + i66_ + tsOutCopy[10] * 1.2855752193731f + tsOutCopy[14]
2260 * 0.68404028665134f;
2261 tmp1_ = (tsOutCopy[2] - tsOutCopy[10] - tsOutCopy[14]) * 1.732050808f;
2263 tsOutCopy[2] * 1.2855752193731f - i66_ - tsOutCopy[10] * 0.68404028665134f
2264 + tsOutCopy[14] * 1.9696155060244f;
2266 tsOutCopy[2] * 0.68404028665134f - i66_ + tsOutCopy[10] * 1.9696155060244f
2267 - tsOutCopy[14] * 1.2855752193731f;
2269 // 9 point IDCT on odd indices
2270 // 5 points on odd indices (not realy an IDCT)
2271 @LOC("THIS,LayerIIIDecoder.TSOUT") float i0 = tsOutCopy[0 + 1] + tsOutCopy[0 + 1];
2272 @LOC("THIS,LayerIIIDecoder.TSOUT") float i0p12 = i0 + tsOutCopy[12 + 1];
2275 i0p12 + tsOutCopy[4 + 1] * 1.8793852415718f + tsOutCopy[8 + 1] * 1.532088886238f
2276 + tsOutCopy[16 + 1] * 0.34729635533386f;
2278 i0 + tsOutCopy[4 + 1] - tsOutCopy[8 + 1] - tsOutCopy[12 + 1] - tsOutCopy[12 + 1]
2279 - tsOutCopy[16 + 1];
2281 i0p12 - tsOutCopy[4 + 1] * 0.34729635533386f - tsOutCopy[8 + 1] * 1.8793852415718f
2282 + tsOutCopy[16 + 1] * 1.532088886238f;
2284 i0p12 - tsOutCopy[4 + 1] * 1.532088886238f + tsOutCopy[8 + 1] * 0.34729635533386f
2285 - tsOutCopy[16 + 1] * 1.8793852415718f;
2287 (tsOutCopy[0 + 1] - tsOutCopy[4 + 1] + tsOutCopy[8 + 1] - tsOutCopy[12 + 1] + tsOutCopy[16 + 1]) * 0.707106781f; // Twiddled
2289 // 4 points on even indices
2290 @LOC("THIS,LayerIIIDecoder.TSOUT") float i6_ = tsOutCopy[6 + 1] * 1.732050808f; // Sqrt[3]
2293 tsOutCopy[2 + 1] * 1.9696155060244f + i6_ + tsOutCopy[10 + 1] * 1.2855752193731f
2294 + tsOutCopy[14 + 1] * 0.68404028665134f;
2295 tmp1_o = (tsOutCopy[2 + 1] - tsOutCopy[10 + 1] - tsOutCopy[14 + 1]) * 1.732050808f;
2297 tsOutCopy[2 + 1] * 1.2855752193731f - i6_ - tsOutCopy[10 + 1] * 0.68404028665134f
2298 + tsOutCopy[14 + 1] * 1.9696155060244f;
2300 tsOutCopy[2 + 1] * 0.68404028665134f - i6_ + tsOutCopy[10 + 1] * 1.9696155060244f
2301 - tsOutCopy[14 + 1] * 1.2855752193731f;
2303 // Twiddle factors on odd indices
2305 // Butterflies on 9 point IDCT's
2307 // twiddle factors for 36 point IDCT
2309 @LOC("THIS,LayerIIIDecoder.TSOUT") float e;
2310 @LOC("THIS,LayerIIIDecoder.TSOUT") float o;
2312 o = (tmp0o + tmp0_o) * 0.501909918f;
2316 o = (tmp1o + tmp1_o) * 0.517638090f;
2320 o = (tmp2o + tmp2_o) * 0.551688959f;
2324 o = (tmp3o + tmp3_o) * 0.610387294f;
2327 tmpf_4 = tmp4 + tmp4o;
2328 tmpf_13 = tmp4 - tmp4o;
2330 o = (tmp3o - tmp3_o) * 0.871723397f;
2334 o = (tmp2o - tmp2_o) * 1.183100792f;
2338 o = (tmp1o - tmp1_o) * 1.931851653f;
2342 o = (tmp0o - tmp0_o) * 5.736856623f;
2346 // end 36 point IDCT */
2347 // shift to modified IDCT
2348 // win_bt = win[block_type]; //substituted this so that a new area does
2349 // not become created
2351 rawout[0] = -tmpf_9 * win[block_type][0];
2352 rawout[1] = -tmpf_10 * win[block_type][1];
2353 rawout[2] = -tmpf_11 * win[block_type][2];
2354 rawout[3] = -tmpf_12 * win[block_type][3];
2355 rawout[4] = -tmpf_13 * win[block_type][4];
2356 rawout[5] = -tmpf_14 * win[block_type][5];
2357 rawout[6] = -tmpf_15 * win[block_type][6];
2358 rawout[7] = -tmpf_16 * win[block_type][7];
2359 rawout[8] = -tmpf_17 * win[block_type][8];
2360 rawout[9] = tmpf_17 * win[block_type][9];
2361 rawout[10] = tmpf_16 * win[block_type][10];
2362 rawout[11] = tmpf_15 * win[block_type][11];
2363 rawout[12] = tmpf_14 * win[block_type][12];
2364 rawout[13] = tmpf_13 * win[block_type][13];
2365 rawout[14] = tmpf_12 * win[block_type][14];
2366 rawout[15] = tmpf_11 * win[block_type][15];
2367 rawout[16] = tmpf_10 * win[block_type][16];
2368 rawout[17] = tmpf_9 * win[block_type][17];
2369 rawout[18] = tmpf_8 * win[block_type][18];
2370 rawout[19] = tmpf_7 * win[block_type][19];
2371 rawout[20] = tmpf_6 * win[block_type][20];
2372 rawout[21] = tmpf_5 * win[block_type][21];
2373 rawout[22] = tmpf_4 * win[block_type][22];
2374 rawout[23] = tmpf_3 * win[block_type][23];
2375 rawout[24] = tmpf_2 * win[block_type][24];
2376 rawout[25] = tmpf_1 * win[block_type][25];
2377 rawout[26] = tmpf_0 * win[block_type][26];
2378 rawout[27] = tmpf_0 * win[block_type][27];
2379 rawout[28] = tmpf_1 * win[block_type][28];
2380 rawout[29] = tmpf_2 * win[block_type][29];
2381 rawout[30] = tmpf_3 * win[block_type][30];
2382 rawout[31] = tmpf_4 * win[block_type][31];
2383 rawout[32] = tmpf_5 * win[block_type][32];
2384 rawout[33] = tmpf_6 * win[block_type][33];
2385 rawout[34] = tmpf_7 * win[block_type][34];
2386 rawout[35] = tmpf_8 * win[block_type][35];
2392 private int counter = 0;
2393 private static final int SSLIMIT = 18;
2394 private static final int SBLIMIT = 32;
2396 // Size of the table of whole numbers raised to 4/3 power.
2397 // This may be adjusted for performance without any problems.
2398 // public static final int POW_TABLE_LIMIT=512;
2400 private static final int slen[][] = { { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
2401 { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 } };
2403 public static final int pretab[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3,
2407 private SBI[] sfBandIndex; // Init in the constructor.
2409 public static final float two_to_negative_half_pow[] = { 1.0000000000E+00f, 7.0710678119E-01f,
2410 5.0000000000E-01f, 3.5355339059E-01f, 2.5000000000E-01f, 1.7677669530E-01f,
2411 1.2500000000E-01f, 8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f,
2412 3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f, 1.1048543456E-02f,
2413 7.8125000000E-03f, 5.5242717280E-03f, 3.9062500000E-03f, 2.7621358640E-03f,
2414 1.9531250000E-03f, 1.3810679320E-03f, 9.7656250000E-04f, 6.9053396600E-04f,
2415 4.8828125000E-04f, 3.4526698300E-04f, 2.4414062500E-04f, 1.7263349150E-04f,
2416 1.2207031250E-04f, 8.6316745750E-05f, 6.1035156250E-05f, 4.3158372875E-05f,
2417 3.0517578125E-05f, 2.1579186438E-05f, 1.5258789062E-05f, 1.0789593219E-05f,
2418 7.6293945312E-06f, 5.3947966094E-06f, 3.8146972656E-06f, 2.6973983047E-06f,
2419 1.9073486328E-06f, 1.3486991523E-06f, 9.5367431641E-07f, 6.7434957617E-07f,
2420 4.7683715820E-07f, 3.3717478809E-07f, 2.3841857910E-07f, 1.6858739404E-07f,
2421 1.1920928955E-07f, 8.4293697022E-08f, 5.9604644775E-08f, 4.2146848511E-08f,
2422 2.9802322388E-08f, 2.1073424255E-08f, 1.4901161194E-08f, 1.0536712128E-08f,
2423 7.4505805969E-09f, 5.2683560639E-09f, 3.7252902985E-09f, 2.6341780319E-09f,
2424 1.8626451492E-09f, 1.3170890160E-09f, 9.3132257462E-10f, 6.5854450798E-10f,
2425 4.6566128731E-10f, 3.2927225399E-10f };
2427 public static final float t_43[] = create_t_43();
2430 static private float[] create_t_43() {
2431 @LOC("OUT") float[] t43 = new float[8192];
2432 final double d43 = (4.0 / 3.0);
2434 for (@LOC("SH") int i = 0; i < 8192; i++) {
2435 t43[i] = (float) Math.pow(i, d43);
2440 public static final float io[][] = {
2441 { 1.0000000000E+00f, 8.4089641526E-01f, 7.0710678119E-01f, 5.9460355751E-01f,
2442 5.0000000001E-01f, 4.2044820763E-01f, 3.5355339060E-01f, 2.9730177876E-01f,
2443 2.5000000001E-01f, 2.1022410382E-01f, 1.7677669530E-01f, 1.4865088938E-01f,
2444 1.2500000000E-01f, 1.0511205191E-01f, 8.8388347652E-02f, 7.4325444691E-02f,
2445 6.2500000003E-02f, 5.2556025956E-02f, 4.4194173826E-02f, 3.7162722346E-02f,
2446 3.1250000002E-02f, 2.6278012978E-02f, 2.2097086913E-02f, 1.8581361173E-02f,
2447 1.5625000001E-02f, 1.3139006489E-02f, 1.1048543457E-02f, 9.2906805866E-03f,
2448 7.8125000006E-03f, 6.5695032447E-03f, 5.5242717285E-03f, 4.6453402934E-03f },
2449 { 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f, 3.5355339060E-01f,
2450 2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f, 8.8388347650E-02f,
2451 6.2500000001E-02f, 4.4194173825E-02f, 3.1250000001E-02f, 2.2097086913E-02f,
2452 1.5625000000E-02f, 1.1048543456E-02f, 7.8125000002E-03f, 5.5242717282E-03f,
2453 3.9062500001E-03f, 2.7621358641E-03f, 1.9531250001E-03f, 1.3810679321E-03f,
2454 9.7656250004E-04f, 6.9053396603E-04f, 4.8828125002E-04f, 3.4526698302E-04f,
2455 2.4414062501E-04f, 1.7263349151E-04f, 1.2207031251E-04f, 8.6316745755E-05f,
2456 6.1035156254E-05f, 4.3158372878E-05f, 3.0517578127E-05f, 2.1579186439E-05f } };
2458 public static final float TAN12[] = { 0.0f, 0.26794919f, 0.57735027f, 1.0f, 1.73205081f,
2459 3.73205081f, 9.9999999e10f, -3.73205081f, -1.73205081f, -1.0f, -0.57735027f, -0.26794919f,
2460 0.0f, 0.26794919f, 0.57735027f, 1.0f };
2462 // REVIEW: in java, the array lookup may well be slower than
2463 // the actual calculation
2466 * private static final int ss_div[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2467 * 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2468 * 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
2469 * 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2470 * 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,
2471 * 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
2472 * 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
2473 * 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
2474 * 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
2475 * 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
2476 * 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
2477 * 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
2478 * 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
2479 * 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
2480 * 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
2481 * 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
2482 * 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
2483 * 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
2484 * 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
2485 * 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
2486 * 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
2487 * 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25,
2488 * 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26,
2489 * 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27,
2490 * 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28,
2491 * 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29,
2492 * 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30,
2493 * 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31,
2494 * 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 };
2496 * // 576 % 18 private static final int ss_mod[] = { 0, 1, 2, 3, 4, 5, 6, 7,
2497 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2498 * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2499 * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2500 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2501 * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2502 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2503 * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2504 * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2505 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2506 * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2507 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2508 * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2509 * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2510 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2511 * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2512 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2513 * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2514 * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2515 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2516 * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2517 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2518 * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2519 * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2520 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
2521 * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
2522 * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2523 * 12, 13, 14, 15, 16, 17 };
2526 private static/* final */int reorder_table[][]/* = loadReorderTable() */; // SZD:
2535 * Loads the data for the reorder
2538 * private static int[][] loadReorderTable() // SZD: table will be generated {
2539 * try { Class elemType = int[][].class.getComponentType(); Object o =
2540 * JavaLayerUtils.deserializeArrayResource("l3reorder.ser", elemType, 6);
2541 * return (int[][])o; } catch (IOException ex) { throw new
2542 * ExceptionInInitializerError(ex); } }
2544 @LATTICE("OUT<J,J<I,I<SE,I<WIN,SE<SF,SE<SFB,WIN<SFB,J*,I*,WIN*,SFB*")
2545 static int[] reorder(@LOC("SF") int scalefac_band[]) { // SZD: converted from
2547 @LOC("J") int j = 0;
2548 @LOC("OUT") int ix[] = new int[576];
2549 for (int sfb = 0; sfb < 13; sfb++) {
2550 int start = scalefac_band[sfb];
2551 int end = scalefac_band[sfb + 1];
2552 for (int window = 0; window < 3; window++)
2553 for (int i = start; i < end; i++)
2554 ix[3 * i + window] = j++;
2560 * static final int reorder_table_data[][]; = { { 0, 4, 8, 1, 5, 9, 2, 6, 10,
2561 * 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25,
2562 * 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49, 38, 44, 50, 39, 45,
2563 * 51, 40, 46, 52, 41, 47, 53, 54, 60, 66, 55, 61, 67, 56, 62, 68, 57, 63, 69,
2564 * 58, 64, 70, 59, 65, 71, 72, 80, 88, 73, 81, 89, 74, 82, 90, 75, 83, 91, 76,
2565 * 84, 92, 77, 85, 93, 78, 86, 94, 79, 87, 95, 96,106,116, 97,107,117,
2566 * 98,108,118, 99,109,119,100,110,120,101,
2567 * 111,121,102,112,122,103,113,123,104,114,124,105,115,125,126,140,
2568 * 154,127,141,155,128,142,156,129,143,157,130,144,158,131,145,159,
2569 * 132,146,160,133,147,161,134,148,162,135,149,163,136,150,164,137,
2570 * 151,165,138,152,166,139,153,167,168,186,204,169,187,205,170,188,
2571 * 206,171,189,207,172,190,208,173,191,209,174,192,210,175,193,211,
2572 * 176,194,212,177,195,213,178,196,214,179,197,215,180,198,216,181,
2573 * 199,217,182,200,218,183,201,219,184,202,220,185,203,221,222,248,
2574 * 274,223,249,275,224,250,276,225,251,277,226,252,278,227,253,279,
2575 * 228,254,280,229,255,281,230,256,282,231,257,283,232,258,284,233,
2576 * 259,285,234,260,286,235,261,287,236,262,288,237,263,289,238,264,
2577 * 290,239,265,291,240,266,292,241,267,293,242,268,294,243,269,295,
2578 * 244,270,296,245,271,297,246,272,298,247,273,299,300,332,364,301,
2579 * 333,365,302,334,366,303,335,367,304,336,368,305,337,369,306,338,
2580 * 370,307,339,371,308,340,372,309,341,373,310,342,374,311,343,375,
2581 * 312,344,376,313,345,377,314,346,378,315,347,379,316,348,380,317,
2582 * 349,381,318,350,382,319,351,383,320,352,384,321,353,385,322,354,
2583 * 386,323,355,387,324,356,388,325,357,389,326,358,390,327,359,391,
2584 * 328,360,392,329,361,393,330,362,394,331,363,395,396,438,480,397,
2585 * 439,481,398,440,482,399,441,483,400,442,484,401,443,485,402,444,
2586 * 486,403,445,487,404,446,488,405,447,489,406,448,490,407,449,491,
2587 * 408,450,492,409,451,493,410,452,494,411,453,495,412,454,496,413,
2588 * 455,497,414,456,498,415,457,499,416,458,500,417,459,501,418,460,
2589 * 502,419,461,503,420,462,504,421,463,505,422,464,506,423,465,507,
2590 * 424,466,508,425,467,509,426,468,510,427,469,511,428,470,512,429,
2591 * 471,513,430,472,514,431,473,515,432,474,516,433,475,517,434,476,
2592 * 518,435,477,519,436,478,520,437,479,521,522,540,558,523,541,559,
2593 * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
2594 * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
2595 * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
2596 * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
2597 * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
2598 * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
2599 * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
2600 * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
2601 * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
2602 * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
2603 * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
2604 * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
2605 * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
2606 * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
2607 * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
2608 * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
2609 * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
2610 * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
2611 * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
2612 * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
2613 * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
2614 * 285,309,262,286,310,263,287,311,312,344,376,313,345,377,314,346,
2615 * 378,315,347,379,316,348,380,317,349,381,318,350,382,319,351,383,
2616 * 320,352,384,321,353,385,322,354,386,323,355,387,324,356,388,325,
2617 * 357,389,326,358,390,327,359,391,328,360,392,329,361,393,330,362,
2618 * 394,331,363,395,332,364,396,333,365,397,334,366,398,335,367,399,
2619 * 336,368,400,337,369,401,338,370,402,339,371,403,340,372,404,341,
2620 * 373,405,342,374,406,343,375,407,408,452,496,409,453,497,410,454,
2621 * 498,411,455,499,412,456,500,413,457,501,414,458,502,415,459,503,
2622 * 416,460,504,417,461,505,418,462,506,419,463,507,420,464,508,421,
2623 * 465,509,422,466,510,423,467,511,424,468,512,425,469,513,426,470,
2624 * 514,427,471,515,428,472,516,429,473,517,430,474,518,431,475,519,
2625 * 432,476,520,433,477,521,434,478,522,435,479,523,436,480,524,437,
2626 * 481,525,438,482,526,439,483,527,440,484,528,441,485,529,442,486,
2627 * 530,443,487,531,444,488,532,445,489,533,446,490,534,447,491,535,
2628 * 448,492,536,449,493,537,450,494,538,451,495,539,540,552,564,541,
2629 * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
2630 * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575}, { 0, 4,
2631 * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
2632 * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
2633 * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
2634 * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
2635 * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
2636 * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
2637 * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
2638 * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
2639 * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
2640 * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
2641 * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
2642 * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
2643 * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
2644 * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
2645 * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
2646 * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
2647 * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
2648 * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
2649 * 285,309,262,286,310,263,287,311,312,342,372,313,343,373,314,344,
2650 * 374,315,345,375,316,346,376,317,347,377,318,348,378,319,349,379,
2651 * 320,350,380,321,351,381,322,352,382,323,353,383,324,354,384,325,
2652 * 355,385,326,356,386,327,357,387,328,358,388,329,359,389,330,360,
2653 * 390,331,361,391,332,362,392,333,363,393,334,364,394,335,365,395,
2654 * 336,366,396,337,367,397,338,368,398,339,369,399,340,370,400,341,
2655 * 371,401,402,442,482,403,443,483,404,444,484,405,445,485,406,446,
2656 * 486,407,447,487,408,448,488,409,449,489,410,450,490,411,451,491,
2657 * 412,452,492,413,453,493,414,454,494,415,455,495,416,456,496,417,
2658 * 457,497,418,458,498,419,459,499,420,460,500,421,461,501,422,462,
2659 * 502,423,463,503,424,464,504,425,465,505,426,466,506,427,467,507,
2660 * 428,468,508,429,469,509,430,470,510,431,471,511,432,472,512,433,
2661 * 473,513,434,474,514,435,475,515,436,476,516,437,477,517,438,478,
2662 * 518,439,479,519,440,480,520,441,481,521,522,540,558,523,541,559,
2663 * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
2664 * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
2665 * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
2666 * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
2667 * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
2668 * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
2669 * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
2670 * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,100,110, 91,101,111, 92,102,112,
2671 * 93,103,113, 94,104,114, 95,105,115, 96,106,116, 97, 107,117, 98,108,118,
2672 * 99,109,119,120,132,144,121,133,145,122,134,
2673 * 146,123,135,147,124,136,148,125,137,149,126,138,150,127,139,151,
2674 * 128,140,152,129,141,153,130,142,154,131,143,155,156,170,184,157,
2675 * 171,185,158,172,186,159,173,187,160,174,188,161,175,189,162,176,
2676 * 190,163,177,191,164,178,192,165,179,193,166,180,194,167,181,195,
2677 * 168,182,196,169,183,197,198,216,234,199,217,235,200,218,236,201,
2678 * 219,237,202,220,238,203,221,239,204,222,240,205,223,241,206,224,
2679 * 242,207,225,243,208,226,244,209,227,245,210,228,246,211,229,247,
2680 * 212,230,248,213,231,249,214,232,250,215,233,251,252,274,296,253,
2681 * 275,297,254,276,298,255,277,299,256,278,300,257,279,301,258,280,
2682 * 302,259,281,303,260,282,304,261,283,305,262,284,306,263,285,307,
2683 * 264,286,308,265,287,309,266,288,310,267,289,311,268,290,312,269,
2684 * 291,313,270,292,314,271,293,315,272,294,316,273,295,317,318,348,
2685 * 378,319,349,379,320,350,380,321,351,381,322,352,382,323,353,383,
2686 * 324,354,384,325,355,385,326,356,386,327,357,387,328,358,388,329,
2687 * 359,389,330,360,390,331,361,391,332,362,392,333,363,393,334,364,
2688 * 394,335,365,395,336,366,396,337,367,397,338,368,398,339,369,399,
2689 * 340,370,400,341,371,401,342,372,402,343,373,403,344,374,404,345,
2690 * 375,405,346,376,406,347,377,407,408,464,520,409,465,521,410,466,
2691 * 522,411,467,523,412,468,524,413,469,525,414,470,526,415,471,527,
2692 * 416,472,528,417,473,529,418,474,530,419,475,531,420,476,532,421,
2693 * 477,533,422,478,534,423,479,535,424,480,536,425,481,537,426,482,
2694 * 538,427,483,539,428,484,540,429,485,541,430,486,542,431,487,543,
2695 * 432,488,544,433,489,545,434,490,546,435,491,547,436,492,548,437,
2696 * 493,549,438,494,550,439,495,551,440,496,552,441,497,553,442,498,
2697 * 554,443,499,555,444,500,556,445,501,557,446,502,558,447,503,559,
2698 * 448,504,560,449,505,561,450,506,562,451,507,563,452,508,564,453,
2699 * 509,565,454,510,566,455,511,567,456,512,568,457,513,569,458,514,
2700 * 570,459,515,571,460,516,572,461,517,573,462,518,574,463,519,575}, { 0, 4,
2701 * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
2702 * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
2703 * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
2704 * 58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69, 75, 81, 70, 76,
2705 * 82, 71, 77, 83, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107, 88, 98,108,
2706 * 89, 99,109, 90,100,110, 91,101,111, 92,102,112, 93,
2707 * 103,113,114,126,138,115,127,139,116,128,140,117,129,141,118,130,
2708 * 142,119,131,143,120,132,144,121,133,145,122,134,146,123,135,147,
2709 * 124,136,148,125,137,149,150,164,178,151,165,179,152,166,180,153,
2710 * 167,181,154,168,182,155,169,183,156,170,184,157,171,185,158,172,
2711 * 186,159,173,187,160,174,188,161,175,189,162,176,190,163,177,191,
2712 * 192,208,224,193,209,225,194,210,226,195,211,227,196,212,228,197,
2713 * 213,229,198,214,230,199,215,231,200,216,232,201,217,233,202,218,
2714 * 234,203,219,235,204,220,236,205,221,237,206,222,238,207,223,239,
2715 * 240,260,280,241,261,281,242,262,282,243,263,283,244,264,284,245,
2716 * 265,285,246,266,286,247,267,287,248,268,288,249,269,289,250,270,
2717 * 290,251,271,291,252,272,292,253,273,293,254,274,294,255,275,295,
2718 * 256,276,296,257,277,297,258,278,298,259,279,299,300,326,352,301,
2719 * 327,353,302,328,354,303,329,355,304,330,356,305,331,357,306,332,
2720 * 358,307,333,359,308,334,360,309,335,361,310,336,362,311,337,363,
2721 * 312,338,364,313,339,365,314,340,366,315,341,367,316,342,368,317,
2722 * 343,369,318,344,370,319,345,371,320,346,372,321,347,373,322,348,
2723 * 374,323,349,375,324,350,376,325,351,377,378,444,510,379,445,511,
2724 * 380,446,512,381,447,513,382,448,514,383,449,515,384,450,516,385,
2725 * 451,517,386,452,518,387,453,519,388,454,520,389,455,521,390,456,
2726 * 522,391,457,523,392,458,524,393,459,525,394,460,526,395,461,527,
2727 * 396,462,528,397,463,529,398,464,530,399,465,531,400,466,532,401,
2728 * 467,533,402,468,534,403,469,535,404,470,536,405,471,537,406,472,
2729 * 538,407,473,539,408,474,540,409,475,541,410,476,542,411,477,543,
2730 * 412,478,544,413,479,545,414,480,546,415,481,547,416,482,548,417,
2731 * 483,549,418,484,550,419,485,551,420,486,552,421,487,553,422,488,
2732 * 554,423,489,555,424,490,556,425,491,557,426,492,558,427,493,559,
2733 * 428,494,560,429,495,561,430,496,562,431,497,563,432,498,564,433,
2734 * 499,565,434,500,566,435,501,567,436,502,568,437,503,569,438,504,
2735 * 570,439,505,571,440,506,572,441,507,573,442,508,574,443,509,575}, { 0, 4,
2736 * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
2737 * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
2738 * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
2739 * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
2740 * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,102,114, 91,103,115, 92,104,116,
2741 * 93,105,117, 94,106,118, 95,107,119, 96,108,120, 97, 109,121, 98,110,122,
2742 * 99,111,123,100,112,124,101,113,125,126,142,
2743 * 158,127,143,159,128,144,160,129,145,161,130,146,162,131,147,163,
2744 * 132,148,164,133,149,165,134,150,166,135,151,167,136,152,168,137,
2745 * 153,169,138,154,170,139,155,171,140,156,172,141,157,173,174,194,
2746 * 214,175,195,215,176,196,216,177,197,217,178,198,218,179,199,219,
2747 * 180,200,220,181,201,221,182,202,222,183,203,223,184,204,224,185,
2748 * 205,225,186,206,226,187,207,227,188,208,228,189,209,229,190,210,
2749 * 230,191,211,231,192,212,232,193,213,233,234,260,286,235,261,287,
2750 * 236,262,288,237,263,289,238,264,290,239,265,291,240,266,292,241,
2751 * 267,293,242,268,294,243,269,295,244,270,296,245,271,297,246,272,
2752 * 298,247,273,299,248,274,300,249,275,301,250,276,302,251,277,303,
2753 * 252,278,304,253,279,305,254,280,306,255,281,307,256,282,308,257,
2754 * 283,309,258,284,310,259,285,311,312,346,380,313,347,381,314,348,
2755 * 382,315,349,383,316,350,384,317,351,385,318,352,386,319,353,387,
2756 * 320,354,388,321,355,389,322,356,390,323,357,391,324,358,392,325,
2757 * 359,393,326,360,394,327,361,395,328,362,396,329,363,397,330,364,
2758 * 398,331,365,399,332,366,400,333,367,401,334,368,402,335,369,403,
2759 * 336,370,404,337,371,405,338,372,406,339,373,407,340,374,408,341,
2760 * 375,409,342,376,410,343,377,411,344,378,412,345,379,413,414,456,
2761 * 498,415,457,499,416,458,500,417,459,501,418,460,502,419,461,503,
2762 * 420,462,504,421,463,505,422,464,506,423,465,507,424,466,508,425,
2763 * 467,509,426,468,510,427,469,511,428,470,512,429,471,513,430,472,
2764 * 514,431,473,515,432,474,516,433,475,517,434,476,518,435,477,519,
2765 * 436,478,520,437,479,521,438,480,522,439,481,523,440,482,524,441,
2766 * 483,525,442,484,526,443,485,527,444,486,528,445,487,529,446,488,
2767 * 530,447,489,531,448,490,532,449,491,533,450,492,534,451,493,535,
2768 * 452,494,536,453,495,537,454,496,538,455,497,539,540,552,564,541,
2769 * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
2770 * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575} };
2773 private static final float cs[] = { 0.857492925712f, 0.881741997318f, 0.949628649103f,
2774 0.983314592492f, 0.995517816065f, 0.999160558175f, 0.999899195243f, 0.999993155067f };
2776 private static final float ca[] = { -0.5144957554270f, -0.4717319685650f, -0.3133774542040f,
2777 -0.1819131996110f, -0.0945741925262f, -0.0409655828852f, -0.0141985685725f,
2778 -0.00369997467375f };
2780 /************************************************************/
2781 /* END OF L3TABLE */
2782 /************************************************************/
2784 /************************************************************/
2786 /************************************************************/
2788 /***************************************************************/
2790 /***************************************************************/
2792 /***************************************************************/
2794 /***************************************************************/
2795 public static final float win[][] = {
2796 { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
2797 -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
2798 -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
2799 -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
2800 -4.0715656898E-01f, -3.6969460527E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
2801 -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
2802 -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
2803 -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
2804 -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f },
2806 { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
2807 -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
2808 -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
2809 -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
2810 -4.0715656898E-01f, -3.6969460527E-01f, -3.3908542600E-01f, -3.1511810350E-01f,
2811 -2.9642226150E-01f, -2.8184548650E-01f, -5.4119610000E-01f, -2.6213228100E-01f,
2812 -2.5387916537E-01f, -2.3296291359E-01f, -1.9852728987E-01f, -1.5233534808E-01f,
2813 -9.6496400054E-02f, -3.3423828516E-02f, 0.0000000000E+00f, 0.0000000000E+00f,
2814 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
2816 { -4.8300800645E-02f, -1.5715656932E-01f, -2.8325045177E-01f, -4.2953747763E-01f,
2817 -1.2071067795E+00f, -8.2426483178E-01f, -1.1451749106E+00f, -1.7695290101E+00f,
2818 -4.5470225061E+00f, -3.4890531002E+00f, -7.3296292804E-01f, -1.5076514758E-01f,
2819 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2820 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2821 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2822 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2823 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2824 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
2826 { 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
2827 0.0000000000E+00f, 0.0000000000E+00f, -1.5076513660E-01f, -7.3296291107E-01f,
2828 -3.4890530566E+00f, -4.5470224727E+00f, -1.7695290031E+00f, -1.1451749092E+00f,
2829 -8.3137738100E-01f, -1.3065629650E+00f, -5.4142014250E-01f, -4.6528974900E-01f,
2830 -4.1066990750E-01f, -3.7004680800E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
2831 -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
2832 -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
2833 -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
2834 -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f } };
2836 /***************************************************************/
2837 /* END OF INV_MDCT */
2838 /***************************************************************/
2840 public static final int nr_of_sfb_block[][][] = {
2841 { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },
2842 { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },
2843 { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },
2844 { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } },
2845 { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } },
2846 { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } };
2850 /************************************************************/
2852 /************************************************************/
2866 @LATTICE("THIS<IN,THISLOC=THIS")
2867 public SBI(@DELEGATE @LOC("IN") int[] thel, @DELEGATE @LOC("IN") int[] thes) {
2876 public int part2_3_length = 0;
2878 public int big_values = 0;
2880 public int global_gain = 0;
2882 public int scalefac_compress = 0;
2884 public int window_switching_flag = 0;
2886 public int block_type = 0;
2888 public int mixed_block_flag = 0;
2890 public int[] table_select;
2892 public int[] subblock_gain;
2894 public int region0_count = 0;
2896 public int region1_count = 0;
2898 public int preflag = 0;
2900 public int scalefac_scale = 0;
2902 public int count1table_select = 0;
2907 public gr_info_s() {
2908 table_select = new int[3];
2909 subblock_gain = new int[3];
2913 @LATTICE("GR2<GR1,GR1<GR,GR2*")
2918 public gr_info_s[] gr;
2923 public temporaire() {
2925 gr = new gr_info_s[2];
2926 gr[0] = new gr_info_s();
2927 gr[1] = new gr_info_s();
2931 @LATTICE("CH<TEMP,TEMP*")
2932 class III_side_info_t {
2935 public int main_data_begin = 0;
2937 public int private_bits = 0;
2939 public temporaire[] ch;
2944 public III_side_info_t() {
2945 ch = new temporaire[2];
2946 ch[0] = new temporaire();
2947 ch[1] = new temporaire();
2954 public int[] l; /* [cb] */
2956 public int[][] s; /* [window][cb] */
2961 public temporaire2() {
2967 // class III_scalefac_t
2969 // public temporaire2[] tab;
2971 // * Dummy Constructor
2973 // public III_scalefac_t()
2975 // tab = new temporaire2[2];