-/*\r
- * 11/19/04 1.0 moved to LGPL.\r
- * \r
- * 18/06/01 Michael Scheerer, Fixed bugs which causes\r
- * negative indexes in method huffmann_decode and in method \r
- * dequanisize_sample.\r
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 18/06/01 Michael Scheerer, Fixed bugs which causes
+ * negative indexes in method huffmann_decode and in method
+ * dequanisize_sample.
*\r
- * 16/07/01 Michael Scheerer, Catched a bug in method\r
- * huffmann_decode, which causes an outOfIndexException.\r
- * Cause : Indexnumber of 24 at SfBandIndex,\r
- * which has only a length of 22. I have simply and dirty \r
- * fixed the index to <= 22, because I'm not really be able\r
- * to fix the bug. The Indexnumber is taken from the MP3 \r
- * file and the origin Ma-Player with the same code works \r
- * well. \r
- * \r
- * 02/19/99 Java Conversion by E.B, javalayer@javazoom.net\r
- *-----------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Library General Public License as published\r
- * by the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Library General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Library General Public\r
- * License along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
- *----------------------------------------------------------------------\r
- */\r
-\r
-\r
-/**\r
- * Class Implementing Layer 3 Decoder.\r
- * \r
- * @since 0.0\r
- */\r
-@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,SF<SI,SI<CH,SFREQ<H,MAX<H,H<CH,FLCH<CH,FLCH<WCH,SF<SFT,SFT<NS,NS<C,TS<RAW,O<TS,LY<F,C*,FS*,SI*,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*")\r
-//4th: added for hybrid.\r
-//5th added for stereo\r
-//6th added for reorder method\r
-\r
-@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN")\r
-final class LayerIIIDecoder implements FrameDecoder {\r
- @LOC("F") final double d43 = (4.0 / 3.0);\r
- @LOC("SFT") public int[] scalefac_buffer;\r
-\r
- // MDM: removed, as this wasn't being used.\r
- // private float CheckSumOut1d = 0.0f;\r
- @LOC("CSH") private int CheckSumHuff = 0;\r
- @LOC("VAR") private int[] is_1d;\r
- @LOC("VAR") private float[][][] ro;\r
- @LOC("LR") private float[][][] lr;\r
- @LOC("O") private float[] out_1d; // 576 samples\r
- @LOC("VAR") private float[][] prevblck;\r
- @LOC("K") private float[][] k;\r
- @LOC("F") private int[] nonzero;\r
- @LOC("F")private Bitstream stream;\r
- @LOC("H") private Header header;\r
- @LOC("F") private SynthesisFilter filter1;\r
- @LOC("F") private SynthesisFilter filter2;\r
- @LOC("F") private Obuffer buffer; // output buffer\r
- @LOC("WC") private int which_channels;\r
- @LOC("BR") private BitReserve br;\r
- @LOC("SI") private III_side_info_t si;\r
-\r
- @LOC("SBT") private temporaire2[] III_scalefac_t;\r
- @LOC("SF") private temporaire2[] scalefac;\r
- // private III_scalefac_t scalefac;\r
-\r
- @LOC("MAX") private int max_gr;\r
- @LOC("FS") private int frame_start;\r
- @LOC("F") private int part2_start;\r
- @LOC("CH") private int channels;\r
- @LOC("FLCH") private int first_channel;\r
- @LOC("FLCH") private int last_channel;\r
- @LOC("SFREQ") private int sfreq;\r
-\r
- /**\r
- * Constructor.\r
- */\r
- // REVIEW: these constructor arguments should be moved to the\r
- // decodeFrame() method, where possible, so that one\r
- public LayerIIIDecoder(Bitstream stream0, Header header0, SynthesisFilter filtera,\r
- SynthesisFilter filterb, Obuffer buffer0, int which_ch0) {\r
- huffcodetab.inithuff();\r
- is_1d = new int[SBLIMIT * SSLIMIT + 4];\r
- ro = new float[2][SBLIMIT][SSLIMIT];\r
- lr = new float[2][SBLIMIT][SSLIMIT];\r
- out_1d = new float[SBLIMIT * SSLIMIT];\r
- prevblck = new float[2][SBLIMIT * SSLIMIT];\r
- k = new float[2][SBLIMIT * SSLIMIT];\r
- nonzero = new int[2];\r
-\r
- // III_scalefact_t\r
- III_scalefac_t = new temporaire2[2];\r
- III_scalefac_t[0] = new temporaire2();\r
- III_scalefac_t[1] = new temporaire2();\r
- scalefac = III_scalefac_t;\r
- // L3TABLE INIT\r
-\r
- sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices\r
- int[] l0 =\r
- { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,\r
- 464, 522, 576 };\r
- int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };\r
- int[] l1 =\r
- { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394,\r
- 464, 540, 576 };\r
- int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };\r
- int[] l2 =\r
- { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,\r
- 464, 522, 576 };\r
- int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };\r
-\r
- int[] l3 =\r
- { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342,\r
- 418, 576 };\r
- int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };\r
- int[] l4 =\r
- { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330,\r
- 384, 576 };\r
- int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };\r
- int[] l5 =\r
- { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448,\r
- 550, 576 };\r
- int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };\r
- // SZD: MPEG2.5\r
- int[] l6 =\r
- { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,\r
- 464, 522, 576 };\r
- int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };\r
- int[] l7 =\r
- { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,\r
- 464, 522, 576 };\r
- int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };\r
- int[] l8 =\r
- { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568,\r
- 570, 572, 574, 576 };\r
- int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 };\r
-\r
- sfBandIndex[0] = new SBI(l0, s0);\r
- sfBandIndex[1] = new SBI(l1, s1);\r
- sfBandIndex[2] = new SBI(l2, s2);\r
-\r
- sfBandIndex[3] = new SBI(l3, s3);\r
- sfBandIndex[4] = new SBI(l4, s4);\r
- sfBandIndex[5] = new SBI(l5, s5);\r
- // SZD: MPEG2.5\r
- sfBandIndex[6] = new SBI(l6, s6);\r
- sfBandIndex[7] = new SBI(l7, s7);\r
- sfBandIndex[8] = new SBI(l8, s8);\r
- // END OF L3TABLE INIT\r
-\r
- if (reorder_table == null) { // SZD: generate LUT\r
- reorder_table = new int[9][];\r
- for (int i = 0; i < 9; i++)\r
- reorder_table[i] = reorder(sfBandIndex[i].s);\r
- }\r
-\r
- // Sftable\r
- int[] ll0 = { 0, 6, 11, 16, 21 };\r
- int[] ss0 = { 0, 6, 12 };\r
- sftable = new Sftable(ll0, ss0);\r
- // END OF Sftable\r
-\r
- // scalefac_buffer\r
- scalefac_buffer = new int[54];\r
- // END OF scalefac_buffer\r
-\r
- stream = stream0;\r
- header = header0;\r
- filter1 = filtera;\r
- filter2 = filterb;\r
- buffer = buffer0;\r
- which_channels = which_ch0;\r
-\r
- frame_start = 0;\r
- channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;\r
- max_gr = (header.version() == Header.MPEG1) ? 2 : 1;\r
-\r
- sfreq =\r
- header.sample_frequency()\r
- + ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6\r
- : 0); // SZD\r
-\r
- if (channels == 2) {\r
- switch (which_channels) {\r
- case OutputChannels.LEFT_CHANNEL:\r
- case OutputChannels.DOWNMIX_CHANNELS:\r
- first_channel = last_channel = 0;\r
- break;\r
-\r
- case OutputChannels.RIGHT_CHANNEL:\r
- first_channel = last_channel = 1;\r
- break;\r
-\r
- case OutputChannels.BOTH_CHANNELS:\r
- default:\r
- first_channel = 0;\r
- last_channel = 1;\r
- break;\r
- }\r
- } else {\r
- first_channel = last_channel = 0;\r
- }\r
-\r
- for (int ch = 0; ch < 2; ch++)\r
- for (int j = 0; j < 576; j++)\r
- prevblck[ch][j] = 0.0f;\r
-\r
- nonzero[0] = nonzero[1] = 576;\r
-\r
- br = new BitReserve();\r
- si = new III_side_info_t();\r
- }\r
-\r
- /**\r
- * Notify decoder that a seek is being made.\r
- */\r
- public void seek_notify() {\r
- frame_start = 0;\r
- for (int ch = 0; ch < 2; ch++)\r
- for (int j = 0; j < 576; j++)\r
- prevblck[ch][j] = 0.0f;\r
- br = new BitReserve();\r
- }\r
-\r
- public void decodeFrame() {\r
- decode();\r
- }\r
-\r
- /**\r
- * Decode one frame, filling the buffer with the output samples.\r
- */\r
-\r
- // subband samples are buffered and passed to the\r
- // SynthesisFilter in one go.\r
- @LOC("SAM") private float[] samples1 = new float[32];\r
- @LOC("SAM") private float[] samples2 = new float[32];\r
-\r
- /* location hierarchy of decode()\r
-{header} {stream} {si}\r
-{br, flush_main, main_data_end,frame_start,nSlots,bytes_to_discard}* \r
-{gr,max_gr} // granule\r
-{ch,channels,first_channel, last_channel, which_channels} // channel\r
-{part2_start} \r
-{sb18, ss}\r
-{out_1d}*\r
-{sb}*\r
-{samples1,sample2} {filter1,filter2}\r
- */\r
- public void decode() {\r
- int nSlots = header.slots();\r
- int flush_main;\r
- int gr, ch, ss, sb, sb18;\r
- int main_data_end;\r
- int bytes_to_discard;\r
- int i;\r
-\r
- get_side_info();\r
-\r
- for (i = 0; i < nSlots; i++)\r
- br.hputbuf(stream.get_bits(8)); // br < stream\r
-\r
- // br < main_data_end\r
- main_data_end = br.hsstell() >>> 3; // of previous frame \r
- \r
-\r
- if ((flush_main = (br.hsstell() & 7)) != 0) { // flush_main < br\r
- br.hgetbits(8 - flush_main); // br < flush_main\r
- main_data_end++; // main_data_end*\r
- }\r
-\r
- // bytes_to_discard < GLB(frame_start,main_data_end,si)\r
- // TODO does bytes_to_discard need to go back to si??? \r
- bytes_to_discard = frame_start - main_data_end - si.main_data_begin;\r
-\r
- // frame_start should be *\r
- frame_start += nSlots;\r
-\r
- if (bytes_to_discard < 0)\r
- return;\r
-\r
- if (main_data_end > 4096) { // main_data_end should be > than 'frame_start' and 'br'\r
- frame_start -= 4096;\r
- br.rewindNbytes(4096);\r
- }\r
-\r
- for (; bytes_to_discard > 0; bytes_to_discard--) // bytes_to_discard > br\r
- br.hgetbits(8);\r
- \r
- // doing something from here\r
- \r
- // here 'gr' and 'max_gr' should be higher than 'ch','channels', and more\r
- for (gr = 0; gr < max_gr; gr++) { // two granules per channel \r
- // in the loop body, access set={part2_start} \r
- \r
- // 'ch', 'channels' should be higher than all locs in the below body\r
- for (ch = 0; ch < channels; ch++) { \r
- part2_start = br.hsstell(); // part2_start < br\r
-\r
- // grab scale factors from the main data. \r
- // following the scale factors is the actual compressed data\r
- if (header.version() == Header.MPEG1)\r
- get_scale_factors(ch, gr); // no need to care from this side\r
- // here move scale factor data from 'br' buffer to 'scalefac' field\r
- else\r
- // MPEG-2 LSF, SZD: MPEG-2.5 LSF\r
- get_LSF_scale_factors(ch, gr); // no need to care from this side\r
-\r
- // here, decoding the compressed audio data \r
- huffman_decode(ch, gr); // no need to care from this side\r
- // System.out.println("CheckSum HuffMan = " + CheckSumHuff);\r
- dequantize_sample(ro[ch], ch, gr); // no need to care from this side\r
- }\r
-\r
- stereo(gr); // no need to care from this side\r
-\r
- if ((which_channels == OutputChannels.DOWNMIX_CHANNELS) && (channels > 1))\r
- do_downmix();\r
-\r
- for (ch = first_channel; ch <= last_channel; ch++) { // 'ch' and 'first_channel' > the body\r
-\r
- // in the body\r
- // read set= lr,ch,gr,out_1d, sb18, ss, SSLIMIT, out_1d\r
- // write set= out_1d\r
- \r
- reorder(lr[ch], ch, gr); \r
- antialias(ch, gr);\r
- // for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +\r
- // out_1d[hb];\r
- // System.out.println("CheckSumOut1d = "+CheckSumOut1d);\r
-\r
- hybrid(ch, gr);\r
-\r
- // for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +\r
- // out_1d[hb];\r
- // System.out.println("CheckSumOut1d = "+CheckSumOut1d);\r
-\r
- for (sb18 = 18; sb18 < 576; sb18 += 36) // sb18 > ss, SSLIMIT, out1d\r
- // Frequency inversion\r
- for (ss = 1; ss < SSLIMIT; ss += 2) // 'ss','SSLIMIT' > out_1d\r
- out_1d[sb18 + ss] = -out_1d[sb18 + ss]; // out1d*\r
-\r
- // 'ch', 'which_channels' should be higher than if/else body!\r
- // location set written by if/else body \r
- // = {samples1, samples2, filter1, filter2} \r
- if ((ch == 0) || (which_channels == OutputChannels.RIGHT_CHANNEL)) {\r
- for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis\r
- sb = 0;\r
- for (sb18 = 0; sb18 < 576; sb18 += 18) {\r
- samples1[sb] = out_1d[sb18 + ss]; // out_1d > samples1\r
- // filter1.input_sample(out_1d[sb18+ss], sb);\r
- sb++; // sb should be loc*\r
- }\r
- filter1.input_samples(samples1);\r
- filter1.calculate_pcm_samples(buffer);\r
- }\r
- } else {\r
- for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis\r
- sb = 0;\r
- for (sb18 = 0; sb18 < 576; sb18 += 18) {\r
- samples2[sb] = out_1d[sb18 + ss]; // out_1d > samples2\r
- // filter2.input_sample(out_1d[sb18+ss], sb);\r
- sb++;\r
- }\r
- filter2.input_samples(samples2);\r
- filter2.calculate_pcm_samples(buffer);\r
- }\r
-\r
- }\r
- } // channels\r
- } // granule\r
-\r
- // System.out.println("Counter = ................................."+counter);\r
- // if (counter < 609)\r
- // {\r
- counter++; // count should be loc*\r
- buffer.write_buffer(1); // buffer!!!\r
- // }\r
- // else if (counter == 609)\r
- // {\r
- // buffer.close();\r
- // counter++;\r
- // }\r
- // else\r
- // {\r
- // }\r
-\r
- }\r
-\r
- /**\r
- * Reads the side info from the stream, assuming the entire. frame has been\r
- * read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)\r
- */\r
- private boolean get_side_info() {\r
- int ch, gr;\r
- if (header.version() == Header.MPEG1) {\r
-\r
- si.main_data_begin = stream.get_bits(9);\r
- if (channels == 1)\r
- si.private_bits = stream.get_bits(5);\r
- else\r
- si.private_bits = stream.get_bits(3);\r
-\r
- for (ch = 0; ch < channels; ch++) {\r
- si.ch[ch].scfsi[0] = stream.get_bits(1);\r
- si.ch[ch].scfsi[1] = stream.get_bits(1);\r
- si.ch[ch].scfsi[2] = stream.get_bits(1);\r
- si.ch[ch].scfsi[3] = stream.get_bits(1);\r
- }\r
-\r
- for (gr = 0; gr < 2; gr++) {\r
- for (ch = 0; ch < channels; ch++) {\r
- si.ch[ch].gr[gr].part2_3_length = stream.get_bits(12);\r
- si.ch[ch].gr[gr].big_values = stream.get_bits(9);\r
- si.ch[ch].gr[gr].global_gain = stream.get_bits(8);\r
- si.ch[ch].gr[gr].scalefac_compress = stream.get_bits(4);\r
- si.ch[ch].gr[gr].window_switching_flag = stream.get_bits(1);\r
- if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {\r
- si.ch[ch].gr[gr].block_type = stream.get_bits(2);\r
- si.ch[ch].gr[gr].mixed_block_flag = stream.get_bits(1);\r
-\r
- si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);\r
- si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);\r
-\r
- si.ch[ch].gr[gr].subblock_gain[0] = stream.get_bits(3);\r
- si.ch[ch].gr[gr].subblock_gain[1] = stream.get_bits(3);\r
- si.ch[ch].gr[gr].subblock_gain[2] = stream.get_bits(3);\r
-\r
- // Set region_count parameters since they are implicit in this case.\r
-\r
- if (si.ch[ch].gr[gr].block_type == 0) {\r
- // Side info bad: block_type == 0 in split block\r
- return false;\r
- } else if (si.ch[ch].gr[gr].block_type == 2 && si.ch[ch].gr[gr].mixed_block_flag == 0) {\r
- si.ch[ch].gr[gr].region0_count = 8;\r
- } else {\r
- si.ch[ch].gr[gr].region0_count = 7;\r
- }\r
- si.ch[ch].gr[gr].region1_count = 20 - si.ch[ch].gr[gr].region0_count;\r
- } else {\r
- si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);\r
- si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);\r
- si.ch[ch].gr[gr].table_select[2] = stream.get_bits(5);\r
- si.ch[ch].gr[gr].region0_count = stream.get_bits(4);\r
- si.ch[ch].gr[gr].region1_count = stream.get_bits(3);\r
- si.ch[ch].gr[gr].block_type = 0;\r
- }\r
- si.ch[ch].gr[gr].preflag = stream.get_bits(1);\r
- si.ch[ch].gr[gr].scalefac_scale = stream.get_bits(1);\r
- si.ch[ch].gr[gr].count1table_select = stream.get_bits(1);\r
- }\r
- }\r
-\r
- } else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF\r
-\r
- si.main_data_begin = stream.get_bits(8);\r
- if (channels == 1)\r
- si.private_bits = stream.get_bits(1);\r
- else\r
- si.private_bits = stream.get_bits(2);\r
-\r
- for (ch = 0; ch < channels; ch++) {\r
-\r
- si.ch[ch].gr[0].part2_3_length = stream.get_bits(12);\r
- si.ch[ch].gr[0].big_values = stream.get_bits(9);\r
- si.ch[ch].gr[0].global_gain = stream.get_bits(8);\r
- si.ch[ch].gr[0].scalefac_compress = stream.get_bits(9);\r
- si.ch[ch].gr[0].window_switching_flag = stream.get_bits(1);\r
-\r
- if ((si.ch[ch].gr[0].window_switching_flag) != 0) {\r
-\r
- si.ch[ch].gr[0].block_type = stream.get_bits(2);\r
- si.ch[ch].gr[0].mixed_block_flag = stream.get_bits(1);\r
- si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);\r
- si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);\r
-\r
- si.ch[ch].gr[0].subblock_gain[0] = stream.get_bits(3);\r
- si.ch[ch].gr[0].subblock_gain[1] = stream.get_bits(3);\r
- si.ch[ch].gr[0].subblock_gain[2] = stream.get_bits(3);\r
-\r
- // Set region_count parameters since they are implicit in this case.\r
-\r
- if (si.ch[ch].gr[0].block_type == 0) {\r
- // Side info bad: block_type == 0 in split block\r
- return false;\r
- } else if (si.ch[ch].gr[0].block_type == 2 && si.ch[ch].gr[0].mixed_block_flag == 0) {\r
- si.ch[ch].gr[0].region0_count = 8;\r
- } else {\r
- si.ch[ch].gr[0].region0_count = 7;\r
- si.ch[ch].gr[0].region1_count = 20 - si.ch[ch].gr[0].region0_count;\r
- }\r
-\r
- } else {\r
- si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);\r
- si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);\r
- si.ch[ch].gr[0].table_select[2] = stream.get_bits(5);\r
- si.ch[ch].gr[0].region0_count = stream.get_bits(4);\r
- si.ch[ch].gr[0].region1_count = stream.get_bits(3);\r
- si.ch[ch].gr[0].block_type = 0;\r
- }\r
-\r
- si.ch[ch].gr[0].scalefac_scale = stream.get_bits(1);\r
- si.ch[ch].gr[0].count1table_select = stream.get_bits(1);\r
- } // for(ch=0; ch<channels; ch++)\r
- } // if (header.version() == MPEG1)\r
- return true;\r
- }\r
-\r
- /**\r
- *\r
- */\r
- private void get_scale_factors(int ch, int gr) {\r
- int sfb, window;\r
- gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
- int scale_comp = gr_info.scalefac_compress;\r
- int length0 = slen[0][scale_comp];\r
- int length1 = slen[1][scale_comp];\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
- if ((gr_info.mixed_block_flag) != 0) { // MIXED\r
- for (sfb = 0; sfb < 8; sfb++)\r
- scalefac[ch].l[sfb] = br.hgetbits(slen[0][gr_info.scalefac_compress]);\r
- for (sfb = 3; sfb < 6; sfb++)\r
- for (window = 0; window < 3; window++)\r
- scalefac[ch].s[window][sfb] = br.hgetbits(slen[0][gr_info.scalefac_compress]);\r
- for (sfb = 6; sfb < 12; sfb++)\r
- for (window = 0; window < 3; window++)\r
- scalefac[ch].s[window][sfb] = br.hgetbits(slen[1][gr_info.scalefac_compress]);\r
- for (sfb = 12, window = 0; window < 3; window++)\r
- scalefac[ch].s[window][sfb] = 0;\r
-\r
- } else { // SHORT\r
-\r
- scalefac[ch].s[0][0] = br.hgetbits(length0);\r
- scalefac[ch].s[1][0] = br.hgetbits(length0);\r
- scalefac[ch].s[2][0] = br.hgetbits(length0);\r
- scalefac[ch].s[0][1] = br.hgetbits(length0);\r
- scalefac[ch].s[1][1] = br.hgetbits(length0);\r
- scalefac[ch].s[2][1] = br.hgetbits(length0);\r
- scalefac[ch].s[0][2] = br.hgetbits(length0);\r
- scalefac[ch].s[1][2] = br.hgetbits(length0);\r
- scalefac[ch].s[2][2] = br.hgetbits(length0);\r
- scalefac[ch].s[0][3] = br.hgetbits(length0);\r
- scalefac[ch].s[1][3] = br.hgetbits(length0);\r
- scalefac[ch].s[2][3] = br.hgetbits(length0);\r
- scalefac[ch].s[0][4] = br.hgetbits(length0);\r
- scalefac[ch].s[1][4] = br.hgetbits(length0);\r
- scalefac[ch].s[2][4] = br.hgetbits(length0);\r
- scalefac[ch].s[0][5] = br.hgetbits(length0);\r
- scalefac[ch].s[1][5] = br.hgetbits(length0);\r
- scalefac[ch].s[2][5] = br.hgetbits(length0);\r
- scalefac[ch].s[0][6] = br.hgetbits(length1);\r
- scalefac[ch].s[1][6] = br.hgetbits(length1);\r
- scalefac[ch].s[2][6] = br.hgetbits(length1);\r
- scalefac[ch].s[0][7] = br.hgetbits(length1);\r
- scalefac[ch].s[1][7] = br.hgetbits(length1);\r
- scalefac[ch].s[2][7] = br.hgetbits(length1);\r
- scalefac[ch].s[0][8] = br.hgetbits(length1);\r
- scalefac[ch].s[1][8] = br.hgetbits(length1);\r
- scalefac[ch].s[2][8] = br.hgetbits(length1);\r
- scalefac[ch].s[0][9] = br.hgetbits(length1);\r
- scalefac[ch].s[1][9] = br.hgetbits(length1);\r
- scalefac[ch].s[2][9] = br.hgetbits(length1);\r
- scalefac[ch].s[0][10] = br.hgetbits(length1);\r
- scalefac[ch].s[1][10] = br.hgetbits(length1);\r
- scalefac[ch].s[2][10] = br.hgetbits(length1);\r
- scalefac[ch].s[0][11] = br.hgetbits(length1);\r
- scalefac[ch].s[1][11] = br.hgetbits(length1);\r
- scalefac[ch].s[2][11] = br.hgetbits(length1);\r
- scalefac[ch].s[0][12] = 0;\r
- scalefac[ch].s[1][12] = 0;\r
- scalefac[ch].s[2][12] = 0;\r
- } // SHORT\r
-\r
- } else { // LONG types 0,1,3\r
-\r
- if ((si.ch[ch].scfsi[0] == 0) || (gr == 0)) {\r
- scalefac[ch].l[0] = br.hgetbits(length0);\r
- scalefac[ch].l[1] = br.hgetbits(length0);\r
- scalefac[ch].l[2] = br.hgetbits(length0);\r
- scalefac[ch].l[3] = br.hgetbits(length0);\r
- scalefac[ch].l[4] = br.hgetbits(length0);\r
- scalefac[ch].l[5] = br.hgetbits(length0);\r
- }\r
- if ((si.ch[ch].scfsi[1] == 0) || (gr == 0)) {\r
- scalefac[ch].l[6] = br.hgetbits(length0);\r
- scalefac[ch].l[7] = br.hgetbits(length0);\r
- scalefac[ch].l[8] = br.hgetbits(length0);\r
- scalefac[ch].l[9] = br.hgetbits(length0);\r
- scalefac[ch].l[10] = br.hgetbits(length0);\r
- }\r
- if ((si.ch[ch].scfsi[2] == 0) || (gr == 0)) {\r
- scalefac[ch].l[11] = br.hgetbits(length1);\r
- scalefac[ch].l[12] = br.hgetbits(length1);\r
- scalefac[ch].l[13] = br.hgetbits(length1);\r
- scalefac[ch].l[14] = br.hgetbits(length1);\r
- scalefac[ch].l[15] = br.hgetbits(length1);\r
- }\r
- if ((si.ch[ch].scfsi[3] == 0) || (gr == 0)) {\r
- scalefac[ch].l[16] = br.hgetbits(length1);\r
- scalefac[ch].l[17] = br.hgetbits(length1);\r
- scalefac[ch].l[18] = br.hgetbits(length1);\r
- scalefac[ch].l[19] = br.hgetbits(length1);\r
- scalefac[ch].l[20] = br.hgetbits(length1);\r
- }\r
-\r
- scalefac[ch].l[21] = 0;\r
- scalefac[ch].l[22] = 0;\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
- // MDM: new_slen is fully initialized before use, no need\r
- // to reallocate array.\r
- @LOC("NS") private final int[] new_slen = new int[4];\r
-\r
- private void get_LSF_scale_data(int ch, int gr) {\r
-\r
- int scalefac_comp, int_scalefac_comp;\r
- int mode_ext = header.mode_extension();\r
- int m;\r
- int blocktypenumber;\r
- int blocknumber = 0;\r
-\r
- gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
-\r
- scalefac_comp = gr_info.scalefac_compress;\r
-\r
- if (gr_info.block_type == 2) {\r
- if (gr_info.mixed_block_flag == 0)\r
- blocktypenumber = 1;\r
- else if (gr_info.mixed_block_flag == 1)\r
- blocktypenumber = 2;\r
- else\r
- blocktypenumber = 0;\r
- } else {\r
- blocktypenumber = 0;\r
- }\r
-\r
- if (!(((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {\r
-\r
- if (scalefac_comp < 400) {\r
-\r
- new_slen[0] = (scalefac_comp >>> 4) / 5;\r
- new_slen[1] = (scalefac_comp >>> 4) % 5;\r
- new_slen[2] = (scalefac_comp & 0xF) >>> 2;\r
- new_slen[3] = (scalefac_comp & 3);\r
- si.ch[ch].gr[gr].preflag = 0;\r
- blocknumber = 0;\r
-\r
- } else if (scalefac_comp < 500) {\r
-\r
- new_slen[0] = ((scalefac_comp - 400) >>> 2) / 5;\r
- new_slen[1] = ((scalefac_comp - 400) >>> 2) % 5;\r
- new_slen[2] = (scalefac_comp - 400) & 3;\r
- new_slen[3] = 0;\r
- si.ch[ch].gr[gr].preflag = 0;\r
- blocknumber = 1;\r
-\r
- } else if (scalefac_comp < 512) {\r
-\r
- new_slen[0] = (scalefac_comp - 500) / 3;\r
- new_slen[1] = (scalefac_comp - 500) % 3;\r
- new_slen[2] = 0;\r
- new_slen[3] = 0;\r
- si.ch[ch].gr[gr].preflag = 1;\r
- blocknumber = 2;\r
- }\r
- }\r
-\r
- if ((((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {\r
- int_scalefac_comp = scalefac_comp >>> 1;\r
-\r
- if (int_scalefac_comp < 180) {\r
- new_slen[0] = int_scalefac_comp / 36;\r
- new_slen[1] = (int_scalefac_comp % 36) / 6;\r
- new_slen[2] = (int_scalefac_comp % 36) % 6;\r
- new_slen[3] = 0;\r
- si.ch[ch].gr[gr].preflag = 0;\r
- blocknumber = 3;\r
- } else if (int_scalefac_comp < 244) {\r
- new_slen[0] = ((int_scalefac_comp - 180) & 0x3F) >>> 4;\r
- new_slen[1] = ((int_scalefac_comp - 180) & 0xF) >>> 2;\r
- new_slen[2] = (int_scalefac_comp - 180) & 3;\r
- new_slen[3] = 0;\r
- si.ch[ch].gr[gr].preflag = 0;\r
- blocknumber = 4;\r
- } else if (int_scalefac_comp < 255) {\r
- new_slen[0] = (int_scalefac_comp - 244) / 3;\r
- new_slen[1] = (int_scalefac_comp - 244) % 3;\r
- new_slen[2] = 0;\r
- new_slen[3] = 0;\r
- si.ch[ch].gr[gr].preflag = 0;\r
- blocknumber = 5;\r
- }\r
- }\r
-\r
- for (int x = 0; x < 45; x++)\r
- // why 45, not 54?\r
- scalefac_buffer[x] = 0;\r
-\r
- m = 0;\r
- for (int i = 0; i < 4; i++) {\r
- for (int j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++) {\r
- scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);\r
- m++;\r
-\r
- } // for (unint32 j ...\r
- } // for (uint32 i ...\r
- }\r
-\r
- /**\r
- *\r
- */\r
- private void get_LSF_scale_factors(int ch, int gr) {\r
- int m = 0;\r
- int sfb, window;\r
- gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
-\r
- get_LSF_scale_data(ch, gr);\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
- if (gr_info.mixed_block_flag != 0) { // MIXED\r
- for (sfb = 0; sfb < 8; sfb++) {\r
- scalefac[ch].l[sfb] = scalefac_buffer[m];\r
- m++;\r
- }\r
- for (sfb = 3; sfb < 12; sfb++) {\r
- for (window = 0; window < 3; window++) {\r
- scalefac[ch].s[window][sfb] = scalefac_buffer[m];\r
- m++;\r
- }\r
- }\r
- for (window = 0; window < 3; window++)\r
- scalefac[ch].s[window][12] = 0;\r
-\r
- } else { // SHORT\r
-\r
- for (sfb = 0; sfb < 12; sfb++) {\r
- for (window = 0; window < 3; window++) {\r
- scalefac[ch].s[window][sfb] = scalefac_buffer[m];\r
- m++;\r
- }\r
- }\r
-\r
- for (window = 0; window < 3; window++)\r
- scalefac[ch].s[window][12] = 0;\r
- }\r
- } else { // LONG types 0,1,3\r
-\r
- for (sfb = 0; sfb < 21; sfb++) {\r
- scalefac[ch].l[sfb] = scalefac_buffer[m];\r
- m++;\r
- }\r
- scalefac[ch].l[21] = 0; // Jeff\r
- scalefac[ch].l[22] = 0;\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
- @LOC("LY") int[] x = { 0 };\r
- @LOC("F") int[] y = { 0 };\r
- @LOC("LY") int[] v = { 0 };\r
- @LOC("LY") int[] w = { 0 };\r
-\r
- private void huffman_decode(int ch, int gr) {\r
- x[0] = 0;\r
- y[0] = 0;\r
- v[0] = 0;\r
- w[0] = 0;\r
-\r
- int part2_3_end = part2_start + si.ch[ch].gr[gr].part2_3_length;\r
- int num_bits;\r
- int region1Start;\r
- int region2Start;\r
- int index;\r
-\r
- int buf;\r
- int buf1;\r
-\r
- huffcodetab h;\r
-\r
- // Find region boundary for short block case\r
-\r
- if (((si.ch[ch].gr[gr].window_switching_flag) != 0) && (si.ch[ch].gr[gr].block_type == 2)) {\r
-\r
- // Region2.\r
- // MS: Extrahandling for 8KHZ\r
- region1Start = (sfreq == 8) ? 72 : 36; // sfb[9/3]*3=36 or in case 8KHZ =\r
- // 72\r
- region2Start = 576; // No Region2 for short block case\r
-\r
- } else { // Find region boundary for long block case\r
-\r
- buf = si.ch[ch].gr[gr].region0_count + 1;\r
- buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;\r
-\r
- if (buf1 > sfBandIndex[sfreq].l.length - 1)\r
- buf1 = sfBandIndex[sfreq].l.length - 1;\r
-\r
- region1Start = sfBandIndex[sfreq].l[buf];\r
- region2Start = sfBandIndex[sfreq].l[buf1]; /* MI */\r
- }\r
-\r
- index = 0;\r
- // Read bigvalues area\r
- for (int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i += 2) {\r
- if (i < region1Start)\r
- h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];\r
- else if (i < region2Start)\r
- h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];\r
- else\r
- h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];\r
-\r
- huffcodetab.huffman_decoder(h, x, y, v, w, br);\r
- // if (index >= is_1d.length)\r
- // System.out.println("i0="+i+"/"+(si.ch[ch].gr[gr].big_values<<1)+" Index="+index+" is_1d="+is_1d.length);\r
-\r
- is_1d[index++] = x[0];\r
- is_1d[index++] = y[0];\r
-\r
- CheckSumHuff = CheckSumHuff + x[0] + y[0];\r
- // System.out.println("x = "+x[0]+" y = "+y[0]);\r
- }\r
-\r
- // Read count1 area\r
- h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];\r
- num_bits = br.hsstell();\r
-\r
- while ((num_bits < part2_3_end) && (index < 576)) {\r
-\r
- huffcodetab.huffman_decoder(h, x, y, v, w, br);\r
-\r
- is_1d[index++] = v[0];\r
- is_1d[index++] = w[0];\r
- is_1d[index++] = x[0];\r
- is_1d[index++] = y[0];\r
- CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];\r
- // System.out.println("v = "+v[0]+" w = "+w[0]);\r
- // System.out.println("x = "+x[0]+" y = "+y[0]);\r
- num_bits = br.hsstell();\r
- }\r
-\r
- if (num_bits > part2_3_end) {\r
- br.rewindNbits(num_bits - part2_3_end);\r
- index -= 4;\r
- }\r
-\r
- num_bits = br.hsstell();\r
-\r
- // Dismiss stuffing bits\r
- if (num_bits < part2_3_end)\r
- br.hgetbits(part2_3_end - num_bits);\r
-\r
- // Zero out rest\r
-\r
- if (index < 576)\r
- nonzero[ch] = index;\r
- else\r
- nonzero[ch] = 576;\r
-\r
- if (index < 0)\r
- index = 0;\r
-\r
- // may not be necessary\r
- for (; index < 576; index++)\r
- is_1d[index] = 0;\r
- }\r
-\r
- /**\r
- *\r
- */\r
- private void i_stereo_k_values(@LOC("IN") int is_pos, @LOC("IN") int io_type, @LOC("IN") int i) {\r
- if (is_pos == 0) {\r
- k[0][i] = 1.0f;\r
- k[1][i] = 1.0f;\r
- } else if ((is_pos & 1) != 0) {\r
- k[0][i] = io[io_type][(is_pos + 1) >>> 1];\r
- k[1][i] = 1.0f;\r
- } else {\r
- k[0][i] = 1.0f;\r
- k[1][i] = io[io_type][is_pos >>> 1];\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
- @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")\r
- private void dequantize_sample(@LOC("OUT") float xr[][], @LOC("IN") int ch, @LOC("IN") int gr) {\r
- @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
- @LOC("CB") int cb = 0;\r
- @LOC("CB") int next_cb_boundary;\r
- @LOC("CB") int cb_begin = 0;\r
- @LOC("CB") int cb_width = 0;\r
- @LOC("IN") int index = 0;\r
- @LOC("VAR") int t_index;\r
- @LOC("J") int j;\r
- @LOC("VAR") float g_gain;\r
- //float[][] xr_1d = xr;//substituted xr for instances of xr_1d to decrease number of areas\r
-\r
- // choose correct scalefactor band per block type, initalize boundary\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
- if (gr_info.mixed_block_flag != 0)\r
- next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3\r
- else {\r
- cb_width = sfBandIndex[sfreq].s[1];\r
- next_cb_boundary = (cb_width << 2) - cb_width;\r
- cb_begin = 0;\r
- }\r
- } else {\r
- next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3\r
- }\r
-\r
- // Compute overall (global) scaling.\r
-\r
- g_gain = (float) Math.pow(2.0, (0.25 * (gr_info.global_gain - 210.0)));\r
-\r
- for (j = 0; j < nonzero[ch]; j++) {\r
- // Modif E.B 02/22/99\r
- @LOC("REST") int reste = j % SSLIMIT;\r
- @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);\r
- if (is_1d[j] == 0)\r
- xr[quotien][reste] = 0.0f;\r
- else {\r
- @LOC("VAR") int abv = is_1d[j];\r
- // Pow Array fix (11/17/04)\r
- if (abv < t_43.length) {\r
- if (is_1d[j] > 0)\r
- xr[quotien][reste] = g_gain * t_43[abv];\r
- else {\r
- if (-abv < t_43.length)\r
- xr[quotien][reste] = -g_gain * t_43[-abv];\r
- else\r
- xr[quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);\r
- }\r
- } else {\r
- if (is_1d[j] > 0)\r
- xr[quotien][reste] = g_gain * (float) Math.pow(abv, d43);\r
- else\r
- xr[quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);\r
- }\r
- }\r
- }\r
-\r
- // apply formula per block type\r
- for (j = 0; j < nonzero[ch]; j++) {\r
- // Modif E.B 02/22/99\r
- @LOC("REST") int reste = j % SSLIMIT;\r
- @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);\r
-\r
- if (index == next_cb_boundary) { /* Adjust critical band boundary */\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
- if (gr_info.mixed_block_flag != 0) {\r
-\r
- if (index == sfBandIndex[sfreq].l[8]) {\r
- next_cb_boundary = sfBandIndex[sfreq].s[4];\r
- next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;\r
- cb = 3;\r
- cb_width = sfBandIndex[sfreq].s[4] - sfBandIndex[sfreq].s[3];\r
-\r
- cb_begin = sfBandIndex[sfreq].s[3];\r
- cb_begin = (cb_begin << 2) - cb_begin;\r
-\r
- } else if (index < sfBandIndex[sfreq].l[8]) {\r
-\r
- next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];\r
-\r
- } else {\r
-\r
- next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];\r
- next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;\r
-\r
- cb_begin = sfBandIndex[sfreq].s[cb];\r
- cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;\r
- cb_begin = (cb_begin << 2) - cb_begin;\r
- }\r
-\r
- } else {\r
-\r
- next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];\r
- next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;\r
-\r
- cb_begin = sfBandIndex[sfreq].s[cb];\r
- cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;\r
- cb_begin = (cb_begin << 2) - cb_begin;\r
- }\r
-\r
- } else { // long blocks\r
-\r
- next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];\r
-\r
- }\r
- }\r
-\r
- // Do long/short dependent scaling operations\r
-\r
- if ((gr_info.window_switching_flag != 0)\r
- && (((gr_info.block_type == 2) && (gr_info.mixed_block_flag == 0)) || ((gr_info.block_type == 2)\r
- && (gr_info.mixed_block_flag != 0) && (j >= 36)))) {\r
-\r
- t_index = (index - cb_begin) / cb_width;\r
- /*\r
- * xr[sb][ss] *= pow(2.0, ((-2.0 * gr_info.subblock_gain[t_index]) -(0.5\r
- * * (1.0 + gr_info.scalefac_scale) scalefac[ch].s[t_index][cb])));\r
- */\r
- @LOC("IDX") int idx = scalefac[ch].s[t_index][cb] << gr_info.scalefac_scale;\r
- idx += (gr_info.subblock_gain[t_index] << 2);\r
-\r
- xr[quotien][reste] *= two_to_negative_half_pow[idx];\r
-\r
- } else { // LONG block types 0,1,3 & 1st 2 subbands of switched blocks\r
- /*\r
- * xr[sb][ss] *= pow(2.0, -0.5 * (1.0+gr_info.scalefac_scale)\r
- * (scalefac[ch].l[cb] + gr_info.preflag * pretab[cb]));\r
- */\r
- @LOC("IDX") int idx = scalefac[ch].l[cb];\r
-\r
- if (gr_info.preflag != 0)\r
- idx += pretab[cb];\r
-\r
- idx = idx << gr_info.scalefac_scale;\r
- xr[quotien][reste] *= two_to_negative_half_pow[idx];\r
- }\r
- index++;\r
- }\r
-\r
- for (j = nonzero[ch]; j < 576; j++) {\r
- // Modif E.B 02/22/99\r
- @LOC("REST") int reste = j % SSLIMIT;\r
- @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);\r
- if (reste < 0)\r
- reste = 0;\r
- if (quotien < 0)\r
- quotien = 0;\r
- xr[quotien][reste] = 0.0f;\r
- }\r
-\r
- return;\r
- }\r
-\r
- /**\r
- *\r
- */\r
- @LATTICE("THIS<I,I<GR,GR<IN,I*,THISLOC=THIS,GLOBALLOC=IN")\r
- private void reorder(@LOC("IN") float xr[][], @LOC("IN") int ch, @LOC("IN") int gr) {\r
- // the purpose of reordering: move 'short samples' back to their original position\r
- // after reorder, the samples are no long ordered by frequency\r
- \r
- // the format of input data to reorder: \r
- // three small chunks of 192 samples each are combined to 576 samples ordered by frequency \r
- \r
- @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
- @LOC("THIS,LayerIIIDecoder.RO6") int freq;\r
- @LOC("THIS,LayerIIIDecoder.RO5") int freq3;\r
- @LOC("I") int index;\r
- @LOC("THIS,LayerIIIDecoder.RO9") int sfb;\r
- @LOC("THIS,LayerIIIDecoder.RO8") int sfb_start;\r
- @LOC("THIS,LayerIIIDecoder.RO7") int sfb_lines;\r
- @LOC("THIS,LayerIIIDecoder.RO4") int src_line;\r
- @LOC("THIS,LayerIIIDecoder.RO1") int des_line;\r
- //float[][] xr_1d = xr; subbed in xr for xr_1d so as not to create extra areas\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
-\r
- for (index = 0; index < 576; index++)\r
- out_1d[index] = 0.0f;\r
-\r
- if (gr_info.mixed_block_flag != 0) {\r
- // NO REORDER FOR LOW 2 SUBBANDS\r
- for (index = 0; index < 36; index++) {\r
- // Modif E.B 02/22/99\r
- @LOC("THIS,LayerIIIDecoder.RO3") int reste = index % SSLIMIT;\r
- @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((index - reste) / SSLIMIT);\r
- out_1d[index] = xr[quotien][reste];\r
- }\r
- // REORDERING FOR REST SWITCHED SHORT\r
- /*\r
- * for( sfb=3,sfb_start=sfBandIndex[sfreq].s[3],\r
- * sfb_lines=sfBandIndex[sfreq].s[4] - sfb_start; sfb < 13;\r
- * sfb++,sfb_start = sfBandIndex[sfreq].s[sfb], sfb_lines =\r
- * sfBandIndex[sfreq].s[sfb+1] - sfb_start ) {\r
- */\r
- for (sfb = 3; sfb < 13; sfb++) {\r
- // System.out.println("sfreq="+sfreq+" sfb="+sfb+" sfBandIndex="+sfBandIndex.length+" sfBandIndex[sfreq].s="+sfBandIndex[sfreq].s.length);\r
- sfb_start = sfBandIndex[sfreq].s[sfb];\r
- sfb_lines = sfBandIndex[sfreq].s[sfb + 1] - sfb_start;\r
-\r
- @LOC("THIS,LayerIIIDecoder.RO7") int sfb_start3 = (sfb_start << 2) - sfb_start;\r
-\r
- for (freq = 0, freq3 = 0; freq < sfb_lines; freq++, freq3 += 3) {\r
-\r
- src_line = sfb_start3 + freq;\r
- des_line = sfb_start3 + freq3;\r
- // Modif E.B 02/22/99\r
- @LOC("THIS,LayerIIIDecoder.RO3") int reste = src_line % SSLIMIT;\r
- @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((src_line - reste) / SSLIMIT);\r
-\r
- out_1d[des_line] = xr[quotien][reste];\r
- src_line += sfb_lines;\r
- des_line++;\r
-\r
- reste = src_line % SSLIMIT;\r
- quotien = (int) ((src_line - reste) / SSLIMIT);\r
-\r
- out_1d[des_line] = xr[quotien][reste];\r
- src_line += sfb_lines;\r
- des_line++;\r
-\r
- reste = src_line % SSLIMIT;\r
- quotien = (int) ((src_line - reste) / SSLIMIT);\r
-\r
- out_1d[des_line] = xr[quotien][reste];\r
- }\r
- }\r
-\r
- } else { // pure short\r
- for (index = 0; index < 576; index++) {\r
- @LOC("THIS,LayerIIIDecoder.RO8") int j = reorder_table[sfreq][index];\r
- @LOC("THIS,LayerIIIDecoder.RO3") int reste = j % SSLIMIT;\r
- @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((j - reste) / SSLIMIT);\r
- out_1d[index] = xr[quotien][reste];\r
- }\r
- }\r
- } else { // long blocks\r
- for (index = 0; index < 576; index++) {\r
- // Modif E.B 02/22/99\r
- @LOC("THIS,LayerIIIDecoder.RO3") int reste = index % SSLIMIT;\r
- @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((index - reste) / SSLIMIT);\r
- out_1d[index] = xr[quotien][reste];\r
- }\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
-\r
- @LOC("IP") int[] is_pos = new int[576];\r
- @LOC("IR") float[] is_ratio = new float[576];\r
-\r
- @LATTICE("IO<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN") \r
- private void stereo(@LOC("IN") int gr) {\r
- @LOC("SH") int sb;\r
- @LOC("SH") int ss;\r
-\r
- if (channels == 1) { // mono , bypass xr[0][][] to lr[0][][]\r
-\r
- for (sb = 0; sb < SBLIMIT; sb++)\r
- for (ss = 0; ss < SSLIMIT; ss += 3) {\r
- lr[0][sb][ss] = ro[0][sb][ss];\r
- lr[0][sb][ss + 1] = ro[0][sb][ss + 1];\r
- lr[0][sb][ss + 2] = ro[0][sb][ss + 2];\r
- }\r
-\r
- } else {\r
-\r
- @LOC("THIS,LayerIIIDecoder.ME") gr_info_s gr_info = (si.ch[0].gr[gr]);\r
- @LOC("THIS,LayerIIIDecoder.ME") int mode_ext = header.mode_extension();\r
- @LOC("THIS,LayerIIIDecoder.SH") int sfb;\r
- @LOC("THIS,LayerIIIDecoder.SH") int i;\r
- @LOC("THIS,LayerIIIDecoder.SH") int lines;\r
- @LOC("THIS,LayerIIIDecoder.SH") int temp;\r
- @LOC("THIS,LayerIIIDecoder.TMP2") int temp2;\r
-\r
- @LOC("THIS,LayerIIIDecoder.S") boolean ms_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x2) != 0));\r
- @LOC("THIS,LayerIIIDecoder.S") boolean i_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x1) != 0));\r
- @LOC("THIS,LayerIIIDecoder.LSF") boolean lsf =\r
- ((header.version() == Header.MPEG2_LSF || header.version() == Header.MPEG25_LSF)); // SZD\r
-\r
- @LOC("IO") int io_type = (gr_info.scalefac_compress & 1);\r
-\r
- // initialization\r
-\r
- for (i = 0; i < 576; i++) {\r
- is_pos[i] = 7;\r
-\r
- is_ratio[i] = 0.0f;\r
- }\r
-\r
- if (i_stereo) {\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {\r
- if (gr_info.mixed_block_flag != 0) {\r
-\r
- @LOC("THIS,LayerIIIDecoder.SH") int max_sfb = 0;\r
-\r
- for (@LOC("THIS,LayerIIIDecoder.J") int j = 0; j < 3; j++) {\r
- @LOC("THIS,LayerIIIDecoder.SH") int sfbcnt;\r
- sfbcnt = 2;\r
- for (sfb = 12; sfb >= 3; sfb--) {\r
- i = sfBandIndex[sfreq].s[sfb];\r
- lines = sfBandIndex[sfreq].s[sfb + 1] - i;\r
- i = (i << 2) - i + (j + 1) * lines - 1;\r
-\r
- while (lines > 0) {\r
- if (ro[1][i / 18][i % 18] != 0.0f) {\r
- // MDM: in java, array access is very slow.\r
- // Is quicker to compute div and mod values.\r
- // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {\r
- sfbcnt = sfb;\r
- sfb = -10;\r
- lines = -10;\r
- }\r
-\r
- lines--;\r
- i--;\r
-\r
- } // while (lines > 0)\r
-\r
- } // for (sfb=12 ...\r
- sfb = sfbcnt + 1;\r
-\r
- if (sfb > max_sfb)\r
- max_sfb = sfb;\r
-\r
- while (sfb < 12) {\r
- temp = sfBandIndex[sfreq].s[sfb];\r
- sb = sfBandIndex[sfreq].s[sfb + 1] - temp;\r
- i = (temp << 2) - temp + j * sb;\r
-\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = scalefac[1].s[j][sfb];\r
- if (is_pos[i] != 7)\r
- if (lsf)\r
- i_stereo_k_values(is_pos[i], io_type, i);\r
- else\r
- is_ratio[i] = TAN12[is_pos[i]];\r
-\r
- i++;\r
- } // for (; sb>0...\r
- sfb++;\r
- } // while (sfb < 12)\r
- sfb = sfBandIndex[sfreq].s[10];\r
- sb = sfBandIndex[sfreq].s[11] - sfb;\r
- sfb = (sfb << 2) - sfb + j * sb;\r
- temp = sfBandIndex[sfreq].s[11];\r
- sb = sfBandIndex[sfreq].s[12] - temp;\r
- i = (temp << 2) - temp + j * sb;\r
-\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = is_pos[sfb];\r
-\r
- if (lsf) {\r
- k[0][i] = k[0][sfb];\r
- k[1][i] = k[1][sfb];\r
- } else {\r
- is_ratio[i] = is_ratio[sfb];\r
- }\r
- i++;\r
- } // for (; sb > 0 ...\r
- }\r
- if (max_sfb <= 3) {\r
- i = 2;\r
- ss = 17;\r
- sb = -1;\r
- while (i >= 0) {\r
- if (ro[1][i][ss] != 0.0f) {\r
- sb = (i << 4) + (i << 1) + ss;\r
- i = -1;\r
- } else {\r
- ss--;\r
- if (ss < 0) {\r
- i--;\r
- ss = 17;\r
- }\r
- } // if (ro ...\r
- } // while (i>=0)\r
- i = 0;\r
- while (sfBandIndex[sfreq].l[i] <= sb)\r
- i++;\r
- sfb = i;\r
- i = sfBandIndex[sfreq].l[i];\r
- for (; sfb < 8; sfb++) {\r
- sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = scalefac[1].l[sfb];\r
- if (is_pos[i] != 7)\r
- if (lsf)\r
- i_stereo_k_values(is_pos[i], io_type, i);\r
- else\r
- is_ratio[i] = TAN12[is_pos[i]];\r
- i++;\r
- } // for (; sb>0 ...\r
- } // for (; sfb<8 ...\r
- } // for (j=0 ...\r
- } else { // if (gr_info.mixed_block_flag)\r
- for (@LOC("THIS,LayerIIIDecoder.J") int j = 0; j < 3; j++) {\r
- @LOC("THIS,LayerIIIDecoder.SH") int sfbcnt;\r
- sfbcnt = -1;\r
- for (sfb = 12; sfb >= 0; sfb--) {\r
- temp = sfBandIndex[sfreq].s[sfb];\r
- lines = sfBandIndex[sfreq].s[sfb + 1] - temp;\r
- i = (temp << 2) - temp + (j + 1) * lines - 1;\r
-\r
- while (lines > 0) {\r
- if (ro[1][i / 18][i % 18] != 0.0f) {\r
- // MDM: in java, array access is very slow.\r
- // Is quicker to compute div and mod values.\r
- // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {\r
- sfbcnt = sfb;\r
- sfb = -10;\r
- lines = -10;\r
- }\r
- lines--;\r
- i--;\r
- } // while (lines > 0) */\r
-\r
- } // for (sfb=12 ...\r
- sfb = sfbcnt + 1;\r
- while (sfb < 12) {\r
- temp = sfBandIndex[sfreq].s[sfb];\r
- sb = sfBandIndex[sfreq].s[sfb + 1] - temp;\r
- i = (temp << 2) - temp + j * sb;\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = scalefac[1].s[j][sfb];\r
- if (is_pos[i] != 7)\r
- if (lsf)\r
- i_stereo_k_values(is_pos[i], io_type, i);\r
- else\r
- is_ratio[i] = TAN12[is_pos[i]];\r
- i++;\r
- } // for (; sb>0 ...\r
- sfb++;\r
- } // while (sfb<12)\r
-\r
- temp = sfBandIndex[sfreq].s[10];\r
- temp2 = sfBandIndex[sfreq].s[11];\r
- sb = temp2 - temp;\r
- sfb = (temp << 2) - temp + j * sb;\r
- sb = sfBandIndex[sfreq].s[12] - temp2;\r
- i = (temp2 << 2) - temp2 + j * sb;\r
-\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = is_pos[sfb];\r
-\r
- if (lsf) {\r
- k[0][i] = k[0][sfb];\r
- k[1][i] = k[1][sfb];\r
- } else {\r
- is_ratio[i] = is_ratio[sfb];\r
- }\r
- i++;\r
- } // for (; sb>0 ...\r
- } // for (sfb=12\r
- } // for (j=0 ...\r
- } else { // if (gr_info.window_switching_flag ...\r
- i = 31;\r
- ss = 17;\r
- sb = 0;\r
- while (i >= 0) {\r
- if (ro[1][i][ss] != 0.0f) {\r
- sb = (i << 4) + (i << 1) + ss;\r
- i = -1;\r
- } else {\r
- ss--;\r
- if (ss < 0) {\r
- i--;\r
- ss = 17;\r
- }\r
- }\r
- }\r
- i = 0;\r
- while (sfBandIndex[sfreq].l[i] <= sb)\r
- i++;\r
-\r
- sfb = i;\r
- i = sfBandIndex[sfreq].l[i];\r
- for (; sfb < 21; sfb++) {\r
- sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];\r
- for (; sb > 0; sb--) {\r
- is_pos[i] = scalefac[1].l[sfb];\r
- if (is_pos[i] != 7)\r
- if (lsf)\r
- i_stereo_k_values(is_pos[i], io_type, i);\r
- else\r
- is_ratio[i] = TAN12[is_pos[i]];\r
- i++;\r
- }\r
- }\r
- sfb = sfBandIndex[sfreq].l[20];\r
- for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {\r
- is_pos[i] = is_pos[sfb]; // error here : i >=576\r
-\r
- if (lsf) {\r
- k[0][i] = k[0][sfb];\r
- k[1][i] = k[1][sfb];\r
- } else {\r
- is_ratio[i] = is_ratio[sfb];\r
- }\r
- i++;\r
- } // if (gr_info.mixed_block_flag)\r
- } // if (gr_info.window_switching_flag ...\r
- } // if (i_stereo)\r
-\r
- i = 0;\r
- for (sb = 0; sb < SBLIMIT; sb++)\r
- for (ss = 0; ss < SSLIMIT; ss++) {\r
- if (is_pos[i] == 7) {\r
- if (ms_stereo) {\r
- lr[0][sb][ss] = (ro[0][sb][ss] + ro[1][sb][ss]) * 0.707106781f;\r
- lr[1][sb][ss] = (ro[0][sb][ss] - ro[1][sb][ss]) * 0.707106781f;\r
- } else {\r
- lr[0][sb][ss] = ro[0][sb][ss];\r
- lr[1][sb][ss] = ro[1][sb][ss];\r
- }\r
- } else if (i_stereo) {\r
-\r
- if (lsf) {\r
- lr[0][sb][ss] = ro[0][sb][ss] * k[0][i];\r
- lr[1][sb][ss] = ro[0][sb][ss] * k[1][i];\r
- } else {\r
- lr[1][sb][ss] = ro[0][sb][ss] / (float) (1 + is_ratio[i]);\r
- lr[0][sb][ss] = lr[1][sb][ss] * is_ratio[i];\r
- }\r
- }\r
- /*\r
- * else { System.out.println("Error in stereo processing\n"); }\r
- */\r
- i++;\r
- }\r
-\r
- } // channels == 2\r
-\r
- }\r
-\r
- /**\r
- *\r
- */\r
- @LATTICE("THIS<SRC<SS,SS<SB18,SB18<SB18LIM,SB18LIM<GR,GR<IN,SB18*,SS*,THISLOC=THIS")\r
- private void antialias(@LOC("IN") int ch, @LOC("IN") int gr) {\r
- @LOC("SB18") int sb18;\r
- @LOC("SS") int ss;\r
- @LOC("SB18LIM") int sb18lim;\r
- @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
- // 31 alias-reduction operations between each pair of sub-bands\r
- // with 8 butterflies between each pair\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)\r
- && !(gr_info.mixed_block_flag != 0))\r
- return;\r
-\r
- if ((gr_info.window_switching_flag != 0) && (gr_info.mixed_block_flag != 0)\r
- && (gr_info.block_type == 2)) {\r
- sb18lim = 18;\r
- } else {\r
- sb18lim = 558;\r
- }\r
-\r
- for (sb18 = 0; sb18 < sb18lim; sb18 += 18) {\r
- for (ss = 0; ss < 8; ss++) {\r
- @LOC("SRC") int src_idx1 = sb18 + 17 - ss;\r
- @LOC("SRC") int src_idx2 = sb18 + 18 + ss;\r
- @LOC("THIS,LayerIIIDecoder.O") float bu = out_1d[src_idx1];\r
- @LOC("THIS,LayerIIIDecoder.0") float bd = out_1d[src_idx2];\r
- out_1d[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);\r
- out_1d[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
-\r
- // MDM: tsOutCopy and rawout do not need initializing, so the arrays\r
- // can be reused.\r
- @LOC("TS") float[] tsOutCopy = new float[18];\r
- @LOC("RAW") float[] rawout = new float[36];\r
- \r
-@LATTICE("THIS<SB,THIS<SH,SH<IN,IN<GLOBAL,SB*,SH*,THISLOC=THIS,GLOBALLOC=GLOBAL")\r
- private void hybrid(@LOC("IN") int ch, @LOC("IN") int gr) {\r
- @LOC("THIS,LayerIIIDecoder.BT") int bt;\r
- @LOC("SB") int sb18;\r
- @LOC("THIS,LayerIIIDecoder.GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);\r
- @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut;\r
-\r
- //float[][] prvblk;\r
-\r
- for (sb18 = 0; sb18 < 576; sb18 += 18) {\r
- bt =\r
- ((gr_info.window_switching_flag != 0) && (gr_info.mixed_block_flag != 0) && (sb18 < 36))\r
- ? 0 : gr_info.block_type;\r
-\r
- tsOut = out_1d;\r
- // Modif E.B 02/22/99\r
- for (@LOC("SH") int cc = 0; cc < 18; cc++)\r
- tsOutCopy[cc] = tsOut[cc + sb18];\r
-\r
- inv_mdct(tsOutCopy, rawout, bt);\r
-\r
- for (@LOC("SH") int cc = 0; cc < 18; cc++)\r
- tsOut[cc + sb18] = tsOutCopy[cc];\r
- // Fin Modif\r
-\r
- // overlap addition\r
- //prvblk = prevblck; //eliminated unnecessary areas\r
-\r
- tsOut[0 + sb18] = rawout[0] + prevblk[ch][sb18 + 0];\r
- prevblk[ch][sb18 + 0] = rawout[18];\r
- tsOut[1 + sb18] = rawout[1] + prevblk[ch][sb18 + 1];\r
- prevblk[ch][sb18 + 1] = rawout[19];\r
- tsOut[2 + sb18] = rawout[2] + prevblk[ch][sb18 + 2];\r
- prevblk[ch][sb18 + 2] = rawout[20];\r
- tsOut[3 + sb18] = rawout[3] + prevblk[ch][sb18 + 3];\r
- prevblk[ch][sb18 + 3] = rawout[21];\r
- tsOut[4 + sb18] = rawout[4] + prevblk[ch][sb18 + 4];\r
- prevblk[ch][sb18 + 4] = rawout[22];\r
- tsOut[5 + sb18] = rawout[5] + prevblk[ch][sb18 + 5];\r
- prevblk[ch][sb18 + 5] = rawout[23];\r
- tsOut[6 + sb18] = rawout[6] + prevblk[ch][sb18 + 6];\r
- prevblk[ch][sb18 + 6] = rawout[24];\r
- tsOut[7 + sb18] = rawout[7] + prevblk[ch][sb18 + 7];\r
- prevblk[ch][sb18 + 7] = rawout[25];\r
- tsOut[8 + sb18] = rawout[8] + prevblk[ch][sb18 + 8];\r
- prevblk[ch][sb18 + 8] = rawout[26];\r
- tsOut[9 + sb18] = rawout[9] + prevblk[ch][sb18 + 9];\r
- prevblk[ch][sb18 + 9] = rawout[27];\r
- tsOut[10 + sb18] = rawout[10] + prevblk[ch][sb18 + 10];\r
- prevblk[ch][sb18 + 10] = rawout[28];\r
- tsOut[11 + sb18] = rawout[11] + prevblk[ch][sb18 + 11];\r
- prevblk[ch][sb18 + 11] = rawout[29];\r
- tsOut[12 + sb18] = rawout[12] + prevblk[ch][sb18 + 12];\r
- prevblk[ch][sb18 + 12] = rawout[30];\r
- tsOut[13 + sb18] = rawout[13] + prevblk[ch][sb18 + 13];\r
- prevblk[ch][sb18 + 13] = rawout[31];\r
- tsOut[14 + sb18] = rawout[14] + prevblk[ch][sb18 + 14];\r
- prevblk[ch][sb18 + 14] = rawout[32];\r
- tsOut[15 + sb18] = rawout[15] + prevblk[ch][sb18 + 15];\r
- prevblk[ch][sb18 + 15] = rawout[33];\r
- tsOut[16 + sb18] = rawout[16] + prevblk[ch][sb18 + 16];\r
- prevblk[ch][sb18 + 16] = rawout[34];\r
- tsOut[17 + sb18] = rawout[17] + prevblk[ch][sb18 + 17];\r
- prevblk[ch][sb18 + 17] = rawout[35];\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
- @LATTICE("THIS<SB,THIS<SS,SB<GLOBAL,SS<GLOBAL,SS*,SB*,THISLOC=THIS,GLOBALLOC=GLOBAL")\r
- private void do_downmix() {\r
- for (@LOC("SB") int sb = 0; sb < SSLIMIT; sb++) {\r
- for (@LOC("SS") int ss = 0; ss < SSLIMIT; ss += 3) {\r
- lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;\r
- lr[0][sb][ss + 1] = (lr[0][sb][ss + 1] + lr[1][sb][ss + 1]) * 0.5f;\r
- lr[0][sb][ss + 2] = (lr[0][sb][ss + 2] + lr[1][sb][ss + 2]) * 0.5f;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Fast INV_MDCT.\r
- */\r
-@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")\r
-public void inv_mdct(@LOC("SH") float[] in, @LOC("OUT") float[] out, @LOC("IN") int block_type) {\r
- //float[] win_bt;\r
- @LOC("I") int i;\r
-\r
- @LOC("TMPF") float tmpf_0;\r
- @LOC("TMPF") float tmpf_1;\r
- @LOC("TMPF") float tmpf_2;\r
- @LOC("TMPF") float tmpf_3;\r
- @LOC("TMPF") float tmpf_4;\r
- @LOC("TMPF") float tmpf_5;\r
- @LOC("TMPF") float tmpf_6;\r
- @LOC("TMPF") float tmpf_7;\r
- @LOC("TMPF") float tmpf_8;\r
- @LOC("TMPF") float tmpf_9;\r
- @LOC("TMPF") float tmpf_10;\r
- @LOC("TMPF") float tmpf_11;\r
- @LOC("TMPF") float tmpf_12;\r
- @LOC("TMPF") float tmpf_13;\r
- @LOC("TMPF") float tmpf_14;\r
- @LOC("TMPF") float tmpf_15;\r
- @LOC("TMPF") float tmpf_16;\r
- @LOC("TMPF") float tmpf_17;\r
-\r
- tmpf_0 =\r
- tmpf_1 =\r
- tmpf_2 =\r
- tmpf_3 =\r
- tmpf_4 =\r
- tmpf_5 =\r
- tmpf_6 =\r
- tmpf_7 =\r
- tmpf_8 =\r
- tmpf_9 =\r
- tmpf_10 =\r
- tmpf_11 =\r
- tmpf_12 =\r
- tmpf_13 =\r
- tmpf_14 =\r
- tmpf_15 = tmpf_16 = tmpf_17 = 0.0f;\r
-\r
- if (block_type == 2) {\r
-\r
- /*\r
- * \r
- * Under MicrosoftVM 2922, This causes a GPF, or At best, an\r
- * ArrayIndexOutOfBoundsExceptin. for(int p=0;p<36;p+=9) { out[p] =\r
- * out[p+1] = out[p+2] = out[p+3] = out[p+4] = out[p+5] = out[p+6] =\r
- * out[p+7] = out[p+8] = 0.0f; }\r
- */\r
- out[0] = 0.0f;\r
- out[1] = 0.0f;\r
- out[2] = 0.0f;\r
- out[3] = 0.0f;\r
- out[4] = 0.0f;\r
- out[5] = 0.0f;\r
- out[6] = 0.0f;\r
- out[7] = 0.0f;\r
- out[8] = 0.0f;\r
- out[9] = 0.0f;\r
- out[10] = 0.0f;\r
- out[11] = 0.0f;\r
- out[12] = 0.0f;\r
- out[13] = 0.0f;\r
- out[14] = 0.0f;\r
- out[15] = 0.0f;\r
- out[16] = 0.0f;\r
- out[17] = 0.0f;\r
- out[18] = 0.0f;\r
- out[19] = 0.0f;\r
- out[20] = 0.0f;\r
- out[21] = 0.0f;\r
- out[22] = 0.0f;\r
- out[23] = 0.0f;\r
- out[24] = 0.0f;\r
- out[25] = 0.0f;\r
- out[26] = 0.0f;\r
- out[27] = 0.0f;\r
- out[28] = 0.0f;\r
- out[29] = 0.0f;\r
- out[30] = 0.0f;\r
- out[31] = 0.0f;\r
- out[32] = 0.0f;\r
- out[33] = 0.0f;\r
- out[34] = 0.0f;\r
- out[35] = 0.0f;\r
-\r
- @LOC("6I") int six_i = 0;\r
-\r
- for (i = 0; i < 3; i++) {\r
- // 12 point IMDCT\r
- // Begin 12 point IDCT\r
- // Input aliasing for 12 pt IDCT\r
- in[15 + i] += in[12 + i];\r
- in[12 + i] += in[9 + i];\r
- in[9 + i] += in[6 + i];\r
- in[6 + i] += in[3 + i];\r
- in[3 + i] += in[0 + i];\r
-\r
- // Input aliasing on odd indices (for 6 point IDCT)\r
- in[15 + i] += in[9 + i];\r
- in[9 + i] += in[3 + i];\r
-\r
- // 3 point IDCT on even indices\r
- @LOC("PP") float pp1;\r
- @LOC("PP") float pp2;\r
- @LOC("SUM") float sum;\r
- pp2 = in[12 + i] * 0.500000000f;\r
- pp1 = in[6 + i] * 0.866025403f;\r
- sum = in[0 + i] + pp2;\r
- tmpf_1 = in[0 + i] - in[12 + i];\r
- tmpf_0 = sum + pp1;\r
- tmpf_2 = sum - pp1;\r
-\r
- // End 3 point IDCT on even indices\r
- // 3 point IDCT on odd indices (for 6 point IDCT)\r
- pp2 = in[15 + i] * 0.500000000f;\r
- pp1 = in[9 + i] * 0.866025403f;\r
- sum = in[3 + i] + pp2;\r
- tmpf_4 = in[3 + i] - in[15 + i];\r
- tmpf_5 = sum + pp1;\r
- tmpf_3 = sum - pp1;\r
- // End 3 point IDCT on odd indices\r
- // Twiddle factors on odd indices (for 6 point IDCT)\r
-\r
- tmpf_3 *= 1.931851653f;\r
- tmpf_4 *= 0.707106781f;\r
- tmpf_5 *= 0.517638090f;\r
-\r
- // Output butterflies on 2 3 point IDCT's (for 6 point IDCT)\r
- @LOC("SH") float save = tmpf_0;\r
- tmpf_0 += tmpf_5;\r
- tmpf_5 = save - tmpf_5;\r
- save = tmpf_1;\r
- tmpf_1 += tmpf_4;\r
- tmpf_4 = save - tmpf_4;\r
- save = tmpf_2;\r
- tmpf_2 += tmpf_3;\r
- tmpf_3 = save - tmpf_3;\r
-\r
- // End 6 point IDCT\r
- // Twiddle factors on indices (for 12 point IDCT)\r
-\r
- tmpf_0 *= 0.504314480f;\r
- tmpf_1 *= 0.541196100f;\r
- tmpf_2 *= 0.630236207f;\r
- tmpf_3 *= 0.821339815f;\r
- tmpf_4 *= 1.306562965f;\r
- tmpf_5 *= 3.830648788f;\r
-\r
- // End 12 point IDCT\r
-\r
- // Shift to 12 point modified IDCT, multiply by window type 2\r
- tmpf_8 = -tmpf_0 * 0.793353340f;\r
- tmpf_9 = -tmpf_0 * 0.608761429f;\r
- tmpf_7 = -tmpf_1 * 0.923879532f;\r
- tmpf_10 = -tmpf_1 * 0.382683432f;\r
- tmpf_6 = -tmpf_2 * 0.991444861f;\r
- tmpf_11 = -tmpf_2 * 0.130526192f;\r
-\r
- tmpf_0 = tmpf_3;\r
- tmpf_1 = tmpf_4 * 0.382683432f;\r
- tmpf_2 = tmpf_5 * 0.608761429f;\r
-\r
- tmpf_3 = -tmpf_5 * 0.793353340f;\r
- tmpf_4 = -tmpf_4 * 0.923879532f;\r
- tmpf_5 = -tmpf_0 * 0.991444861f;\r
-\r
- tmpf_0 *= 0.130526192f;\r
-\r
- out[six_i + 6] += tmpf_0;\r
- out[six_i + 7] += tmpf_1;\r
- out[six_i + 8] += tmpf_2;\r
- out[six_i + 9] += tmpf_3;\r
- out[six_i + 10] += tmpf_4;\r
- out[six_i + 11] += tmpf_5;\r
- out[six_i + 12] += tmpf_6;\r
- out[six_i + 13] += tmpf_7;\r
- out[six_i + 14] += tmpf_8;\r
- out[six_i + 15] += tmpf_9;\r
- out[six_i + 16] += tmpf_10;\r
- out[six_i + 17] += tmpf_11;\r
-\r
- six_i += 6;\r
- }\r
- } else {\r
- // 36 point IDCT\r
- // input aliasing for 36 point IDCT\r
- in[17] += in[16];\r
- in[16] += in[15];\r
- in[15] += in[14];\r
- in[14] += in[13];\r
- in[13] += in[12];\r
- in[12] += in[11];\r
- in[11] += in[10];\r
- in[10] += in[9];\r
- in[9] += in[8];\r
- in[8] += in[7];\r
- in[7] += in[6];\r
- in[6] += in[5];\r
- in[5] += in[4];\r
- in[4] += in[3];\r
- in[3] += in[2];\r
- in[2] += in[1];\r
- in[1] += in[0];\r
-\r
- // 18 point IDCT for odd indices\r
- // input aliasing for 18 point IDCT\r
- in[17] += in[15];\r
- in[15] += in[13];\r
- in[13] += in[11];\r
- in[11] += in[9];\r
- in[9] += in[7];\r
- in[7] += in[5];\r
- in[5] += in[3];\r
- in[3] += in[1];\r
-\r
- @LOC("TMP") float tmp0;\r
- @LOC("TMP") float tmp1;\r
- @LOC("TMP") float tmp2;\r
- @LOC("TMP") float tmp3;\r
- @LOC("TMP") float tmp4;\r
- @LOC("TMP") float tmp0_;\r
- @LOC("TMP") float tmp1_;\r
- @LOC("TMP") float tmp2_;\r
- @LOC("TMP") float tmp3_;\r
- @LOC("TMP") float tmp0o;\r
- @LOC("TMP") float tmp1o;\r
- @LOC("TMP") float tmp2o;\r
- @LOC("TMP") float tmp3o;\r
- @LOC("TMP") float tmp4o;\r
- @LOC("TMP") float tmp0_o;\r
- @LOC("TMP") float tmp1_o;\r
- @LOC("TMP") float tmp2_o;\r
- @LOC("TMP") float tmp3_o;\r
-\r
- // Fast 9 Point Inverse Discrete Cosine Transform\r
- //\r
- // By Francois-Raymond Boyer\r
- // mailto:boyerf@iro.umontreal.ca\r
- // http://www.iro.umontreal.ca/~boyerf\r
- //\r
- // The code has been optimized for Intel processors\r
- // (takes a lot of time to convert float to and from iternal FPU\r
- // representation)\r
- //\r
- // It is a simple "factorization" of the IDCT matrix.\r
-\r
- // 9 point IDCT on even indices\r
-\r
- // 5 points on odd indices (not realy an IDCT)\r
- @LOC("I00") float i00 = in[0] + in[0];\r
- @LOC("IIP") float iip12 = i00 + in[12];\r
-\r
- tmp0 =\r
- iip12 + in[4] * 1.8793852415718f + in[8] * 1.532088886238f + in[16] * 0.34729635533386f;\r
- tmp1 = i00 + in[4] - in[8] - in[12] - in[12] - in[16];\r
- tmp2 =\r
- iip12 - in[4] * 0.34729635533386f - in[8] * 1.8793852415718f + in[16] * 1.532088886238f;\r
- tmp3 =\r
- iip12 - in[4] * 1.532088886238f + in[8] * 0.34729635533386f - in[16] * 1.8793852415718f;\r
- tmp4 = in[0] - in[4] + in[8] - in[12] + in[16];\r
-\r
- // 4 points on even indices\r
- @LOC("I00") float i66_ = in[6] * 1.732050808f; // Sqrt[3]\r
-\r
- tmp0_ =\r
- in[2] * 1.9696155060244f + i66_ + in[10] * 1.2855752193731f + in[14] * 0.68404028665134f;\r
- tmp1_ = (in[2] - in[10] - in[14]) * 1.732050808f;\r
- tmp2_ =\r
- in[2] * 1.2855752193731f - i66_ - in[10] * 0.68404028665134f + in[14] * 1.9696155060244f;\r
- tmp3_ =\r
- in[2] * 0.68404028665134f - i66_ + in[10] * 1.9696155060244f - in[14] * 1.2855752193731f;\r
-\r
- // 9 point IDCT on odd indices\r
- // 5 points on odd indices (not realy an IDCT)\r
- @LOC("I00") float i0 = in[0 + 1] + in[0 + 1];\r
- @LOC("IIP") float i0p12 = i0 + in[12 + 1];\r
-\r
- tmp0o =\r
- i0p12 + in[4 + 1] * 1.8793852415718f + in[8 + 1] * 1.532088886238f + in[16 + 1]\r
- * 0.34729635533386f;\r
- tmp1o = i0 + in[4 + 1] - in[8 + 1] - in[12 + 1] - in[12 + 1] - in[16 + 1];\r
- tmp2o =\r
- i0p12 - in[4 + 1] * 0.34729635533386f - in[8 + 1] * 1.8793852415718f + in[16 + 1]\r
- * 1.532088886238f;\r
- tmp3o =\r
- i0p12 - in[4 + 1] * 1.532088886238f + in[8 + 1] * 0.34729635533386f - in[16 + 1]\r
- * 1.8793852415718f;\r
- tmp4o = (in[0 + 1] - in[4 + 1] + in[8 + 1] - in[12 + 1] + in[16 + 1]) * 0.707106781f; // Twiddled\r
-\r
- // 4 points on even indices\r
- @LOC("I00") float i6_ = in[6 + 1] * 1.732050808f; // Sqrt[3]\r
-\r
- tmp0_o =\r
- in[2 + 1] * 1.9696155060244f + i6_ + in[10 + 1] * 1.2855752193731f + in[14 + 1]\r
- * 0.68404028665134f;\r
- tmp1_o = (in[2 + 1] - in[10 + 1] - in[14 + 1]) * 1.732050808f;\r
- tmp2_o =\r
- in[2 + 1] * 1.2855752193731f - i6_ - in[10 + 1] * 0.68404028665134f + in[14 + 1]\r
- * 1.9696155060244f;\r
- tmp3_o =\r
- in[2 + 1] * 0.68404028665134f - i6_ + in[10 + 1] * 1.9696155060244f - in[14 + 1]\r
- * 1.2855752193731f;\r
-\r
- // Twiddle factors on odd indices\r
- // and\r
- // Butterflies on 9 point IDCT's\r
- // and\r
- // twiddle factors for 36 point IDCT\r
-\r
- @LOC("EO") float e;\r
- @LOC("EO") float o;\r
- e = tmp0 + tmp0_;\r
- o = (tmp0o + tmp0_o) * 0.501909918f;\r
- tmpf_0 = e + o;\r
- tmpf_17 = e - o;\r
- e = tmp1 + tmp1_;\r
- o = (tmp1o + tmp1_o) * 0.517638090f;\r
- tmpf_1 = e + o;\r
- tmpf_16 = e - o;\r
- e = tmp2 + tmp2_;\r
- o = (tmp2o + tmp2_o) * 0.551688959f;\r
- tmpf_2 = e + o;\r
- tmpf_15 = e - o;\r
- e = tmp3 + tmp3_;\r
- o = (tmp3o + tmp3_o) * 0.610387294f;\r
- tmpf_3 = e + o;\r
- tmpf_14 = e - o;\r
- tmpf_4 = tmp4 + tmp4o;\r
- tmpf_13 = tmp4 - tmp4o;\r
- e = tmp3 - tmp3_;\r
- o = (tmp3o - tmp3_o) * 0.871723397f;\r
- tmpf_5 = e + o;\r
- tmpf_12 = e - o;\r
- e = tmp2 - tmp2_;\r
- o = (tmp2o - tmp2_o) * 1.183100792f;\r
- tmpf_6 = e + o;\r
- tmpf_11 = e - o;\r
- e = tmp1 - tmp1_;\r
- o = (tmp1o - tmp1_o) * 1.931851653f;\r
- tmpf_7 = e + o;\r
- tmpf_10 = e - o;\r
- e = tmp0 - tmp0_;\r
- o = (tmp0o - tmp0_o) * 5.736856623f;\r
- tmpf_8 = e + o;\r
- tmpf_9 = e - o;\r
-\r
- // end 36 point IDCT */\r
- // shift to modified IDCT\r
- //win_bt = win[block_type]; //substituted this so that a new area does not become created\r
-\r
- out[0] = -tmpf_9 * win[block_type][0];\r
- out[1] = -tmpf_10 * win[block_type][1];\r
- out[2] = -tmpf_11 * win[block_type][2];\r
- out[3] = -tmpf_12 * win[block_type][3];\r
- out[4] = -tmpf_13 * win[block_type][4];\r
- out[5] = -tmpf_14 * win[block_type][5];\r
- out[6] = -tmpf_15 * win[block_type][6];\r
- out[7] = -tmpf_16 * win[block_type][7];\r
- out[8] = -tmpf_17 * win[block_type][8];\r
- out[9] = tmpf_17 * win[block_type][9];\r
- out[10] = tmpf_16 * win[block_type][10];\r
- out[11] = tmpf_15 * win[block_type][11];\r
- out[12] = tmpf_14 * win[block_type][12];\r
- out[13] = tmpf_13 * win[block_type][13];\r
- out[14] = tmpf_12 * win[block_type][14];\r
- out[15] = tmpf_11 * win[block_type][15];\r
- out[16] = tmpf_10 * win[block_type][16];\r
- out[17] = tmpf_9 * win[block_type][17];\r
- out[18] = tmpf_8 * win[block_type][18];\r
- out[19] = tmpf_7 * win[block_type][19];\r
- out[20] = tmpf_6 * win[block_type][20];\r
- out[21] = tmpf_5 * win[block_type][21];\r
- out[22] = tmpf_4 * win[block_type][22];\r
- out[23] = tmpf_3 * win[block_type][23];\r
- out[24] = tmpf_2 * win[block_type][24];\r
- out[25] = tmpf_1 * win[block_type][25];\r
- out[26] = tmpf_0 * win[block_type][26];\r
- out[27] = tmpf_0 * win[block_type][27];\r
- out[28] = tmpf_1 * win[block_type][28];\r
- out[29] = tmpf_2 * win[block_type][29];\r
- out[30] = tmpf_3 * win[block_type][30];\r
- out[31] = tmpf_4 * win[block_type][31];\r
- out[32] = tmpf_5 * win[block_type][32];\r
- out[33] = tmpf_6 * win[block_type][33];\r
- out[34] = tmpf_7 * win[block_type][34];\r
- out[35] = tmpf_8 * win[block_type][35];\r
- }\r
- }\r
-\r
- @LOC("C") private int counter = 0;\r
- @LOC("F") private static final int SSLIMIT = 18;\r
- @LOC("F") private static final int SBLIMIT = 32;\r
-\r
- // Size of the table of whole numbers raised to 4/3 power.\r
- // This may be adjusted for performance without any problems.\r
- // public static final int POW_TABLE_LIMIT=512;\r
-\r
- /************************************************************/\r
- /* L3TABLE */\r
- /************************************************************/\r
-\r
- static class SBI {\r
- public int[] l;\r
- public int[] s;\r
-\r
- public SBI() {\r
- l = new int[23];\r
- s = new int[14];\r
- }\r
-\r
- public SBI(int[] thel, int[] thes) {\r
- l = thel;\r
- s = thes;\r
- }\r
- }\r
-\r
- static class gr_info_s {\r
- public int part2_3_length = 0;\r
- public int big_values = 0;\r
- public int global_gain = 0;\r
- public int scalefac_compress = 0;\r
- public int window_switching_flag = 0;\r
- public int block_type = 0;\r
- public int mixed_block_flag = 0;\r
- public int[] table_select;\r
- public int[] subblock_gain;\r
- public int region0_count = 0;\r
- public int region1_count = 0;\r
- public int preflag = 0;\r
- public int scalefac_scale = 0;\r
- public int count1table_select = 0;\r
-\r
- /**\r
- * Dummy Constructor\r
- */\r
- public gr_info_s() {\r
- table_select = new int[3];\r
- subblock_gain = new int[3];\r
- }\r
- }\r
-\r
- static class temporaire {\r
- public int[] scfsi;\r
- public gr_info_s[] gr;\r
-\r
- /**\r
- * Dummy Constructor\r
- */\r
- public temporaire() {\r
- scfsi = new int[4];\r
- gr = new gr_info_s[2];\r
- gr[0] = new gr_info_s();\r
- gr[1] = new gr_info_s();\r
- }\r
- }\r
-\r
- static class III_side_info_t {\r
-\r
- public int main_data_begin = 0;\r
- public int private_bits = 0;\r
- public temporaire[] ch;\r
-\r
- /**\r
- * Dummy Constructor\r
- */\r
- public III_side_info_t() {\r
- ch = new temporaire[2];\r
- ch[0] = new temporaire();\r
- ch[1] = new temporaire();\r
- }\r
- }\r
-\r
- static class temporaire2 {\r
- public int[] l; /* [cb] */\r
- public int[][] s; /* [window][cb] */\r
-\r
- /**\r
- * Dummy Constructor\r
- */\r
- public temporaire2() {\r
- l = new int[23];\r
- s = new int[3][13];\r
- }\r
- }\r
-\r
- // class III_scalefac_t\r
- // {\r
- // public temporaire2[] tab;\r
- // /**\r
- // * Dummy Constructor\r
- // */\r
- // public III_scalefac_t()\r
- // {\r
- // tab = new temporaire2[2];\r
- // }\r
- // }\r
-\r
- @LOC("F") private static final int slen[][] = { { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },\r
- { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 } };\r
-\r
- @LOC("F") 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,\r
- 2, 0 };\r
-\r
- @LOC("F") private SBI[] sfBandIndex; // Init in the constructor.\r
-\r
- @LOC("F") public static final float two_to_negative_half_pow[] = { 1.0000000000E+00f, 7.0710678119E-01f,\r
- 5.0000000000E-01f, 3.5355339059E-01f, 2.5000000000E-01f, 1.7677669530E-01f,\r
- 1.2500000000E-01f, 8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f,\r
- 3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f, 1.1048543456E-02f,\r
- 7.8125000000E-03f, 5.5242717280E-03f, 3.9062500000E-03f, 2.7621358640E-03f,\r
- 1.9531250000E-03f, 1.3810679320E-03f, 9.7656250000E-04f, 6.9053396600E-04f,\r
- 4.8828125000E-04f, 3.4526698300E-04f, 2.4414062500E-04f, 1.7263349150E-04f,\r
- 1.2207031250E-04f, 8.6316745750E-05f, 6.1035156250E-05f, 4.3158372875E-05f,\r
- 3.0517578125E-05f, 2.1579186438E-05f, 1.5258789062E-05f, 1.0789593219E-05f,\r
- 7.6293945312E-06f, 5.3947966094E-06f, 3.8146972656E-06f, 2.6973983047E-06f,\r
- 1.9073486328E-06f, 1.3486991523E-06f, 9.5367431641E-07f, 6.7434957617E-07f,\r
- 4.7683715820E-07f, 3.3717478809E-07f, 2.3841857910E-07f, 1.6858739404E-07f,\r
- 1.1920928955E-07f, 8.4293697022E-08f, 5.9604644775E-08f, 4.2146848511E-08f,\r
- 2.9802322388E-08f, 2.1073424255E-08f, 1.4901161194E-08f, 1.0536712128E-08f,\r
- 7.4505805969E-09f, 5.2683560639E-09f, 3.7252902985E-09f, 2.6341780319E-09f,\r
- 1.8626451492E-09f, 1.3170890160E-09f, 9.3132257462E-10f, 6.5854450798E-10f,\r
- 4.6566128731E-10f, 3.2927225399E-10f };\r
-\r
- @LOC("F") public static final float t_43[] = create_t_43();\r
-\r
- @RETURNLOC("OUT")\r
- static private float[] create_t_43() {\r
- @LOC("OUT") float[] t43 = new float[8192];\r
- final double d43 = (4.0 / 3.0);\r
-\r
- for (@LOC("SH") int i = 0; i < 8192; i++) {\r
- t43[i] = (float) Math.pow(i, d43);\r
- }\r
- return t43;\r
- }\r
-\r
- @LOC("F") public static final float io[][] = {\r
- { 1.0000000000E+00f, 8.4089641526E-01f, 7.0710678119E-01f, 5.9460355751E-01f,\r
- 5.0000000001E-01f, 4.2044820763E-01f, 3.5355339060E-01f, 2.9730177876E-01f,\r
- 2.5000000001E-01f, 2.1022410382E-01f, 1.7677669530E-01f, 1.4865088938E-01f,\r
- 1.2500000000E-01f, 1.0511205191E-01f, 8.8388347652E-02f, 7.4325444691E-02f,\r
- 6.2500000003E-02f, 5.2556025956E-02f, 4.4194173826E-02f, 3.7162722346E-02f,\r
- 3.1250000002E-02f, 2.6278012978E-02f, 2.2097086913E-02f, 1.8581361173E-02f,\r
- 1.5625000001E-02f, 1.3139006489E-02f, 1.1048543457E-02f, 9.2906805866E-03f,\r
- 7.8125000006E-03f, 6.5695032447E-03f, 5.5242717285E-03f, 4.6453402934E-03f },\r
- { 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f, 3.5355339060E-01f,\r
- 2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f, 8.8388347650E-02f,\r
- 6.2500000001E-02f, 4.4194173825E-02f, 3.1250000001E-02f, 2.2097086913E-02f,\r
- 1.5625000000E-02f, 1.1048543456E-02f, 7.8125000002E-03f, 5.5242717282E-03f,\r
- 3.9062500001E-03f, 2.7621358641E-03f, 1.9531250001E-03f, 1.3810679321E-03f,\r
- 9.7656250004E-04f, 6.9053396603E-04f, 4.8828125002E-04f, 3.4526698302E-04f,\r
- 2.4414062501E-04f, 1.7263349151E-04f, 1.2207031251E-04f, 8.6316745755E-05f,\r
- 6.1035156254E-05f, 4.3158372878E-05f, 3.0517578127E-05f, 2.1579186439E-05f } };\r
-\r
- @LOC("F") public static final float TAN12[] = { 0.0f, 0.26794919f, 0.57735027f, 1.0f, 1.73205081f,\r
- 3.73205081f, 9.9999999e10f, -3.73205081f, -1.73205081f, -1.0f, -0.57735027f, -0.26794919f,\r
- 0.0f, 0.26794919f, 0.57735027f, 1.0f };\r
-\r
- // REVIEW: in java, the array lookup may well be slower than\r
- // the actual calculation\r
- // 576 / 18\r
- /*\r
- * private static final int ss_div[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- * 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,\r
- * 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,\r
- * 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,\r
- * 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,\r
- * 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,\r
- * 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,\r
- * 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,\r
- * 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,\r
- * 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,\r
- * 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,\r
- * 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
- * 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,\r
- * 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,\r
- * 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,\r
- * 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,\r
- * 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,\r
- * 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\r
- * 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,\r
- * 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,\r
- * 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,\r
- * 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25,\r
- * 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26,\r
- * 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27,\r
- * 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28,\r
- * 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29,\r
- * 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30,\r
- * 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31,\r
- * 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 };\r
- * \r
- * // 576 % 18 private static final int ss_mod[] = { 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,\r
- * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,\r
- * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,\r
- * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,\r
- * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,\r
- * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,\r
- * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r
- * 12, 13, 14, 15, 16, 17 };\r
- */\r
- @LOC("F") private static/* final */int reorder_table[][]/* = loadReorderTable() */; // SZD:\r
- // will\r
- // be\r
- // generated\r
- // on\r
- // demand\r
-\r
- /**\r
- * Loads the data for the reorder\r
- */\r
- /*\r
- * private static int[][] loadReorderTable() // SZD: table will be generated {\r
- * try { Class elemType = int[][].class.getComponentType(); Object o =\r
- * JavaLayerUtils.deserializeArrayResource("l3reorder.ser", elemType, 6);\r
- * return (int[][])o; } catch (IOException ex) { throw new\r
- * ExceptionInInitializerError(ex); } }\r
- */\r
- @LATTICE("OUT<J,J<I,I<SE,I<WIN,SE<SF,SE<SFB,WIN<SFB,J*,I*,WIN*,SFB*")\r
- static int[] reorder(@LOC("SF") int scalefac_band[]) { // SZD: converted from LAME\r
- @LOC("J") int j = 0;\r
- @LOC("OUT") int ix[] = new int[576];\r
- for (int sfb = 0; sfb < 13; sfb++) {\r
- int start = scalefac_band[sfb];\r
- int end = scalefac_band[sfb + 1];\r
- for (int window = 0; window < 3; window++)\r
- for (int i = start; i < end; i++)\r
- ix[3 * i + window] = j++;\r
- }\r
- return ix;\r
- }\r
-\r
- /*\r
- * static final int reorder_table_data[][]; = { { 0, 4, 8, 1, 5, 9, 2, 6, 10,\r
- * 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25,\r
- * 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49, 38, 44, 50, 39, 45,\r
- * 51, 40, 46, 52, 41, 47, 53, 54, 60, 66, 55, 61, 67, 56, 62, 68, 57, 63, 69,\r
- * 58, 64, 70, 59, 65, 71, 72, 80, 88, 73, 81, 89, 74, 82, 90, 75, 83, 91, 76,\r
- * 84, 92, 77, 85, 93, 78, 86, 94, 79, 87, 95, 96,106,116, 97,107,117,\r
- * 98,108,118, 99,109,119,100,110,120,101,\r
- * 111,121,102,112,122,103,113,123,104,114,124,105,115,125,126,140,\r
- * 154,127,141,155,128,142,156,129,143,157,130,144,158,131,145,159,\r
- * 132,146,160,133,147,161,134,148,162,135,149,163,136,150,164,137,\r
- * 151,165,138,152,166,139,153,167,168,186,204,169,187,205,170,188,\r
- * 206,171,189,207,172,190,208,173,191,209,174,192,210,175,193,211,\r
- * 176,194,212,177,195,213,178,196,214,179,197,215,180,198,216,181,\r
- * 199,217,182,200,218,183,201,219,184,202,220,185,203,221,222,248,\r
- * 274,223,249,275,224,250,276,225,251,277,226,252,278,227,253,279,\r
- * 228,254,280,229,255,281,230,256,282,231,257,283,232,258,284,233,\r
- * 259,285,234,260,286,235,261,287,236,262,288,237,263,289,238,264,\r
- * 290,239,265,291,240,266,292,241,267,293,242,268,294,243,269,295,\r
- * 244,270,296,245,271,297,246,272,298,247,273,299,300,332,364,301,\r
- * 333,365,302,334,366,303,335,367,304,336,368,305,337,369,306,338,\r
- * 370,307,339,371,308,340,372,309,341,373,310,342,374,311,343,375,\r
- * 312,344,376,313,345,377,314,346,378,315,347,379,316,348,380,317,\r
- * 349,381,318,350,382,319,351,383,320,352,384,321,353,385,322,354,\r
- * 386,323,355,387,324,356,388,325,357,389,326,358,390,327,359,391,\r
- * 328,360,392,329,361,393,330,362,394,331,363,395,396,438,480,397,\r
- * 439,481,398,440,482,399,441,483,400,442,484,401,443,485,402,444,\r
- * 486,403,445,487,404,446,488,405,447,489,406,448,490,407,449,491,\r
- * 408,450,492,409,451,493,410,452,494,411,453,495,412,454,496,413,\r
- * 455,497,414,456,498,415,457,499,416,458,500,417,459,501,418,460,\r
- * 502,419,461,503,420,462,504,421,463,505,422,464,506,423,465,507,\r
- * 424,466,508,425,467,509,426,468,510,427,469,511,428,470,512,429,\r
- * 471,513,430,472,514,431,473,515,432,474,516,433,475,517,434,476,\r
- * 518,435,477,519,436,478,520,437,479,521,522,540,558,523,541,559,\r
- * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,\r
- * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,\r
- * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,\r
- * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,\r
- * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,\r
- * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,\r
- * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,\r
- * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,\r
- * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,\r
- * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,\r
- * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,\r
- * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,\r
- * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,\r
- * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,\r
- * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,\r
- * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,\r
- * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,\r
- * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,\r
- * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,\r
- * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,\r
- * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,\r
- * 285,309,262,286,310,263,287,311,312,344,376,313,345,377,314,346,\r
- * 378,315,347,379,316,348,380,317,349,381,318,350,382,319,351,383,\r
- * 320,352,384,321,353,385,322,354,386,323,355,387,324,356,388,325,\r
- * 357,389,326,358,390,327,359,391,328,360,392,329,361,393,330,362,\r
- * 394,331,363,395,332,364,396,333,365,397,334,366,398,335,367,399,\r
- * 336,368,400,337,369,401,338,370,402,339,371,403,340,372,404,341,\r
- * 373,405,342,374,406,343,375,407,408,452,496,409,453,497,410,454,\r
- * 498,411,455,499,412,456,500,413,457,501,414,458,502,415,459,503,\r
- * 416,460,504,417,461,505,418,462,506,419,463,507,420,464,508,421,\r
- * 465,509,422,466,510,423,467,511,424,468,512,425,469,513,426,470,\r
- * 514,427,471,515,428,472,516,429,473,517,430,474,518,431,475,519,\r
- * 432,476,520,433,477,521,434,478,522,435,479,523,436,480,524,437,\r
- * 481,525,438,482,526,439,483,527,440,484,528,441,485,529,442,486,\r
- * 530,443,487,531,444,488,532,445,489,533,446,490,534,447,491,535,\r
- * 448,492,536,449,493,537,450,494,538,451,495,539,540,552,564,541,\r
- * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,\r
- * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575}, { 0, 4,\r
- * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,\r
- * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,\r
- * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,\r
- * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,\r
- * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,\r
- * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,\r
- * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,\r
- * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,\r
- * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,\r
- * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,\r
- * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,\r
- * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,\r
- * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,\r
- * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,\r
- * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,\r
- * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,\r
- * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,\r
- * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,\r
- * 285,309,262,286,310,263,287,311,312,342,372,313,343,373,314,344,\r
- * 374,315,345,375,316,346,376,317,347,377,318,348,378,319,349,379,\r
- * 320,350,380,321,351,381,322,352,382,323,353,383,324,354,384,325,\r
- * 355,385,326,356,386,327,357,387,328,358,388,329,359,389,330,360,\r
- * 390,331,361,391,332,362,392,333,363,393,334,364,394,335,365,395,\r
- * 336,366,396,337,367,397,338,368,398,339,369,399,340,370,400,341,\r
- * 371,401,402,442,482,403,443,483,404,444,484,405,445,485,406,446,\r
- * 486,407,447,487,408,448,488,409,449,489,410,450,490,411,451,491,\r
- * 412,452,492,413,453,493,414,454,494,415,455,495,416,456,496,417,\r
- * 457,497,418,458,498,419,459,499,420,460,500,421,461,501,422,462,\r
- * 502,423,463,503,424,464,504,425,465,505,426,466,506,427,467,507,\r
- * 428,468,508,429,469,509,430,470,510,431,471,511,432,472,512,433,\r
- * 473,513,434,474,514,435,475,515,436,476,516,437,477,517,438,478,\r
- * 518,439,479,519,440,480,520,441,481,521,522,540,558,523,541,559,\r
- * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,\r
- * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,\r
- * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,\r
- * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,\r
- * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,\r
- * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,\r
- * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,\r
- * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,100,110, 91,101,111, 92,102,112,\r
- * 93,103,113, 94,104,114, 95,105,115, 96,106,116, 97, 107,117, 98,108,118,\r
- * 99,109,119,120,132,144,121,133,145,122,134,\r
- * 146,123,135,147,124,136,148,125,137,149,126,138,150,127,139,151,\r
- * 128,140,152,129,141,153,130,142,154,131,143,155,156,170,184,157,\r
- * 171,185,158,172,186,159,173,187,160,174,188,161,175,189,162,176,\r
- * 190,163,177,191,164,178,192,165,179,193,166,180,194,167,181,195,\r
- * 168,182,196,169,183,197,198,216,234,199,217,235,200,218,236,201,\r
- * 219,237,202,220,238,203,221,239,204,222,240,205,223,241,206,224,\r
- * 242,207,225,243,208,226,244,209,227,245,210,228,246,211,229,247,\r
- * 212,230,248,213,231,249,214,232,250,215,233,251,252,274,296,253,\r
- * 275,297,254,276,298,255,277,299,256,278,300,257,279,301,258,280,\r
- * 302,259,281,303,260,282,304,261,283,305,262,284,306,263,285,307,\r
- * 264,286,308,265,287,309,266,288,310,267,289,311,268,290,312,269,\r
- * 291,313,270,292,314,271,293,315,272,294,316,273,295,317,318,348,\r
- * 378,319,349,379,320,350,380,321,351,381,322,352,382,323,353,383,\r
- * 324,354,384,325,355,385,326,356,386,327,357,387,328,358,388,329,\r
- * 359,389,330,360,390,331,361,391,332,362,392,333,363,393,334,364,\r
- * 394,335,365,395,336,366,396,337,367,397,338,368,398,339,369,399,\r
- * 340,370,400,341,371,401,342,372,402,343,373,403,344,374,404,345,\r
- * 375,405,346,376,406,347,377,407,408,464,520,409,465,521,410,466,\r
- * 522,411,467,523,412,468,524,413,469,525,414,470,526,415,471,527,\r
- * 416,472,528,417,473,529,418,474,530,419,475,531,420,476,532,421,\r
- * 477,533,422,478,534,423,479,535,424,480,536,425,481,537,426,482,\r
- * 538,427,483,539,428,484,540,429,485,541,430,486,542,431,487,543,\r
- * 432,488,544,433,489,545,434,490,546,435,491,547,436,492,548,437,\r
- * 493,549,438,494,550,439,495,551,440,496,552,441,497,553,442,498,\r
- * 554,443,499,555,444,500,556,445,501,557,446,502,558,447,503,559,\r
- * 448,504,560,449,505,561,450,506,562,451,507,563,452,508,564,453,\r
- * 509,565,454,510,566,455,511,567,456,512,568,457,513,569,458,514,\r
- * 570,459,515,571,460,516,572,461,517,573,462,518,574,463,519,575}, { 0, 4,\r
- * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,\r
- * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,\r
- * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,\r
- * 58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69, 75, 81, 70, 76,\r
- * 82, 71, 77, 83, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107, 88, 98,108,\r
- * 89, 99,109, 90,100,110, 91,101,111, 92,102,112, 93,\r
- * 103,113,114,126,138,115,127,139,116,128,140,117,129,141,118,130,\r
- * 142,119,131,143,120,132,144,121,133,145,122,134,146,123,135,147,\r
- * 124,136,148,125,137,149,150,164,178,151,165,179,152,166,180,153,\r
- * 167,181,154,168,182,155,169,183,156,170,184,157,171,185,158,172,\r
- * 186,159,173,187,160,174,188,161,175,189,162,176,190,163,177,191,\r
- * 192,208,224,193,209,225,194,210,226,195,211,227,196,212,228,197,\r
- * 213,229,198,214,230,199,215,231,200,216,232,201,217,233,202,218,\r
- * 234,203,219,235,204,220,236,205,221,237,206,222,238,207,223,239,\r
- * 240,260,280,241,261,281,242,262,282,243,263,283,244,264,284,245,\r
- * 265,285,246,266,286,247,267,287,248,268,288,249,269,289,250,270,\r
- * 290,251,271,291,252,272,292,253,273,293,254,274,294,255,275,295,\r
- * 256,276,296,257,277,297,258,278,298,259,279,299,300,326,352,301,\r
- * 327,353,302,328,354,303,329,355,304,330,356,305,331,357,306,332,\r
- * 358,307,333,359,308,334,360,309,335,361,310,336,362,311,337,363,\r
- * 312,338,364,313,339,365,314,340,366,315,341,367,316,342,368,317,\r
- * 343,369,318,344,370,319,345,371,320,346,372,321,347,373,322,348,\r
- * 374,323,349,375,324,350,376,325,351,377,378,444,510,379,445,511,\r
- * 380,446,512,381,447,513,382,448,514,383,449,515,384,450,516,385,\r
- * 451,517,386,452,518,387,453,519,388,454,520,389,455,521,390,456,\r
- * 522,391,457,523,392,458,524,393,459,525,394,460,526,395,461,527,\r
- * 396,462,528,397,463,529,398,464,530,399,465,531,400,466,532,401,\r
- * 467,533,402,468,534,403,469,535,404,470,536,405,471,537,406,472,\r
- * 538,407,473,539,408,474,540,409,475,541,410,476,542,411,477,543,\r
- * 412,478,544,413,479,545,414,480,546,415,481,547,416,482,548,417,\r
- * 483,549,418,484,550,419,485,551,420,486,552,421,487,553,422,488,\r
- * 554,423,489,555,424,490,556,425,491,557,426,492,558,427,493,559,\r
- * 428,494,560,429,495,561,430,496,562,431,497,563,432,498,564,433,\r
- * 499,565,434,500,566,435,501,567,436,502,568,437,503,569,438,504,\r
- * 570,439,505,571,440,506,572,441,507,573,442,508,574,443,509,575}, { 0, 4,\r
- * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,\r
- * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,\r
- * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,\r
- * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,\r
- * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,102,114, 91,103,115, 92,104,116,\r
- * 93,105,117, 94,106,118, 95,107,119, 96,108,120, 97, 109,121, 98,110,122,\r
- * 99,111,123,100,112,124,101,113,125,126,142,\r
- * 158,127,143,159,128,144,160,129,145,161,130,146,162,131,147,163,\r
- * 132,148,164,133,149,165,134,150,166,135,151,167,136,152,168,137,\r
- * 153,169,138,154,170,139,155,171,140,156,172,141,157,173,174,194,\r
- * 214,175,195,215,176,196,216,177,197,217,178,198,218,179,199,219,\r
- * 180,200,220,181,201,221,182,202,222,183,203,223,184,204,224,185,\r
- * 205,225,186,206,226,187,207,227,188,208,228,189,209,229,190,210,\r
- * 230,191,211,231,192,212,232,193,213,233,234,260,286,235,261,287,\r
- * 236,262,288,237,263,289,238,264,290,239,265,291,240,266,292,241,\r
- * 267,293,242,268,294,243,269,295,244,270,296,245,271,297,246,272,\r
- * 298,247,273,299,248,274,300,249,275,301,250,276,302,251,277,303,\r
- * 252,278,304,253,279,305,254,280,306,255,281,307,256,282,308,257,\r
- * 283,309,258,284,310,259,285,311,312,346,380,313,347,381,314,348,\r
- * 382,315,349,383,316,350,384,317,351,385,318,352,386,319,353,387,\r
- * 320,354,388,321,355,389,322,356,390,323,357,391,324,358,392,325,\r
- * 359,393,326,360,394,327,361,395,328,362,396,329,363,397,330,364,\r
- * 398,331,365,399,332,366,400,333,367,401,334,368,402,335,369,403,\r
- * 336,370,404,337,371,405,338,372,406,339,373,407,340,374,408,341,\r
- * 375,409,342,376,410,343,377,411,344,378,412,345,379,413,414,456,\r
- * 498,415,457,499,416,458,500,417,459,501,418,460,502,419,461,503,\r
- * 420,462,504,421,463,505,422,464,506,423,465,507,424,466,508,425,\r
- * 467,509,426,468,510,427,469,511,428,470,512,429,471,513,430,472,\r
- * 514,431,473,515,432,474,516,433,475,517,434,476,518,435,477,519,\r
- * 436,478,520,437,479,521,438,480,522,439,481,523,440,482,524,441,\r
- * 483,525,442,484,526,443,485,527,444,486,528,445,487,529,446,488,\r
- * 530,447,489,531,448,490,532,449,491,533,450,492,534,451,493,535,\r
- * 452,494,536,453,495,537,454,496,538,455,497,539,540,552,564,541,\r
- * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,\r
- * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575} };\r
- */\r
-\r
- @LOC("F") private static final float cs[] = { 0.857492925712f, 0.881741997318f, 0.949628649103f,\r
- 0.983314592492f, 0.995517816065f, 0.999160558175f, 0.999899195243f, 0.999993155067f };\r
-\r
- @LOC("F") private static final float ca[] = { -0.5144957554270f, -0.4717319685650f, -0.3133774542040f,\r
- -0.1819131996110f, -0.0945741925262f, -0.0409655828852f, -0.0141985685725f,\r
- -0.00369997467375f };\r
-\r
- /************************************************************/\r
- /* END OF L3TABLE */\r
- /************************************************************/\r
-\r
- /************************************************************/\r
- /* L3TYPE */\r
- /************************************************************/\r
-\r
- /***************************************************************/\r
- /* END OF L3TYPE */\r
- /***************************************************************/\r
-\r
- /***************************************************************/\r
- /* INV_MDCT */\r
- /***************************************************************/\r
- @LOC("F") public static final float win[][] = {\r
- { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,\r
- -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,\r
- -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,\r
- -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,\r
- -4.0715656898E-01f, -3.6969460527E-01f, -3.3876269197E-01f, -3.1242222492E-01f,\r
- -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,\r
- -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,\r
- -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,\r
- -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f },\r
-\r
- { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,\r
- -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,\r
- -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,\r
- -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,\r
- -4.0715656898E-01f, -3.6969460527E-01f, -3.3908542600E-01f, -3.1511810350E-01f,\r
- -2.9642226150E-01f, -2.8184548650E-01f, -5.4119610000E-01f, -2.6213228100E-01f,\r
- -2.5387916537E-01f, -2.3296291359E-01f, -1.9852728987E-01f, -1.5233534808E-01f,\r
- -9.6496400054E-02f, -3.3423828516E-02f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },\r
-\r
- { -4.8300800645E-02f, -1.5715656932E-01f, -2.8325045177E-01f, -4.2953747763E-01f,\r
- -1.2071067795E+00f, -8.2426483178E-01f, -1.1451749106E+00f, -1.7695290101E+00f,\r
- -4.5470225061E+00f, -3.4890531002E+00f, -7.3296292804E-01f, -1.5076514758E-01f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },\r
-\r
- { 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,\r
- 0.0000000000E+00f, 0.0000000000E+00f, -1.5076513660E-01f, -7.3296291107E-01f,\r
- -3.4890530566E+00f, -4.5470224727E+00f, -1.7695290031E+00f, -1.1451749092E+00f,\r
- -8.3137738100E-01f, -1.3065629650E+00f, -5.4142014250E-01f, -4.6528974900E-01f,\r
- -4.1066990750E-01f, -3.7004680800E-01f, -3.3876269197E-01f, -3.1242222492E-01f,\r
- -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,\r
- -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,\r
- -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,\r
- -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f } };\r
-\r
- /***************************************************************/\r
- /* END OF INV_MDCT */\r
- /***************************************************************/\r
-\r
- class Sftable {\r
- public int[] l;\r
- public int[] s;\r
-\r
- public Sftable() {\r
- l = new int[5];\r
- s = new int[3];\r
- }\r
-\r
- public Sftable(int[] thel, int[] thes) {\r
- l = thel;\r
- s = thes;\r
- }\r
- }\r
-\r
- @LOC("F") public Sftable sftable;\r
-\r
- @LOC("F") public static final int nr_of_sfb_block[][][] = {\r
- { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },\r
- { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },\r
- { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },\r
- { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } },\r
- { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } },\r
- { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } };\r
-\r
-}\r
-\r
+ * 16/07/01 Michael Scheerer, Catched a bug in method
+ * huffmann_decode, which causes an outOfIndexException.
+ * Cause : Indexnumber of 24 at SfBandIndex,
+ * which has only a length of 22. I have simply and dirty
+ * fixed the index to <= 22, because I'm not really be able
+ * to fix the bug. The Indexnumber is taken from the MP3
+ * file and the origin Ma-Player with the same code works
+ * well.
+ *
+ * 02/19/99 Java Conversion by E.B, javalayer@javazoom.net
+ *-----------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *----------------------------------------------------------------------
+ */
+
+
+/**
+ * Class Implementing Layer 3 Decoder.
+ *
+ * @since 0.0
+ */
+@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<WCH,SF<SFT,SFT<NS,NS<C,TS<RAW,O<TS,LY<F,NZ<VAR,C*,FS*,SI*,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*")
+//4th line added for hybrid.
+//5th added for stereo
+//6th added for reorder method
+//7th added for huffman_decode method
+//8th added for get_LSF_scale_data
+//9th added for get_LSF_scale_factors
+//10th added for get_scale_factors
+//llth added for decode
+@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN")
+final class LayerIIIDecoder implements FrameDecoder {
+ @LOC("F") final double d43 = (4.0 / 3.0);
+ @LOC("SFT") public int[] scalefac_buffer;
+
+ // MDM: removed, as this wasn't being used.
+ // private float CheckSumOut1d = 0.0f;
+ @LOC("CSH") private int CheckSumHuff = 0;
+ @LOC("VAR") private int[] is_1d;
+ @LOC("VAR") private float[][][] ro;
+ @LOC("LR") private float[][][] lr;
+ @LOC("O") private float[] out_1d; // 576 samples
+ @LOC("VAR") private float[][] prevblck;
+ @LOC("K") private float[][] k;
+ @LOC("NZ") private int[] nonzero;
+ @LOC("F")private Bitstream stream;
+ @LOC("H") private Header header;
+ @LOC("F") private SynthesisFilter filter1;
+ @LOC("F") private SynthesisFilter filter2;
+ @LOC("F") private Obuffer buffer; // output buffer
+ @LOC("WC") private int which_channels;
+ @LOC("BR") private BitReserve br;
+ @LOC("SI") private III_side_info_t si;
+
+ @LOC("SBT") private temporaire2[] III_scalefac_t;
+ @LOC("SF") private temporaire2[] scalefac;
+ // private III_scalefac_t scalefac;
+
+ @LOC("MAX") private int max_gr;
+ @LOC("FS") private int frame_start;
+ @LOC("F") private int part2_start;
+ @LOC("CH") private int channels;
+ @LOC("FLCH") private int first_channel;
+ @LOC("FLCH") private int last_channel;
+ @LOC("SFREQ") private int sfreq;
+
+ /**
+ * Constructor.
+ */
+ // REVIEW: these constructor arguments should be moved to the
+ // decodeFrame() method, where possible, so that one
+ @LATTICE("THIS<VAR,THIS<I,THIS<J,J<CH,I*,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
+ public LayerIIIDecoder(@LOC("VAR") Bitstream stream0, @LOC("VAR") Header header0, @LOC("VAR") SynthesisFilter filtera,
+ SynthesisFilter @LOC("VAR") filterb, @LOC("VAR") Obuffer buffer0, @LOC("VAR") int which_ch0) {
+ huffcodetab.inithuff();
+ is_1d = new int[SBLIMIT * SSLIMIT + 4];
+ ro = new float[2][SBLIMIT][SSLIMIT];
+ lr = new float[2][SBLIMIT][SSLIMIT];
+ out_1d = new float[SBLIMIT * SSLIMIT];
+ prevblck = new float[2][SBLIMIT * SSLIMIT];
+ k = new float[2][SBLIMIT * SSLIMIT];
+ nonzero = new int[2];
+
+ // III_scalefact_t
+ III_scalefac_t = new temporaire2[2];
+ III_scalefac_t[0] = new temporaire2();
+ III_scalefac_t[1] = new temporaire2();
+ scalefac = III_scalefac_t;
+ // L3TABLE INIT
+
+ sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
+ @LOC("VAR") int[] l0 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ @LOC("VAR") int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };
+ @LOC("VAR") int[] l1 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394,
+ 464, 540, 576 };
+ @LOC("VAR") int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };
+ @LOC("VAR") int[] l2 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ @LOC("VAR") int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+
+ @LOC("VAR") int[] l3 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342,
+ 418, 576 };
+ @LOC("VAR") int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };
+ @LOC("VAR") int[] l4 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330,
+ 384, 576 };
+ @LOC("VAR") int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };
+ @LOC("VAR") int[] l5 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448,
+ 550, 576 };
+ @LOC("VAR") int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };
+ // SZD: MPEG2.5
+ @LOC("VAR") int[] l6 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ @LOC("VAR") int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ @LOC("VAR") int[] l7 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ @LOC("VAR") int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ @LOC("VAR") int[] l8 =
+ { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568,
+ 570, 572, 574, 576 };
+ @LOC("VAR") int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 };
+
+ sfBandIndex[0] = new SBI(l0, s0);
+ sfBandIndex[1] = new SBI(l1, s1);
+ sfBandIndex[2] = new SBI(l2, s2);
+
+ sfBandIndex[3] = new SBI(l3, s3);
+ sfBandIndex[4] = new SBI(l4, s4);
+ sfBandIndex[5] = new SBI(l5, s5);
+ // SZD: MPEG2.5
+ sfBandIndex[6] = new SBI(l6, s6);
+ sfBandIndex[7] = new SBI(l7, s7);
+ sfBandIndex[8] = new SBI(l8, s8);
+ // END OF L3TABLE INIT
+
+ if (reorder_table == null) { // SZD: generate LUT
+ reorder_table = new int[9][];
+ for (@LOC("I") int i = 0; i < 9; i++)
+ reorder_table[i] = reorder(sfBandIndex[i].s);
+ }
+
+ // Sftable
+ @LOC("VAR") int[] ll0 = { 0, 6, 11, 16, 21 };
+ @LOC("VAR") int[] ss0 = { 0, 6, 12 };
+ sftable = new Sftable(ll0, ss0);
+ // END OF Sftable
+
+ // scalefac_buffer
+ scalefac_buffer = new int[54];
+ // END OF scalefac_buffer
+
+ stream = stream0;
+ header = header0;
+ filter1 = filtera;
+ filter2 = filterb;
+ buffer = buffer0;
+ which_channels = which_ch0;
+
+ frame_start = 0;
+ channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
+ max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
+
+ sfreq =
+ header.sample_frequency()
+ + ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6
+ : 0); // SZD
+
+ if (channels == 2) {
+ switch (which_channels) {
+ case OutputChannels.LEFT_CHANNEL:
+ case OutputChannels.DOWNMIX_CHANNELS:
+ first_channel = last_channel = 0;
+ break;
+
+ case OutputChannels.RIGHT_CHANNEL:
+ first_channel = last_channel = 1;
+ break;
+
+ case OutputChannels.BOTH_CHANNELS:
+ default:
+ first_channel = 0;
+ last_channel = 1;
+ break;
+ }
+ } else {
+ first_channel = last_channel = 0;
+ }
+
+ for (@LOC("CH") int ch = 0; ch < 2; ch++)
+ for (@LOC("J") int j = 0; j < 576; j++)
+ prevblck[ch][j] = 0.0f;
+
+ nonzero[0] = nonzero[1] = 576;
+
+ br = new BitReserve();
+ si = new III_side_info_t();
+ }
+
+ /**
+ * Notify decoder that a seek is being made.
+ */
+ @LATTICE("THIS<J,J<CH,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
+ public void seek_notify() {
+ frame_start = 0;
+ for (@LOC("CH") int ch = 0; ch < 2; ch++)
+ for (@LOC("J") int j = 0; j < 576; j++)
+ prevblck[ch][j] = 0.0f;
+ br = new BitReserve();
+ }
+
+ public void decodeFrame() {
+ decode();
+ }
+
+ /**
+ * Decode one frame, filling the buffer with the output samples.
+ */
+
+ // subband samples are buffered and passed to the
+ // SynthesisFilter in one go.
+ @LOC("SAM") private float[] samples1 = new float[32];
+ @LOC("SAM") private float[] samples2 = new float[32];
+
+ /* location hierarchy of decode()
+{header} {stream} {si}
+{br, flush_main, main_data_end,frame_start,nSlots,bytes_to_discard}*
+{gr,max_gr} // granule
+{ch,channels,first_channel, last_channel, which_channels} // channel
+{part2_start}
+{sb18, ss}
+{out_1d}*
+{sb}*
+{samples1,sample2} {filter1,filter2}
+ */
+ @LATTICE("BYTE<THIS,THIS<MAIN,MAIN<VAR,THIS<GR,GR<VAR,BYTE*,GR*,THISLOC=THIS,GLOBALLOC=VAR")
+ public void decode() {
+ @LOC("VAR") int nSlots = header.slots();
+ @LOC("VAR") int flush_main;
+ @LOC("GR") int gr;
+ @LOC("THIS,LayerIIIDecoder.D1") int ch;
+ @LOC("THIS,LayerIIIDecoder.D2") int ss;
+ @LOC("THIS,LayerIIIDecoder.D3") int sb;
+ @LOC("THIS,LayerIIIDecoder.D2") int sb18;
+ @LOC("MAIN") int main_data_end;
+ @LOC("BYTES") int bytes_to_discard;
+ @LOC("VAR") int i;
+
+ get_side_info();
+
+ for (i = 0; i < nSlots; i++)
+ br.hputbuf(stream.get_bits(8)); // br < stream
+
+ // br < main_data_end
+ main_data_end = br.hsstell() >>> 3; // of previous frame
+
+
+ if ((flush_main = (br.hsstell() & 7)) != 0) { // flush_main < br
+ br.hgetbits(8 - flush_main); // br < flush_main
+ main_data_end++; // main_data_end*
+ }
+
+ // bytes_to_discard < GLB(frame_start,main_data_end,si)
+ // TODO does bytes_to_discard need to go back to si???
+ bytes_to_discard = frame_start - main_data_end - si.main_data_begin;
+
+ // frame_start should be *
+ frame_start += nSlots;
+
+ if (bytes_to_discard < 0)
+ return;
+
+ if (main_data_end > 4096) { // main_data_end should be > than 'frame_start' and 'br'
+ frame_start -= 4096;
+ br.rewindNbytes(4096);
+ }
+
+ for (; bytes_to_discard > 0; bytes_to_discard--) // bytes_to_discard > br
+ br.hgetbits(8);
+
+ // doing something from here
+
+ // here 'gr' and 'max_gr' should be higher than 'ch','channels', and more
+ for (gr = 0; gr < max_gr; gr++) { // two granules per channel
+ // in the loop body, access set={part2_start}
+
+ // 'ch', 'channels' should be higher than all locs in the below body
+ for (ch = 0; ch < channels; ch++) {
+ part2_start = br.hsstell(); // part2_start < br
+
+ // grab scale factors from the main data.
+ // following the scale factors is the actual compressed data
+ if (header.version() == Header.MPEG1)
+ get_scale_factors(ch, gr); // no need to care from this side
+ // here move scale factor data from 'br' buffer to 'scalefac' field
+ else
+ // MPEG-2 LSF, SZD: MPEG-2.5 LSF
+ get_LSF_scale_factors(ch, gr); // no need to care from this side
+
+ // here, decoding the compressed audio data
+ huffman_decode(ch, gr); // no need to care from this side
+ // System.out.println("CheckSum HuffMan = " + CheckSumHuff);
+ dequantize_sample(ro[ch], ch, gr); // no need to care from this side
+ }
+
+ stereo(gr); // no need to care from this side
+
+ if ((which_channels == OutputChannels.DOWNMIX_CHANNELS) && (channels > 1))
+ do_downmix();
+
+ for (ch = first_channel; ch <= last_channel; ch++) { // 'ch' and 'first_channel' > the body
+
+ // in the body
+ // read set= lr,ch,gr,out_1d, sb18, ss, SSLIMIT, out_1d
+ // write set= out_1d
+
+ reorder(lr[ch], ch, gr);
+ antialias(ch, gr);
+ // for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +
+ // out_1d[hb];
+ // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
+
+ hybrid(ch, gr);
+
+ // for (int hb = 0;hb<576;hb++) CheckSumOut1d = CheckSumOut1d +
+ // out_1d[hb];
+ // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
+
+ for (sb18 = 18; sb18 < 576; sb18 += 36) // sb18 > ss, SSLIMIT, out1d
+ // Frequency inversion
+ for (ss = 1; ss < SSLIMIT; ss += 2) // 'ss','SSLIMIT' > out_1d
+ out_1d[sb18 + ss] = -out_1d[sb18 + ss]; // out1d*
+
+ // 'ch', 'which_channels' should be higher than if/else body!
+ // location set written by if/else body
+ // = {samples1, samples2, filter1, filter2}
+ if ((ch == 0) || (which_channels == OutputChannels.RIGHT_CHANNEL)) {
+ for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
+ sb = 0;
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ samples1[sb] = out_1d[sb18 + ss]; // out_1d > samples1
+ // filter1.input_sample(out_1d[sb18+ss], sb);
+ sb++; // sb should be loc*
+ }
+ filter1.input_samples(samples1);
+ filter1.calculate_pcm_samples(buffer);
+ }
+ } else {
+ for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
+ sb = 0;
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ samples2[sb] = out_1d[sb18 + ss]; // out_1d > samples2
+ // filter2.input_sample(out_1d[sb18+ss], sb);
+ sb++;
+ }
+ filter2.input_samples(samples2);
+ filter2.calculate_pcm_samples(buffer);
+ }
+
+ }
+ } // channels
+ } // granule
+
+ // System.out.println("Counter = ................................."+counter);
+ // if (counter < 609)
+ // {
+ counter++; // count should be loc*
+ buffer.write_buffer(1); // buffer!!!
+ // }
+ // else if (counter == 609)
+ // {
+ // buffer.close();
+ // counter++;
+ // }
+ // else
+ // {
+ // }
+
+ }
+
+ /**
+ * Reads the side info from the stream, assuming the entire. frame has been
+ * read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)
+ */
+ @RETURNLOC("OUT")
+ private boolean get_side_info() {
+ @LOC("IN") int ch;
+ @LOC("IN") int gr;
+ if (header.version() == Header.MPEG1) {
+
+ si.main_data_begin = stream.get_bits(9);
+ if (channels == 1)
+ si.private_bits = stream.get_bits(5);
+ else
+ si.private_bits = stream.get_bits(3);
+
+ for (ch = 0; ch < channels; ch++) {
+ si.ch[ch].scfsi[0] = stream.get_bits(1);
+ si.ch[ch].scfsi[1] = stream.get_bits(1);
+ si.ch[ch].scfsi[2] = stream.get_bits(1);
+ si.ch[ch].scfsi[3] = stream.get_bits(1);
+ }
+
+ for (gr = 0; gr < 2; gr++) {
+ for (ch = 0; ch < channels; ch++) {
+ si.ch[ch].gr[gr].part2_3_length = stream.get_bits(12);
+ si.ch[ch].gr[gr].big_values = stream.get_bits(9);
+ si.ch[ch].gr[gr].global_gain = stream.get_bits(8);
+ si.ch[ch].gr[gr].scalefac_compress = stream.get_bits(4);
+ si.ch[ch].gr[gr].window_switching_flag = stream.get_bits(1);
+ if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {
+ si.ch[ch].gr[gr].block_type = stream.get_bits(2);
+ si.ch[ch].gr[gr].mixed_block_flag = stream.get_bits(1);
+
+ si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);
+ si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);
+
+ si.ch[ch].gr[gr].subblock_gain[0] = stream.get_bits(3);
+ si.ch[ch].gr[gr].subblock_gain[1] = stream.get_bits(3);
+ si.ch[ch].gr[gr].subblock_gain[2] = stream.get_bits(3);
+
+ // Set region_count parameters since they are implicit in this case.
+
+ if (si.ch[ch].gr[gr].block_type == 0) {
+ // Side info bad: block_type == 0 in split block
+ return false;
+ } else if (si.ch[ch].gr[gr].block_type == 2 && si.ch[ch].gr[gr].mixed_block_flag == 0) {
+ si.ch[ch].gr[gr].region0_count = 8;
+ } else {
+ si.ch[ch].gr[gr].region0_count = 7;
+ }
+ si.ch[ch].gr[gr].region1_count = 20 - si.ch[ch].gr[gr].region0_count;
+ } else {
+ si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);
+ si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);
+ si.ch[ch].gr[gr].table_select[2] = stream.get_bits(5);
+ si.ch[ch].gr[gr].region0_count = stream.get_bits(4);
+ si.ch[ch].gr[gr].region1_count = stream.get_bits(3);
+ si.ch[ch].gr[gr].block_type = 0;
+ }
+ si.ch[ch].gr[gr].preflag = stream.get_bits(1);
+ si.ch[ch].gr[gr].scalefac_scale = stream.get_bits(1);
+ si.ch[ch].gr[gr].count1table_select = stream.get_bits(1);
+ }
+ }
+
+ } else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF
+
+ si.main_data_begin = stream.get_bits(8);
+ if (channels == 1)
+ si.private_bits = stream.get_bits(1);
+ else
+ si.private_bits = stream.get_bits(2);
+
+ for (ch = 0; ch < channels; ch++) {
+
+ si.ch[ch].gr[0].part2_3_length = stream.get_bits(12);
+ si.ch[ch].gr[0].big_values = stream.get_bits(9);
+ si.ch[ch].gr[0].global_gain = stream.get_bits(8);
+ si.ch[ch].gr[0].scalefac_compress = stream.get_bits(9);
+ si.ch[ch].gr[0].window_switching_flag = stream.get_bits(1);
+
+ if ((si.ch[ch].gr[0].window_switching_flag) != 0) {
+
+ si.ch[ch].gr[0].block_type = stream.get_bits(2);
+ si.ch[ch].gr[0].mixed_block_flag = stream.get_bits(1);
+ si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
+ si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);
+
+ si.ch[ch].gr[0].subblock_gain[0] = stream.get_bits(3);
+ si.ch[ch].gr[0].subblock_gain[1] = stream.get_bits(3);
+ si.ch[ch].gr[0].subblock_gain[2] = stream.get_bits(3);
+
+ // Set region_count parameters since they are implicit in this case.
+
+ if (si.ch[ch].gr[0].block_type == 0) {
+ // Side info bad: block_type == 0 in split block
+ return false;
+ } else if (si.ch[ch].gr[0].block_type == 2 && si.ch[ch].gr[0].mixed_block_flag == 0) {
+ si.ch[ch].gr[0].region0_count = 8;
+ } else {
+ si.ch[ch].gr[0].region0_count = 7;
+ si.ch[ch].gr[0].region1_count = 20 - si.ch[ch].gr[0].region0_count;
+ }
+
+ } else {
+ si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
+ si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);
+ si.ch[ch].gr[0].table_select[2] = stream.get_bits(5);
+ si.ch[ch].gr[0].region0_count = stream.get_bits(4);
+ si.ch[ch].gr[0].region1_count = stream.get_bits(3);
+ si.ch[ch].gr[0].block_type = 0;
+ }
+
+ si.ch[ch].gr[0].scalefac_scale = stream.get_bits(1);
+ si.ch[ch].gr[0].count1table_select = stream.get_bits(1);
+ } // for(ch=0; ch<channels; ch++)
+ } // if (header.version() == MPEG1)
+ return true;
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void get_scale_factors(@LOC("IN") int ch, @LOC("IN") int gr) {
+ @LOC("THIS,LayerIIIDecoder.GSF4") int sfb;
+ @LOC("THIS,LayerIIIDecoder.GSF5") int window;
+ @LOC("THIS,LayerIIIDecoder.GSF1") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+ @LOC("THIS,LayerIIIDecoder.GSF2") int scale_comp = gr_info.scalefac_compress;
+ @LOC("THIS,LayerIIIDecoder.GSF3") int length0 = slen[0][scale_comp];
+ @LOC("THIS,LayerIIIDecoder.GSF3") int length1 = slen[1][scale_comp];
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+ if ((gr_info.mixed_block_flag) != 0) { // MIXED
+ for (sfb = 0; sfb < 8; sfb++)
+ scalefac[ch].l[sfb] = br.hgetbits(slen[0][gr_info.scalefac_compress]);
+ for (sfb = 3; sfb < 6; sfb++)
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = br.hgetbits(slen[0][gr_info.scalefac_compress]);
+ for (sfb = 6; sfb < 12; sfb++)
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = br.hgetbits(slen[1][gr_info.scalefac_compress]);
+ for (sfb = 12, window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = 0;
+
+ } else { // SHORT
+
+ scalefac[ch].s[0][0] = br.hgetbits(length0);
+ scalefac[ch].s[1][0] = br.hgetbits(length0);
+ scalefac[ch].s[2][0] = br.hgetbits(length0);
+ scalefac[ch].s[0][1] = br.hgetbits(length0);
+ scalefac[ch].s[1][1] = br.hgetbits(length0);
+ scalefac[ch].s[2][1] = br.hgetbits(length0);
+ scalefac[ch].s[0][2] = br.hgetbits(length0);
+ scalefac[ch].s[1][2] = br.hgetbits(length0);
+ scalefac[ch].s[2][2] = br.hgetbits(length0);
+ scalefac[ch].s[0][3] = br.hgetbits(length0);
+ scalefac[ch].s[1][3] = br.hgetbits(length0);
+ scalefac[ch].s[2][3] = br.hgetbits(length0);
+ scalefac[ch].s[0][4] = br.hgetbits(length0);
+ scalefac[ch].s[1][4] = br.hgetbits(length0);
+ scalefac[ch].s[2][4] = br.hgetbits(length0);
+ scalefac[ch].s[0][5] = br.hgetbits(length0);
+ scalefac[ch].s[1][5] = br.hgetbits(length0);
+ scalefac[ch].s[2][5] = br.hgetbits(length0);
+ scalefac[ch].s[0][6] = br.hgetbits(length1);
+ scalefac[ch].s[1][6] = br.hgetbits(length1);
+ scalefac[ch].s[2][6] = br.hgetbits(length1);
+ scalefac[ch].s[0][7] = br.hgetbits(length1);
+ scalefac[ch].s[1][7] = br.hgetbits(length1);
+ scalefac[ch].s[2][7] = br.hgetbits(length1);
+ scalefac[ch].s[0][8] = br.hgetbits(length1);
+ scalefac[ch].s[1][8] = br.hgetbits(length1);
+ scalefac[ch].s[2][8] = br.hgetbits(length1);
+ scalefac[ch].s[0][9] = br.hgetbits(length1);
+ scalefac[ch].s[1][9] = br.hgetbits(length1);
+ scalefac[ch].s[2][9] = br.hgetbits(length1);
+ scalefac[ch].s[0][10] = br.hgetbits(length1);
+ scalefac[ch].s[1][10] = br.hgetbits(length1);
+ scalefac[ch].s[2][10] = br.hgetbits(length1);
+ scalefac[ch].s[0][11] = br.hgetbits(length1);
+ scalefac[ch].s[1][11] = br.hgetbits(length1);
+ scalefac[ch].s[2][11] = br.hgetbits(length1);
+ scalefac[ch].s[0][12] = 0;
+ scalefac[ch].s[1][12] = 0;
+ scalefac[ch].s[2][12] = 0;
+ } // SHORT
+
+ } else { // LONG types 0,1,3
+
+ if ((si.ch[ch].scfsi[0] == 0) || (gr == 0)) {
+ scalefac[ch].l[0] = br.hgetbits(length0);
+ scalefac[ch].l[1] = br.hgetbits(length0);
+ scalefac[ch].l[2] = br.hgetbits(length0);
+ scalefac[ch].l[3] = br.hgetbits(length0);
+ scalefac[ch].l[4] = br.hgetbits(length0);
+ scalefac[ch].l[5] = br.hgetbits(length0);
+ }
+ if ((si.ch[ch].scfsi[1] == 0) || (gr == 0)) {
+ scalefac[ch].l[6] = br.hgetbits(length0);
+ scalefac[ch].l[7] = br.hgetbits(length0);
+ scalefac[ch].l[8] = br.hgetbits(length0);
+ scalefac[ch].l[9] = br.hgetbits(length0);
+ scalefac[ch].l[10] = br.hgetbits(length0);
+ }
+ if ((si.ch[ch].scfsi[2] == 0) || (gr == 0)) {
+ scalefac[ch].l[11] = br.hgetbits(length1);
+ scalefac[ch].l[12] = br.hgetbits(length1);
+ scalefac[ch].l[13] = br.hgetbits(length1);
+ scalefac[ch].l[14] = br.hgetbits(length1);
+ scalefac[ch].l[15] = br.hgetbits(length1);
+ }
+ if ((si.ch[ch].scfsi[3] == 0) || (gr == 0)) {
+ scalefac[ch].l[16] = br.hgetbits(length1);
+ scalefac[ch].l[17] = br.hgetbits(length1);
+ scalefac[ch].l[18] = br.hgetbits(length1);
+ scalefac[ch].l[19] = br.hgetbits(length1);
+ scalefac[ch].l[20] = br.hgetbits(length1);
+ }
+
+ scalefac[ch].l[21] = 0;
+ scalefac[ch].l[22] = 0;
+ }
+ }
+
+ /**
+ *
+ */
+ // MDM: new_slen is fully initialized before use, no need
+ // to reallocate array.
+ @LOC("NS") private final int[] new_slen = new int[4];
+
+ @LATTICE("THIS<IN,THIS<I,THIS<X,THIS<M,I*,X*,M*,THISLOC=THIS,GLOBALLOC=THIS")
+ private void get_LSF_scale_data(@LOC("IN") int ch, @LOC("IN") int gr) {
+
+ @LOC("THIS,LayerIIIDecoder.GLSFD2") int scalefac_comp;
+ @LOC("THIS,LayerIIIDecoder.GLSFD3") int int_scalefac_comp;
+ @LOC("IN") int mode_ext = header.mode_extension();
+ @LOC("M") int m;
+ @LOC("THIS,LayerIIIDecoder.GLSFD4") int blocktypenumber;
+ @LOC("THIS,LayerIIIDecoder.GLSFD4") int blocknumber = 0;
+
+ @LOC("THIS,LayerIIIDecoder.GLSFD1") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+
+ scalefac_comp = gr_info.scalefac_compress;
+
+ if (gr_info.block_type == 2) {
+ if (gr_info.mixed_block_flag == 0)
+ blocktypenumber = 1;
+ else if (gr_info.mixed_block_flag == 1)
+ blocktypenumber = 2;
+ else
+ blocktypenumber = 0;
+ } else {
+ blocktypenumber = 0;
+ }
+
+ if (!(((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
+
+ if (scalefac_comp < 400) {
+
+ new_slen[0] = (scalefac_comp >>> 4) / 5;
+ new_slen[1] = (scalefac_comp >>> 4) % 5;
+ new_slen[2] = (scalefac_comp & 0xF) >>> 2;
+ new_slen[3] = (scalefac_comp & 3);
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 0;
+
+ } else if (scalefac_comp < 500) {
+
+ new_slen[0] = ((scalefac_comp - 400) >>> 2) / 5;
+ new_slen[1] = ((scalefac_comp - 400) >>> 2) % 5;
+ new_slen[2] = (scalefac_comp - 400) & 3;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 1;
+
+ } else if (scalefac_comp < 512) {
+
+ new_slen[0] = (scalefac_comp - 500) / 3;
+ new_slen[1] = (scalefac_comp - 500) % 3;
+ new_slen[2] = 0;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 1;
+ blocknumber = 2;
+ }
+ }
+
+ if ((((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
+ int_scalefac_comp = scalefac_comp >>> 1;
+
+ if (int_scalefac_comp < 180) {
+ new_slen[0] = int_scalefac_comp / 36;
+ new_slen[1] = (int_scalefac_comp % 36) / 6;
+ new_slen[2] = (int_scalefac_comp % 36) % 6;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 3;
+ } else if (int_scalefac_comp < 244) {
+ new_slen[0] = ((int_scalefac_comp - 180) & 0x3F) >>> 4;
+ new_slen[1] = ((int_scalefac_comp - 180) & 0xF) >>> 2;
+ new_slen[2] = (int_scalefac_comp - 180) & 3;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 4;
+ } else if (int_scalefac_comp < 255) {
+ new_slen[0] = (int_scalefac_comp - 244) / 3;
+ new_slen[1] = (int_scalefac_comp - 244) % 3;
+ new_slen[2] = 0;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 5;
+ }
+ }
+
+ for (@LOC("X") int x = 0; x < 45; x++)
+ // why 45, not 54?
+ scalefac_buffer[x] = 0;
+
+ m = 0;
+ for (@LOC("I") int i = 0; i < 4; i++) {
+ for (@LOC("THIS,LayerIIIDecoder.GLSFD5") int j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++) {
+ scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);
+ m++;
+
+ } // for (unint32 j ...
+ } // for (uint32 i ...
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void get_LSF_scale_factors(@LOC("IN") int ch, @LOC("IN") int gr) {
+ @LOC("THIS,LayerIIIDecoder.GLSFF4") int m = 0;
+ @LOC("THIS,LayerIIIDecoder.GLSFF2") int sfb;
+ @LOC("THIS,LayerIIIDecoder.GLSFF3") int window;
+ @LOC("THIS,LayerIIIDecoder.GLSFF1") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+
+ get_LSF_scale_data(ch, gr);
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+ if (gr_info.mixed_block_flag != 0) { // MIXED
+ for (sfb = 0; sfb < 8; sfb++) {
+ scalefac[ch].l[sfb] = scalefac_buffer[m];
+ m++;
+ }
+ for (sfb = 3; sfb < 12; sfb++) {
+ for (window = 0; window < 3; window++) {
+ scalefac[ch].s[window][sfb] = scalefac_buffer[m];
+ m++;
+ }
+ }
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][12] = 0;
+
+ } else { // SHORT
+
+ for (sfb = 0; sfb < 12; sfb++) {
+ for (window = 0; window < 3; window++) {
+ scalefac[ch].s[window][sfb] = scalefac_buffer[m];
+ m++;
+ }
+ }
+
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][12] = 0;
+ }
+ } else { // LONG types 0,1,3
+
+ for (sfb = 0; sfb < 21; sfb++) {
+ scalefac[ch].l[sfb] = scalefac_buffer[m];
+ m++;
+ }
+ scalefac[ch].l[21] = 0; // Jeff
+ scalefac[ch].l[22] = 0;
+ }
+ }
+
+ /**
+ *
+ */
+ @LOC("LY") int[] x = { 0 };
+ @LOC("F") int[] y = { 0 };
+ @LOC("LY") int[] v = { 0 };
+ @LOC("LY") int[] w = { 0 };
+
+ @LATTICE("H<I,I<R,R<B1,B1<B,B<THIS,THIS<IN,I*,THISLOC=THIS,GLOBALLOC=IN")
+ private void huffman_decode(int ch, int gr) {
+ x[0] = 0;
+ y[0] = 0;
+ v[0] = 0;
+ w[0] = 0;
+
+ @LOC("THIS,LayerIIIDecoder.HD1") int part2_3_end = part2_start + si.ch[ch].gr[gr].part2_3_length;
+ @LOC("THIS,LayerIIIDecoder.HD2") int num_bits;
+ @LOC("R") int region1Start;
+ @LOC("R") int region2Start;
+ @LOC("HD3") int index;
+
+ @LOC("B") int buf;
+ @LOC("B1") int buf1;
+
+ @LOC("H") huffcodetab h;
+
+ // Find region boundary for short block case
+
+ if (((si.ch[ch].gr[gr].window_switching_flag) != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+
+ // Region2.
+ // MS: Extrahandling for 8KHZ
+ region1Start = (sfreq == 8) ? 72 : 36; // sfb[9/3]*3=36 or in case 8KHZ =
+ // 72
+ region2Start = 576; // No Region2 for short block case
+
+ } else { // Find region boundary for long block case
+
+ buf = si.ch[ch].gr[gr].region0_count + 1;
+ buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;
+
+ if (buf1 > sfBandIndex[sfreq].l.length - 1)
+ buf1 = sfBandIndex[sfreq].l.length - 1;
+
+ region1Start = sfBandIndex[sfreq].l[buf];
+ region2Start = sfBandIndex[sfreq].l[buf1]; /* MI */
+ }
+
+ index = 0;
+ // Read bigvalues area
+ for (@LOC("I") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i += 2) {
+ if (i < region1Start)
+ h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
+ else if (i < region2Start)
+ h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];
+ else
+ h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];
+
+ huffcodetab.huffman_decoder(h, x, y, v, w, br);
+ // if (index >= is_1d.length)
+ // System.out.println("i0="+i+"/"+(si.ch[ch].gr[gr].big_values<<1)+" Index="+index+" is_1d="+is_1d.length);
+
+ is_1d[index++] = x[0];
+ is_1d[index++] = y[0];
+
+ CheckSumHuff = CheckSumHuff + x[0] + y[0];
+ // System.out.println("x = "+x[0]+" y = "+y[0]);
+ }
+
+ // Read count1 area
+ h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
+ num_bits = br.hsstell();
+
+ while ((num_bits < part2_3_end) && (index < 576)) {
+
+ huffcodetab.huffman_decoder(h, x, y, v, w, br);
+
+ is_1d[index++] = v[0];
+ is_1d[index++] = w[0];
+ is_1d[index++] = x[0];
+ is_1d[index++] = y[0];
+ CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];
+ // System.out.println("v = "+v[0]+" w = "+w[0]);
+ // System.out.println("x = "+x[0]+" y = "+y[0]);
+ num_bits = br.hsstell();
+ }
+
+ if (num_bits > part2_3_end) {
+ br.rewindNbits(num_bits - part2_3_end);
+ index -= 4;
+ }
+
+ num_bits = br.hsstell();
+
+ // Dismiss stuffing bits
+ if (num_bits < part2_3_end)
+ br.hgetbits(part2_3_end - num_bits);
+
+ // Zero out rest
+
+ if (index < 576)
+ nonzero[ch] = index;
+ else
+ nonzero[ch] = 576;
+
+ if (index < 0)
+ index = 0;
+
+ // may not be necessary
+ for (; index < 576; index++)
+ is_1d[index] = 0;
+ }
+
+ /**
+ *
+ */
+ private void i_stereo_k_values(@LOC("IN") int is_pos, @LOC("IN") int io_type, @LOC("IN") int i) {
+ if (is_pos == 0) {
+ k[0][i] = 1.0f;
+ k[1][i] = 1.0f;
+ } else if ((is_pos & 1) != 0) {
+ k[0][i] = io[io_type][(is_pos + 1) >>> 1];
+ k[1][i] = 1.0f;
+ } else {
+ k[0][i] = 1.0f;
+ k[1][i] = io[io_type][is_pos >>> 1];
+ }
+ }
+
+ /**
+ *
+ */
+ @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")
+ private void dequantize_sample(@LOC("OUT") float xr[][], @LOC("IN") int ch, @LOC("IN") int gr) {
+ @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+ @LOC("CB") int cb = 0;
+ @LOC("CB") int next_cb_boundary;
+ @LOC("CB") int cb_begin = 0;
+ @LOC("CB") int cb_width = 0;
+ @LOC("IN") int index = 0;
+ @LOC("VAR") int t_index;
+ @LOC("J") int j;
+ @LOC("VAR") float g_gain;
+ //float[][] xr_1d = xr;//substituted xr for instances of xr_1d to decrease number of areas
+
+ // choose correct scalefactor band per block type, initalize boundary
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+ if (gr_info.mixed_block_flag != 0)
+ next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
+ else {
+ cb_width = sfBandIndex[sfreq].s[1];
+ next_cb_boundary = (cb_width << 2) - cb_width;
+ cb_begin = 0;
+ }
+ } else {
+ next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
+ }
+
+ // Compute overall (global) scaling.
+
+ g_gain = (float) Math.pow(2.0, (0.25 * (gr_info.global_gain - 210.0)));
+
+ for (j = 0; j < nonzero[ch]; j++) {
+ // Modif E.B 02/22/99
+ @LOC("REST") int reste = j % SSLIMIT;
+ @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);
+ if (is_1d[j] == 0)
+ xr[quotien][reste] = 0.0f;
+ else {
+ @LOC("VAR") int abv = is_1d[j];
+ // Pow Array fix (11/17/04)
+ if (abv < t_43.length) {
+ if (is_1d[j] > 0)
+ xr[quotien][reste] = g_gain * t_43[abv];
+ else {
+ if (-abv < t_43.length)
+ xr[quotien][reste] = -g_gain * t_43[-abv];
+ else
+ xr[quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
+ }
+ } else {
+ if (is_1d[j] > 0)
+ xr[quotien][reste] = g_gain * (float) Math.pow(abv, d43);
+ else
+ xr[quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
+ }
+ }
+ }
+
+ // apply formula per block type
+ for (j = 0; j < nonzero[ch]; j++) {
+ // Modif E.B 02/22/99
+ @LOC("REST") int reste = j % SSLIMIT;
+ @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);
+
+ if (index == next_cb_boundary) { /* Adjust critical band boundary */
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+ if (gr_info.mixed_block_flag != 0) {
+
+ if (index == sfBandIndex[sfreq].l[8]) {
+ next_cb_boundary = sfBandIndex[sfreq].s[4];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+ cb = 3;
+ cb_width = sfBandIndex[sfreq].s[4] - sfBandIndex[sfreq].s[3];
+
+ cb_begin = sfBandIndex[sfreq].s[3];
+ cb_begin = (cb_begin << 2) - cb_begin;
+
+ } else if (index < sfBandIndex[sfreq].l[8]) {
+
+ next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
+
+ } else {
+
+ next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+
+ cb_begin = sfBandIndex[sfreq].s[cb];
+ cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
+ cb_begin = (cb_begin << 2) - cb_begin;
+ }
+
+ } else {
+
+ next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+
+ cb_begin = sfBandIndex[sfreq].s[cb];
+ cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
+ cb_begin = (cb_begin << 2) - cb_begin;
+ }
+
+ } else { // long blocks
+
+ next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
+
+ }
+ }
+
+ // Do long/short dependent scaling operations
+
+ if ((gr_info.window_switching_flag != 0)
+ && (((gr_info.block_type == 2) && (gr_info.mixed_block_flag == 0)) || ((gr_info.block_type == 2)
+ && (gr_info.mixed_block_flag != 0) && (j >= 36)))) {
+
+ t_index = (index - cb_begin) / cb_width;
+ /*
+ * xr[sb][ss] *= pow(2.0, ((-2.0 * gr_info.subblock_gain[t_index]) -(0.5
+ * * (1.0 + gr_info.scalefac_scale) scalefac[ch].s[t_index][cb])));
+ */
+ @LOC("IDX") int idx = scalefac[ch].s[t_index][cb] << gr_info.scalefac_scale;
+ idx += (gr_info.subblock_gain[t_index] << 2);
+
+ xr[quotien][reste] *= two_to_negative_half_pow[idx];
+
+ } else { // LONG block types 0,1,3 & 1st 2 subbands of switched blocks
+ /*
+ * xr[sb][ss] *= pow(2.0, -0.5 * (1.0+gr_info.scalefac_scale)
+ * (scalefac[ch].l[cb] + gr_info.preflag * pretab[cb]));
+ */
+ @LOC("IDX") int idx = scalefac[ch].l[cb];
+
+ if (gr_info.preflag != 0)
+ idx += pretab[cb];
+
+ idx = idx << gr_info.scalefac_scale;
+ xr[quotien][reste] *= two_to_negative_half_pow[idx];
+ }
+ index++;
+ }
+
+ for (j = nonzero[ch]; j < 576; j++) {
+ // Modif E.B 02/22/99
+ @LOC("REST") int reste = j % SSLIMIT;
+ @LOC("QUO") int quotien = (int) ((j - reste) / SSLIMIT);
+ if (reste < 0)
+ reste = 0;
+ if (quotien < 0)
+ quotien = 0;
+ xr[quotien][reste] = 0.0f;
+ }
+
+ return;
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<I,I<GR,GR<IN,I*,THISLOC=THIS,GLOBALLOC=IN")
+ private void reorder(@LOC("IN") float xr[][], @LOC("IN") int ch, @LOC("IN") int gr) {
+ // the purpose of reordering: move 'short samples' back to their original position
+ // after reorder, the samples are no long ordered by frequency
+
+ // the format of input data to reorder:
+ // three small chunks of 192 samples each are combined to 576 samples ordered by frequency
+
+ @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+ @LOC("THIS,LayerIIIDecoder.RO6") int freq;
+ @LOC("THIS,LayerIIIDecoder.RO5") int freq3;
+ @LOC("I") int index;
+ @LOC("THIS,LayerIIIDecoder.RO9") int sfb;
+ @LOC("THIS,LayerIIIDecoder.RO8") int sfb_start;
+ @LOC("THIS,LayerIIIDecoder.RO7") int sfb_lines;
+ @LOC("THIS,LayerIIIDecoder.RO4") int src_line;
+ @LOC("THIS,LayerIIIDecoder.RO1") int des_line;
+ //float[][] xr_1d = xr; subbed in xr for xr_1d so as not to create extra areas
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+
+ for (index = 0; index < 576; index++)
+ out_1d[index] = 0.0f;
+
+ if (gr_info.mixed_block_flag != 0) {
+ // NO REORDER FOR LOW 2 SUBBANDS
+ for (index = 0; index < 36; index++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.RO3") int reste = index % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((index - reste) / SSLIMIT);
+ out_1d[index] = xr[quotien][reste];
+ }
+ // REORDERING FOR REST SWITCHED SHORT
+ /*
+ * for( sfb=3,sfb_start=sfBandIndex[sfreq].s[3],
+ * sfb_lines=sfBandIndex[sfreq].s[4] - sfb_start; sfb < 13;
+ * sfb++,sfb_start = sfBandIndex[sfreq].s[sfb], sfb_lines =
+ * sfBandIndex[sfreq].s[sfb+1] - sfb_start ) {
+ */
+ for (sfb = 3; sfb < 13; sfb++) {
+ // System.out.println("sfreq="+sfreq+" sfb="+sfb+" sfBandIndex="+sfBandIndex.length+" sfBandIndex[sfreq].s="+sfBandIndex[sfreq].s.length);
+ sfb_start = sfBandIndex[sfreq].s[sfb];
+ sfb_lines = sfBandIndex[sfreq].s[sfb + 1] - sfb_start;
+
+ @LOC("THIS,LayerIIIDecoder.RO7") int sfb_start3 = (sfb_start << 2) - sfb_start;
+
+ for (freq = 0, freq3 = 0; freq < sfb_lines; freq++, freq3 += 3) {
+
+ src_line = sfb_start3 + freq;
+ des_line = sfb_start3 + freq3;
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.RO3") int reste = src_line % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ out_1d[des_line] = xr[quotien][reste];
+ src_line += sfb_lines;
+ des_line++;
+
+ reste = src_line % SSLIMIT;
+ quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ out_1d[des_line] = xr[quotien][reste];
+ src_line += sfb_lines;
+ des_line++;
+
+ reste = src_line % SSLIMIT;
+ quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ out_1d[des_line] = xr[quotien][reste];
+ }
+ }
+
+ } else { // pure short
+ for (index = 0; index < 576; index++) {
+ @LOC("THIS,LayerIIIDecoder.RO8") int j = reorder_table[sfreq][index];
+ @LOC("THIS,LayerIIIDecoder.RO3") int reste = j % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((j - reste) / SSLIMIT);
+ out_1d[index] = xr[quotien][reste];
+ }
+ }
+ } else { // long blocks
+ for (index = 0; index < 576; index++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.RO3") int reste = index % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.RO2") int quotien = (int) ((index - reste) / SSLIMIT);
+ out_1d[index] = xr[quotien][reste];
+ }
+ }
+ }
+
+ /**
+ *
+ */
+
+ @LOC("IP") int[] is_pos = new int[576];
+ @LOC("IR") float[] is_ratio = new float[576];
+
+ @LATTICE("IO<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void stereo(@LOC("IN") int gr) {
+ @LOC("SH") int sb;
+ @LOC("SH") int ss;
+
+ if (channels == 1) { // mono , bypass xr[0][][] to lr[0][][]
+
+ for (sb = 0; sb < SBLIMIT; sb++)
+ for (ss = 0; ss < SSLIMIT; ss += 3) {
+ lr[0][sb][ss] = ro[0][sb][ss];
+ lr[0][sb][ss + 1] = ro[0][sb][ss + 1];
+ lr[0][sb][ss + 2] = ro[0][sb][ss + 2];
+ }
+
+ } else {
+
+ @LOC("THIS,LayerIIIDecoder.ME") gr_info_s gr_info = (si.ch[0].gr[gr]);
+ @LOC("THIS,LayerIIIDecoder.ME") int mode_ext = header.mode_extension();
+ @LOC("THIS,LayerIIIDecoder.SH") int sfb;
+ @LOC("THIS,LayerIIIDecoder.SH") int i;
+ @LOC("THIS,LayerIIIDecoder.SH") int lines;
+ @LOC("THIS,LayerIIIDecoder.SH") int temp;
+ @LOC("THIS,LayerIIIDecoder.TMP2") int temp2;
+
+ @LOC("THIS,LayerIIIDecoder.S") boolean ms_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x2) != 0));
+ @LOC("THIS,LayerIIIDecoder.S") boolean i_stereo = ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x1) != 0));
+ @LOC("THIS,LayerIIIDecoder.LSF") boolean lsf =
+ ((header.version() == Header.MPEG2_LSF || header.version() == Header.MPEG25_LSF)); // SZD
+
+ @LOC("IO") int io_type = (gr_info.scalefac_compress & 1);
+
+ // initialization
+
+ for (i = 0; i < 576; i++) {
+ is_pos[i] = 7;
+
+ is_ratio[i] = 0.0f;
+ }
+
+ if (i_stereo) {
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)) {
+ if (gr_info.mixed_block_flag != 0) {
+
+ @LOC("THIS,LayerIIIDecoder.SH") int max_sfb = 0;
+
+ for (@LOC("THIS,LayerIIIDecoder.J") int j = 0; j < 3; j++) {
+ @LOC("THIS,LayerIIIDecoder.SH") int sfbcnt;
+ sfbcnt = 2;
+ for (sfb = 12; sfb >= 3; sfb--) {
+ i = sfBandIndex[sfreq].s[sfb];
+ lines = sfBandIndex[sfreq].s[sfb + 1] - i;
+ i = (i << 2) - i + (j + 1) * lines - 1;
+
+ while (lines > 0) {
+ if (ro[1][i / 18][i % 18] != 0.0f) {
+ // MDM: in java, array access is very slow.
+ // Is quicker to compute div and mod values.
+ // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
+ sfbcnt = sfb;
+ sfb = -10;
+ lines = -10;
+ }
+
+ lines--;
+ i--;
+
+ } // while (lines > 0)
+
+ } // for (sfb=12 ...
+ sfb = sfbcnt + 1;
+
+ if (sfb > max_sfb)
+ max_sfb = sfb;
+
+ while (sfb < 12) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + j * sb;
+
+ for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].s[j][sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+
+ i++;
+ } // for (; sb>0...
+ sfb++;
+ } // while (sfb < 12)
+ sfb = sfBandIndex[sfreq].s[10];
+ sb = sfBandIndex[sfreq].s[11] - sfb;
+ sfb = (sfb << 2) - sfb + j * sb;
+ temp = sfBandIndex[sfreq].s[11];
+ sb = sfBandIndex[sfreq].s[12] - temp;
+ i = (temp << 2) - temp + j * sb;
+
+ for (; sb > 0; sb--) {
+ is_pos[i] = is_pos[sfb];
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // for (; sb > 0 ...
+ }
+ if (max_sfb <= 3) {
+ i = 2;
+ ss = 17;
+ sb = -1;
+ while (i >= 0) {
+ if (ro[1][i][ss] != 0.0f) {
+ sb = (i << 4) + (i << 1) + ss;
+ i = -1;
+ } else {
+ ss--;
+ if (ss < 0) {
+ i--;
+ ss = 17;
+ }
+ } // if (ro ...
+ } // while (i>=0)
+ i = 0;
+ while (sfBandIndex[sfreq].l[i] <= sb)
+ i++;
+ sfb = i;
+ i = sfBandIndex[sfreq].l[i];
+ for (; sfb < 8; sfb++) {
+ sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].l[sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ } // for (; sb>0 ...
+ } // for (; sfb<8 ...
+ } // for (j=0 ...
+ } else { // if (gr_info.mixed_block_flag)
+ for (@LOC("THIS,LayerIIIDecoder.J") int j = 0; j < 3; j++) {
+ @LOC("THIS,LayerIIIDecoder.SH") int sfbcnt;
+ sfbcnt = -1;
+ for (sfb = 12; sfb >= 0; sfb--) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ lines = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + (j + 1) * lines - 1;
+
+ while (lines > 0) {
+ if (ro[1][i / 18][i % 18] != 0.0f) {
+ // MDM: in java, array access is very slow.
+ // Is quicker to compute div and mod values.
+ // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
+ sfbcnt = sfb;
+ sfb = -10;
+ lines = -10;
+ }
+ lines--;
+ i--;
+ } // while (lines > 0) */
+
+ } // for (sfb=12 ...
+ sfb = sfbcnt + 1;
+ while (sfb < 12) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + j * sb;
+ for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].s[j][sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ } // for (; sb>0 ...
+ sfb++;
+ } // while (sfb<12)
+
+ temp = sfBandIndex[sfreq].s[10];
+ temp2 = sfBandIndex[sfreq].s[11];
+ sb = temp2 - temp;
+ sfb = (temp << 2) - temp + j * sb;
+ sb = sfBandIndex[sfreq].s[12] - temp2;
+ i = (temp2 << 2) - temp2 + j * sb;
+
+ for (; sb > 0; sb--) {
+ is_pos[i] = is_pos[sfb];
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // for (; sb>0 ...
+ } // for (sfb=12
+ } // for (j=0 ...
+ } else { // if (gr_info.window_switching_flag ...
+ i = 31;
+ ss = 17;
+ sb = 0;
+ while (i >= 0) {
+ if (ro[1][i][ss] != 0.0f) {
+ sb = (i << 4) + (i << 1) + ss;
+ i = -1;
+ } else {
+ ss--;
+ if (ss < 0) {
+ i--;
+ ss = 17;
+ }
+ }
+ }
+ i = 0;
+ while (sfBandIndex[sfreq].l[i] <= sb)
+ i++;
+
+ sfb = i;
+ i = sfBandIndex[sfreq].l[i];
+ for (; sfb < 21; sfb++) {
+ sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].l[sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ }
+ }
+ sfb = sfBandIndex[sfreq].l[20];
+ for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
+ is_pos[i] = is_pos[sfb]; // error here : i >=576
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // if (gr_info.mixed_block_flag)
+ } // if (gr_info.window_switching_flag ...
+ } // if (i_stereo)
+
+ i = 0;
+ for (sb = 0; sb < SBLIMIT; sb++)
+ for (ss = 0; ss < SSLIMIT; ss++) {
+ if (is_pos[i] == 7) {
+ if (ms_stereo) {
+ lr[0][sb][ss] = (ro[0][sb][ss] + ro[1][sb][ss]) * 0.707106781f;
+ lr[1][sb][ss] = (ro[0][sb][ss] - ro[1][sb][ss]) * 0.707106781f;
+ } else {
+ lr[0][sb][ss] = ro[0][sb][ss];
+ lr[1][sb][ss] = ro[1][sb][ss];
+ }
+ } else if (i_stereo) {
+
+ if (lsf) {
+ lr[0][sb][ss] = ro[0][sb][ss] * k[0][i];
+ lr[1][sb][ss] = ro[0][sb][ss] * k[1][i];
+ } else {
+ lr[1][sb][ss] = ro[0][sb][ss] / (float) (1 + is_ratio[i]);
+ lr[0][sb][ss] = lr[1][sb][ss] * is_ratio[i];
+ }
+ }
+ /*
+ * else { System.out.println("Error in stereo processing\n"); }
+ */
+ i++;
+ }
+
+ } // channels == 2
+
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<SRC<SS,SS<SB18,SB18<SB18LIM,SB18LIM<GR,GR<IN,SB18*,SS*,THISLOC=THIS")
+ private void antialias(@LOC("IN") int ch, @LOC("IN") int gr) {
+ @LOC("SB18") int sb18;
+ @LOC("SS") int ss;
+ @LOC("SB18LIM") int sb18lim;
+ @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+ // 31 alias-reduction operations between each pair of sub-bands
+ // with 8 butterflies between each pair
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.block_type == 2)
+ && !(gr_info.mixed_block_flag != 0))
+ return;
+
+ if ((gr_info.window_switching_flag != 0) && (gr_info.mixed_block_flag != 0)
+ && (gr_info.block_type == 2)) {
+ sb18lim = 18;
+ } else {
+ sb18lim = 558;
+ }
+
+ for (sb18 = 0; sb18 < sb18lim; sb18 += 18) {
+ for (ss = 0; ss < 8; ss++) {
+ @LOC("SRC") int src_idx1 = sb18 + 17 - ss;
+ @LOC("SRC") int src_idx2 = sb18 + 18 + ss;
+ @LOC("THIS,LayerIIIDecoder.O") float bu = out_1d[src_idx1];
+ @LOC("THIS,LayerIIIDecoder.0") float bd = out_1d[src_idx2];
+ out_1d[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);
+ out_1d[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+
+ // MDM: tsOutCopy and rawout do not need initializing, so the arrays
+ // can be reused.
+ @LOC("TS") float[] tsOutCopy = new float[18];
+ @LOC("RAW") float[] rawout = new float[36];
+
+@LATTICE("THIS<SB,THIS<SH,SH<IN,IN<GLOBAL,SB*,SH*,THISLOC=THIS,GLOBALLOC=GLOBAL")
+ private void hybrid(@LOC("IN") int ch, @LOC("IN") int gr) {
+ @LOC("THIS,LayerIIIDecoder.BT") int bt;
+ @LOC("SB") int sb18;
+ @LOC("THIS,LayerIIIDecoder.GR") gr_info_s gr_info = (si.ch[ch].gr[gr]);
+ @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut;
+
+ //float[][] prvblk;
+
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ bt =
+ ((gr_info.window_switching_flag != 0) && (gr_info.mixed_block_flag != 0) && (sb18 < 36))
+ ? 0 : gr_info.block_type;
+
+ tsOut = out_1d;
+ // Modif E.B 02/22/99
+ for (@LOC("SH") int cc = 0; cc < 18; cc++)
+ tsOutCopy[cc] = tsOut[cc + sb18];
+
+ inv_mdct(tsOutCopy, rawout, bt);
+
+ for (@LOC("SH") int cc = 0; cc < 18; cc++)
+ tsOut[cc + sb18] = tsOutCopy[cc];
+ // Fin Modif
+
+ // overlap addition
+ //prvblk = prevblck; //eliminated unnecessary areas
+
+ tsOut[0 + sb18] = rawout[0] + prevblk[ch][sb18 + 0];
+ prevblk[ch][sb18 + 0] = rawout[18];
+ tsOut[1 + sb18] = rawout[1] + prevblk[ch][sb18 + 1];
+ prevblk[ch][sb18 + 1] = rawout[19];
+ tsOut[2 + sb18] = rawout[2] + prevblk[ch][sb18 + 2];
+ prevblk[ch][sb18 + 2] = rawout[20];
+ tsOut[3 + sb18] = rawout[3] + prevblk[ch][sb18 + 3];
+ prevblk[ch][sb18 + 3] = rawout[21];
+ tsOut[4 + sb18] = rawout[4] + prevblk[ch][sb18 + 4];
+ prevblk[ch][sb18 + 4] = rawout[22];
+ tsOut[5 + sb18] = rawout[5] + prevblk[ch][sb18 + 5];
+ prevblk[ch][sb18 + 5] = rawout[23];
+ tsOut[6 + sb18] = rawout[6] + prevblk[ch][sb18 + 6];
+ prevblk[ch][sb18 + 6] = rawout[24];
+ tsOut[7 + sb18] = rawout[7] + prevblk[ch][sb18 + 7];
+ prevblk[ch][sb18 + 7] = rawout[25];
+ tsOut[8 + sb18] = rawout[8] + prevblk[ch][sb18 + 8];
+ prevblk[ch][sb18 + 8] = rawout[26];
+ tsOut[9 + sb18] = rawout[9] + prevblk[ch][sb18 + 9];
+ prevblk[ch][sb18 + 9] = rawout[27];
+ tsOut[10 + sb18] = rawout[10] + prevblk[ch][sb18 + 10];
+ prevblk[ch][sb18 + 10] = rawout[28];
+ tsOut[11 + sb18] = rawout[11] + prevblk[ch][sb18 + 11];
+ prevblk[ch][sb18 + 11] = rawout[29];
+ tsOut[12 + sb18] = rawout[12] + prevblk[ch][sb18 + 12];
+ prevblk[ch][sb18 + 12] = rawout[30];
+ tsOut[13 + sb18] = rawout[13] + prevblk[ch][sb18 + 13];
+ prevblk[ch][sb18 + 13] = rawout[31];
+ tsOut[14 + sb18] = rawout[14] + prevblk[ch][sb18 + 14];
+ prevblk[ch][sb18 + 14] = rawout[32];
+ tsOut[15 + sb18] = rawout[15] + prevblk[ch][sb18 + 15];
+ prevblk[ch][sb18 + 15] = rawout[33];
+ tsOut[16 + sb18] = rawout[16] + prevblk[ch][sb18 + 16];
+ prevblk[ch][sb18 + 16] = rawout[34];
+ tsOut[17 + sb18] = rawout[17] + prevblk[ch][sb18 + 17];
+ prevblk[ch][sb18 + 17] = rawout[35];
+ }
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<SB,THIS<SS,SB<GLOBAL,SS<GLOBAL,SS*,SB*,THISLOC=THIS,GLOBALLOC=GLOBAL")
+ private void do_downmix() {
+ for (@LOC("SB") int sb = 0; sb < SSLIMIT; sb++) {
+ for (@LOC("SS") int ss = 0; ss < SSLIMIT; ss += 3) {
+ lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;
+ lr[0][sb][ss + 1] = (lr[0][sb][ss + 1] + lr[1][sb][ss + 1]) * 0.5f;
+ lr[0][sb][ss + 2] = (lr[0][sb][ss + 2] + lr[1][sb][ss + 2]) * 0.5f;
+ }
+ }
+ }
+
+ /**
+ * Fast INV_MDCT.
+ */
+@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")
+public void inv_mdct(@LOC("SH") float[] in, @LOC("OUT") float[] out, @LOC("IN") int block_type) {
+ //float[] win_bt;
+ @LOC("I") int i;
+
+ @LOC("TMPF") float tmpf_0;
+ @LOC("TMPF") float tmpf_1;
+ @LOC("TMPF") float tmpf_2;
+ @LOC("TMPF") float tmpf_3;
+ @LOC("TMPF") float tmpf_4;
+ @LOC("TMPF") float tmpf_5;
+ @LOC("TMPF") float tmpf_6;
+ @LOC("TMPF") float tmpf_7;
+ @LOC("TMPF") float tmpf_8;
+ @LOC("TMPF") float tmpf_9;
+ @LOC("TMPF") float tmpf_10;
+ @LOC("TMPF") float tmpf_11;
+ @LOC("TMPF") float tmpf_12;
+ @LOC("TMPF") float tmpf_13;
+ @LOC("TMPF") float tmpf_14;
+ @LOC("TMPF") float tmpf_15;
+ @LOC("TMPF") float tmpf_16;
+ @LOC("TMPF") float tmpf_17;
+
+ tmpf_0 =
+ tmpf_1 =
+ tmpf_2 =
+ tmpf_3 =
+ tmpf_4 =
+ tmpf_5 =
+ tmpf_6 =
+ tmpf_7 =
+ tmpf_8 =
+ tmpf_9 =
+ tmpf_10 =
+ tmpf_11 =
+ tmpf_12 =
+ tmpf_13 =
+ tmpf_14 =
+ tmpf_15 = tmpf_16 = tmpf_17 = 0.0f;
+
+ if (block_type == 2) {
+
+ /*
+ *
+ * Under MicrosoftVM 2922, This causes a GPF, or At best, an
+ * ArrayIndexOutOfBoundsExceptin. for(int p=0;p<36;p+=9) { out[p] =
+ * out[p+1] = out[p+2] = out[p+3] = out[p+4] = out[p+5] = out[p+6] =
+ * out[p+7] = out[p+8] = 0.0f; }
+ */
+ out[0] = 0.0f;
+ out[1] = 0.0f;
+ out[2] = 0.0f;
+ out[3] = 0.0f;
+ out[4] = 0.0f;
+ out[5] = 0.0f;
+ out[6] = 0.0f;
+ out[7] = 0.0f;
+ out[8] = 0.0f;
+ out[9] = 0.0f;
+ out[10] = 0.0f;
+ out[11] = 0.0f;
+ out[12] = 0.0f;
+ out[13] = 0.0f;
+ out[14] = 0.0f;
+ out[15] = 0.0f;
+ out[16] = 0.0f;
+ out[17] = 0.0f;
+ out[18] = 0.0f;
+ out[19] = 0.0f;
+ out[20] = 0.0f;
+ out[21] = 0.0f;
+ out[22] = 0.0f;
+ out[23] = 0.0f;
+ out[24] = 0.0f;
+ out[25] = 0.0f;
+ out[26] = 0.0f;
+ out[27] = 0.0f;
+ out[28] = 0.0f;
+ out[29] = 0.0f;
+ out[30] = 0.0f;
+ out[31] = 0.0f;
+ out[32] = 0.0f;
+ out[33] = 0.0f;
+ out[34] = 0.0f;
+ out[35] = 0.0f;
+
+ @LOC("6I") int six_i = 0;
+
+ for (i = 0; i < 3; i++) {
+ // 12 point IMDCT
+ // Begin 12 point IDCT
+ // Input aliasing for 12 pt IDCT
+ in[15 + i] += in[12 + i];
+ in[12 + i] += in[9 + i];
+ in[9 + i] += in[6 + i];
+ in[6 + i] += in[3 + i];
+ in[3 + i] += in[0 + i];
+
+ // Input aliasing on odd indices (for 6 point IDCT)
+ in[15 + i] += in[9 + i];
+ in[9 + i] += in[3 + i];
+
+ // 3 point IDCT on even indices
+ @LOC("PP") float pp1;
+ @LOC("PP") float pp2;
+ @LOC("SUM") float sum;
+ pp2 = in[12 + i] * 0.500000000f;
+ pp1 = in[6 + i] * 0.866025403f;
+ sum = in[0 + i] + pp2;
+ tmpf_1 = in[0 + i] - in[12 + i];
+ tmpf_0 = sum + pp1;
+ tmpf_2 = sum - pp1;
+
+ // End 3 point IDCT on even indices
+ // 3 point IDCT on odd indices (for 6 point IDCT)
+ pp2 = in[15 + i] * 0.500000000f;
+ pp1 = in[9 + i] * 0.866025403f;
+ sum = in[3 + i] + pp2;
+ tmpf_4 = in[3 + i] - in[15 + i];
+ tmpf_5 = sum + pp1;
+ tmpf_3 = sum - pp1;
+ // End 3 point IDCT on odd indices
+ // Twiddle factors on odd indices (for 6 point IDCT)
+
+ tmpf_3 *= 1.931851653f;
+ tmpf_4 *= 0.707106781f;
+ tmpf_5 *= 0.517638090f;
+
+ // Output butterflies on 2 3 point IDCT's (for 6 point IDCT)
+ @LOC("SH") float save = tmpf_0;
+ tmpf_0 += tmpf_5;
+ tmpf_5 = save - tmpf_5;
+ save = tmpf_1;
+ tmpf_1 += tmpf_4;
+ tmpf_4 = save - tmpf_4;
+ save = tmpf_2;
+ tmpf_2 += tmpf_3;
+ tmpf_3 = save - tmpf_3;
+
+ // End 6 point IDCT
+ // Twiddle factors on indices (for 12 point IDCT)
+
+ tmpf_0 *= 0.504314480f;
+ tmpf_1 *= 0.541196100f;
+ tmpf_2 *= 0.630236207f;
+ tmpf_3 *= 0.821339815f;
+ tmpf_4 *= 1.306562965f;
+ tmpf_5 *= 3.830648788f;
+
+ // End 12 point IDCT
+
+ // Shift to 12 point modified IDCT, multiply by window type 2
+ tmpf_8 = -tmpf_0 * 0.793353340f;
+ tmpf_9 = -tmpf_0 * 0.608761429f;
+ tmpf_7 = -tmpf_1 * 0.923879532f;
+ tmpf_10 = -tmpf_1 * 0.382683432f;
+ tmpf_6 = -tmpf_2 * 0.991444861f;
+ tmpf_11 = -tmpf_2 * 0.130526192f;
+
+ tmpf_0 = tmpf_3;
+ tmpf_1 = tmpf_4 * 0.382683432f;
+ tmpf_2 = tmpf_5 * 0.608761429f;
+
+ tmpf_3 = -tmpf_5 * 0.793353340f;
+ tmpf_4 = -tmpf_4 * 0.923879532f;
+ tmpf_5 = -tmpf_0 * 0.991444861f;
+
+ tmpf_0 *= 0.130526192f;
+
+ out[six_i + 6] += tmpf_0;
+ out[six_i + 7] += tmpf_1;
+ out[six_i + 8] += tmpf_2;
+ out[six_i + 9] += tmpf_3;
+ out[six_i + 10] += tmpf_4;
+ out[six_i + 11] += tmpf_5;
+ out[six_i + 12] += tmpf_6;
+ out[six_i + 13] += tmpf_7;
+ out[six_i + 14] += tmpf_8;
+ out[six_i + 15] += tmpf_9;
+ out[six_i + 16] += tmpf_10;
+ out[six_i + 17] += tmpf_11;
+
+ six_i += 6;
+ }
+ } else {
+ // 36 point IDCT
+ // input aliasing for 36 point IDCT
+ in[17] += in[16];
+ in[16] += in[15];
+ in[15] += in[14];
+ in[14] += in[13];
+ in[13] += in[12];
+ in[12] += in[11];
+ in[11] += in[10];
+ in[10] += in[9];
+ in[9] += in[8];
+ in[8] += in[7];
+ in[7] += in[6];
+ in[6] += in[5];
+ in[5] += in[4];
+ in[4] += in[3];
+ in[3] += in[2];
+ in[2] += in[1];
+ in[1] += in[0];
+
+ // 18 point IDCT for odd indices
+ // input aliasing for 18 point IDCT
+ in[17] += in[15];
+ in[15] += in[13];
+ in[13] += in[11];
+ in[11] += in[9];
+ in[9] += in[7];
+ in[7] += in[5];
+ in[5] += in[3];
+ in[3] += in[1];
+
+ @LOC("TMP") float tmp0;
+ @LOC("TMP") float tmp1;
+ @LOC("TMP") float tmp2;
+ @LOC("TMP") float tmp3;
+ @LOC("TMP") float tmp4;
+ @LOC("TMP") float tmp0_;
+ @LOC("TMP") float tmp1_;
+ @LOC("TMP") float tmp2_;
+ @LOC("TMP") float tmp3_;
+ @LOC("TMP") float tmp0o;
+ @LOC("TMP") float tmp1o;
+ @LOC("TMP") float tmp2o;
+ @LOC("TMP") float tmp3o;
+ @LOC("TMP") float tmp4o;
+ @LOC("TMP") float tmp0_o;
+ @LOC("TMP") float tmp1_o;
+ @LOC("TMP") float tmp2_o;
+ @LOC("TMP") float tmp3_o;
+
+ // Fast 9 Point Inverse Discrete Cosine Transform
+ //
+ // By Francois-Raymond Boyer
+ // mailto:boyerf@iro.umontreal.ca
+ // http://www.iro.umontreal.ca/~boyerf
+ //
+ // The code has been optimized for Intel processors
+ // (takes a lot of time to convert float to and from iternal FPU
+ // representation)
+ //
+ // It is a simple "factorization" of the IDCT matrix.
+
+ // 9 point IDCT on even indices
+
+ // 5 points on odd indices (not realy an IDCT)
+ @LOC("I00") float i00 = in[0] + in[0];
+ @LOC("IIP") float iip12 = i00 + in[12];
+
+ tmp0 =
+ iip12 + in[4] * 1.8793852415718f + in[8] * 1.532088886238f + in[16] * 0.34729635533386f;
+ tmp1 = i00 + in[4] - in[8] - in[12] - in[12] - in[16];
+ tmp2 =
+ iip12 - in[4] * 0.34729635533386f - in[8] * 1.8793852415718f + in[16] * 1.532088886238f;
+ tmp3 =
+ iip12 - in[4] * 1.532088886238f + in[8] * 0.34729635533386f - in[16] * 1.8793852415718f;
+ tmp4 = in[0] - in[4] + in[8] - in[12] + in[16];
+
+ // 4 points on even indices
+ @LOC("I00") float i66_ = in[6] * 1.732050808f; // Sqrt[3]
+
+ tmp0_ =
+ in[2] * 1.9696155060244f + i66_ + in[10] * 1.2855752193731f + in[14] * 0.68404028665134f;
+ tmp1_ = (in[2] - in[10] - in[14]) * 1.732050808f;
+ tmp2_ =
+ in[2] * 1.2855752193731f - i66_ - in[10] * 0.68404028665134f + in[14] * 1.9696155060244f;
+ tmp3_ =
+ in[2] * 0.68404028665134f - i66_ + in[10] * 1.9696155060244f - in[14] * 1.2855752193731f;
+
+ // 9 point IDCT on odd indices
+ // 5 points on odd indices (not realy an IDCT)
+ @LOC("I00") float i0 = in[0 + 1] + in[0 + 1];
+ @LOC("IIP") float i0p12 = i0 + in[12 + 1];
+
+ tmp0o =
+ i0p12 + in[4 + 1] * 1.8793852415718f + in[8 + 1] * 1.532088886238f + in[16 + 1]
+ * 0.34729635533386f;
+ tmp1o = i0 + in[4 + 1] - in[8 + 1] - in[12 + 1] - in[12 + 1] - in[16 + 1];
+ tmp2o =
+ i0p12 - in[4 + 1] * 0.34729635533386f - in[8 + 1] * 1.8793852415718f + in[16 + 1]
+ * 1.532088886238f;
+ tmp3o =
+ i0p12 - in[4 + 1] * 1.532088886238f + in[8 + 1] * 0.34729635533386f - in[16 + 1]
+ * 1.8793852415718f;
+ tmp4o = (in[0 + 1] - in[4 + 1] + in[8 + 1] - in[12 + 1] + in[16 + 1]) * 0.707106781f; // Twiddled
+
+ // 4 points on even indices
+ @LOC("I00") float i6_ = in[6 + 1] * 1.732050808f; // Sqrt[3]
+
+ tmp0_o =
+ in[2 + 1] * 1.9696155060244f + i6_ + in[10 + 1] * 1.2855752193731f + in[14 + 1]
+ * 0.68404028665134f;
+ tmp1_o = (in[2 + 1] - in[10 + 1] - in[14 + 1]) * 1.732050808f;
+ tmp2_o =
+ in[2 + 1] * 1.2855752193731f - i6_ - in[10 + 1] * 0.68404028665134f + in[14 + 1]
+ * 1.9696155060244f;
+ tmp3_o =
+ in[2 + 1] * 0.68404028665134f - i6_ + in[10 + 1] * 1.9696155060244f - in[14 + 1]
+ * 1.2855752193731f;
+
+ // Twiddle factors on odd indices
+ // and
+ // Butterflies on 9 point IDCT's
+ // and
+ // twiddle factors for 36 point IDCT
+
+ @LOC("EO") float e;
+ @LOC("EO") float o;
+ e = tmp0 + tmp0_;
+ o = (tmp0o + tmp0_o) * 0.501909918f;
+ tmpf_0 = e + o;
+ tmpf_17 = e - o;
+ e = tmp1 + tmp1_;
+ o = (tmp1o + tmp1_o) * 0.517638090f;
+ tmpf_1 = e + o;
+ tmpf_16 = e - o;
+ e = tmp2 + tmp2_;
+ o = (tmp2o + tmp2_o) * 0.551688959f;
+ tmpf_2 = e + o;
+ tmpf_15 = e - o;
+ e = tmp3 + tmp3_;
+ o = (tmp3o + tmp3_o) * 0.610387294f;
+ tmpf_3 = e + o;
+ tmpf_14 = e - o;
+ tmpf_4 = tmp4 + tmp4o;
+ tmpf_13 = tmp4 - tmp4o;
+ e = tmp3 - tmp3_;
+ o = (tmp3o - tmp3_o) * 0.871723397f;
+ tmpf_5 = e + o;
+ tmpf_12 = e - o;
+ e = tmp2 - tmp2_;
+ o = (tmp2o - tmp2_o) * 1.183100792f;
+ tmpf_6 = e + o;
+ tmpf_11 = e - o;
+ e = tmp1 - tmp1_;
+ o = (tmp1o - tmp1_o) * 1.931851653f;
+ tmpf_7 = e + o;
+ tmpf_10 = e - o;
+ e = tmp0 - tmp0_;
+ o = (tmp0o - tmp0_o) * 5.736856623f;
+ tmpf_8 = e + o;
+ tmpf_9 = e - o;
+
+ // end 36 point IDCT */
+ // shift to modified IDCT
+ //win_bt = win[block_type]; //substituted this so that a new area does not become created
+
+ out[0] = -tmpf_9 * win[block_type][0];
+ out[1] = -tmpf_10 * win[block_type][1];
+ out[2] = -tmpf_11 * win[block_type][2];
+ out[3] = -tmpf_12 * win[block_type][3];
+ out[4] = -tmpf_13 * win[block_type][4];
+ out[5] = -tmpf_14 * win[block_type][5];
+ out[6] = -tmpf_15 * win[block_type][6];
+ out[7] = -tmpf_16 * win[block_type][7];
+ out[8] = -tmpf_17 * win[block_type][8];
+ out[9] = tmpf_17 * win[block_type][9];
+ out[10] = tmpf_16 * win[block_type][10];
+ out[11] = tmpf_15 * win[block_type][11];
+ out[12] = tmpf_14 * win[block_type][12];
+ out[13] = tmpf_13 * win[block_type][13];
+ out[14] = tmpf_12 * win[block_type][14];
+ out[15] = tmpf_11 * win[block_type][15];
+ out[16] = tmpf_10 * win[block_type][16];
+ out[17] = tmpf_9 * win[block_type][17];
+ out[18] = tmpf_8 * win[block_type][18];
+ out[19] = tmpf_7 * win[block_type][19];
+ out[20] = tmpf_6 * win[block_type][20];
+ out[21] = tmpf_5 * win[block_type][21];
+ out[22] = tmpf_4 * win[block_type][22];
+ out[23] = tmpf_3 * win[block_type][23];
+ out[24] = tmpf_2 * win[block_type][24];
+ out[25] = tmpf_1 * win[block_type][25];
+ out[26] = tmpf_0 * win[block_type][26];
+ out[27] = tmpf_0 * win[block_type][27];
+ out[28] = tmpf_1 * win[block_type][28];
+ out[29] = tmpf_2 * win[block_type][29];
+ out[30] = tmpf_3 * win[block_type][30];
+ out[31] = tmpf_4 * win[block_type][31];
+ out[32] = tmpf_5 * win[block_type][32];
+ out[33] = tmpf_6 * win[block_type][33];
+ out[34] = tmpf_7 * win[block_type][34];
+ out[35] = tmpf_8 * win[block_type][35];
+ }
+ }
+
+ @LOC("C") private int counter = 0;
+ @LOC("F") private static final int SSLIMIT = 18;
+ @LOC("F") private static final int SBLIMIT = 32;
+
+ // Size of the table of whole numbers raised to 4/3 power.
+ // This may be adjusted for performance without any problems.
+ // public static final int POW_TABLE_LIMIT=512;
+
+ /************************************************************/
+ /* L3TABLE */
+ /************************************************************/
+
+ @LATTICE("N<VAR")
+ static class SBI {
+ @LOC("VAR") public int[] l;
+ @LOC("VAR") public int[] s;
+
+ public SBI() {
+ l = new int[23];
+ s = new int[14];
+ }
+ @LATTICE("THIS<IN,THISLOC=THIS")
+ public SBI(@LOC("IN") int[] thel, @LOC("IN") int[] thes) {
+ l = thel;
+ s = thes;
+ }
+ }
+ @LATTICE("N<VAR")
+ static class gr_info_s {
+ @LOC("VAR") public int part2_3_length = 0;
+ @LOC("VAR") public int big_values = 0;
+ @LOC("VAR") public int global_gain = 0;
+ @LOC("VAR") public int scalefac_compress = 0;
+ @LOC("VAR") public int window_switching_flag = 0;
+ @LOC("VAR") public int block_type = 0;
+ @LOC("VAR") public int mixed_block_flag = 0;
+ @LOC("VAR") public int[] table_select;
+ @LOC("VAR") public int[] subblock_gain;
+ @LOC("VAR") public int region0_count = 0;
+ @LOC("VAR") public int region1_count = 0;
+ @LOC("VAR") public int preflag = 0;
+ @LOC("VAR") public int scalefac_scale = 0;
+ @LOC("VAR") public int count1table_select = 0;
+
+ /**
+ * Dummy Constructor
+ */
+ public gr_info_s() {
+ table_select = new int[3];
+ subblock_gain = new int[3];
+ }
+ }
+
+ @LATTICE("N<VAR")
+ static class temporaire {
+ @LOC("VAR") public int[] scfsi;
+ @LOC("VAR") public gr_info_s[] gr;
+
+ /**
+ * Dummy Constructor
+ */
+ public temporaire() {
+ scfsi = new int[4];
+ gr = new gr_info_s[2];
+ gr[0] = new gr_info_s();
+ gr[1] = new gr_info_s();
+ }
+ }
+
+ @LATTICE("N<VAR")
+ static class III_side_info_t {
+
+ @LOC("VAR") public int main_data_begin = 0;
+ @LOC("VAR") public int private_bits = 0;
+ @LOC("VAR") public temporaire[] ch;
+
+ /**
+ * Dummy Constructor
+ */
+ public III_side_info_t() {
+ ch = new temporaire[2];
+ ch[0] = new temporaire();
+ ch[1] = new temporaire();
+ }
+ }
+
+ @LATTICE("N<VAR")
+ static class temporaire2 {
+ @LOC("VAR") public int[] l; /* [cb] */
+ @LOC("VAR") public int[][] s; /* [window][cb] */
+
+ /**
+ * Dummy Constructor
+ */
+ public temporaire2() {
+ l = new int[23];
+ s = new int[3][13];
+ }
+ }
+
+ // class III_scalefac_t
+ // {
+ // public temporaire2[] tab;
+ // /**
+ // * Dummy Constructor
+ // */
+ // public III_scalefac_t()
+ // {
+ // tab = new temporaire2[2];
+ // }
+ // }
+
+ @LOC("F") private static final int slen[][] = { { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
+ { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 } };
+
+ @LOC("F") 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,
+ 2, 0 };
+
+ @LOC("F") private SBI[] sfBandIndex; // Init in the constructor.
+
+ @LOC("F") public static final float two_to_negative_half_pow[] = { 1.0000000000E+00f, 7.0710678119E-01f,
+ 5.0000000000E-01f, 3.5355339059E-01f, 2.5000000000E-01f, 1.7677669530E-01f,
+ 1.2500000000E-01f, 8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f,
+ 3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f, 1.1048543456E-02f,
+ 7.8125000000E-03f, 5.5242717280E-03f, 3.9062500000E-03f, 2.7621358640E-03f,
+ 1.9531250000E-03f, 1.3810679320E-03f, 9.7656250000E-04f, 6.9053396600E-04f,
+ 4.8828125000E-04f, 3.4526698300E-04f, 2.4414062500E-04f, 1.7263349150E-04f,
+ 1.2207031250E-04f, 8.6316745750E-05f, 6.1035156250E-05f, 4.3158372875E-05f,
+ 3.0517578125E-05f, 2.1579186438E-05f, 1.5258789062E-05f, 1.0789593219E-05f,
+ 7.6293945312E-06f, 5.3947966094E-06f, 3.8146972656E-06f, 2.6973983047E-06f,
+ 1.9073486328E-06f, 1.3486991523E-06f, 9.5367431641E-07f, 6.7434957617E-07f,
+ 4.7683715820E-07f, 3.3717478809E-07f, 2.3841857910E-07f, 1.6858739404E-07f,
+ 1.1920928955E-07f, 8.4293697022E-08f, 5.9604644775E-08f, 4.2146848511E-08f,
+ 2.9802322388E-08f, 2.1073424255E-08f, 1.4901161194E-08f, 1.0536712128E-08f,
+ 7.4505805969E-09f, 5.2683560639E-09f, 3.7252902985E-09f, 2.6341780319E-09f,
+ 1.8626451492E-09f, 1.3170890160E-09f, 9.3132257462E-10f, 6.5854450798E-10f,
+ 4.6566128731E-10f, 3.2927225399E-10f };
+
+ @LOC("F") public static final float t_43[] = create_t_43();
+
+ @RETURNLOC("OUT")
+ static private float[] create_t_43() {
+ @LOC("OUT") float[] t43 = new float[8192];
+ final double d43 = (4.0 / 3.0);
+
+ for (@LOC("SH") int i = 0; i < 8192; i++) {
+ t43[i] = (float) Math.pow(i, d43);
+ }
+ return t43;
+ }
+
+ @LOC("F") public static final float io[][] = {
+ { 1.0000000000E+00f, 8.4089641526E-01f, 7.0710678119E-01f, 5.9460355751E-01f,
+ 5.0000000001E-01f, 4.2044820763E-01f, 3.5355339060E-01f, 2.9730177876E-01f,
+ 2.5000000001E-01f, 2.1022410382E-01f, 1.7677669530E-01f, 1.4865088938E-01f,
+ 1.2500000000E-01f, 1.0511205191E-01f, 8.8388347652E-02f, 7.4325444691E-02f,
+ 6.2500000003E-02f, 5.2556025956E-02f, 4.4194173826E-02f, 3.7162722346E-02f,
+ 3.1250000002E-02f, 2.6278012978E-02f, 2.2097086913E-02f, 1.8581361173E-02f,
+ 1.5625000001E-02f, 1.3139006489E-02f, 1.1048543457E-02f, 9.2906805866E-03f,
+ 7.8125000006E-03f, 6.5695032447E-03f, 5.5242717285E-03f, 4.6453402934E-03f },
+ { 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f, 3.5355339060E-01f,
+ 2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f, 8.8388347650E-02f,
+ 6.2500000001E-02f, 4.4194173825E-02f, 3.1250000001E-02f, 2.2097086913E-02f,
+ 1.5625000000E-02f, 1.1048543456E-02f, 7.8125000002E-03f, 5.5242717282E-03f,
+ 3.9062500001E-03f, 2.7621358641E-03f, 1.9531250001E-03f, 1.3810679321E-03f,
+ 9.7656250004E-04f, 6.9053396603E-04f, 4.8828125002E-04f, 3.4526698302E-04f,
+ 2.4414062501E-04f, 1.7263349151E-04f, 1.2207031251E-04f, 8.6316745755E-05f,
+ 6.1035156254E-05f, 4.3158372878E-05f, 3.0517578127E-05f, 2.1579186439E-05f } };
+
+ @LOC("F") public static final float TAN12[] = { 0.0f, 0.26794919f, 0.57735027f, 1.0f, 1.73205081f,
+ 3.73205081f, 9.9999999e10f, -3.73205081f, -1.73205081f, -1.0f, -0.57735027f, -0.26794919f,
+ 0.0f, 0.26794919f, 0.57735027f, 1.0f };
+
+ // REVIEW: in java, the array lookup may well be slower than
+ // the actual calculation
+ // 576 / 18
+ /*
+ * private static final int ss_div[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ * 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,
+ * 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,
+ * 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,
+ * 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,
+ * 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,
+ * 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,
+ * 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
+ * 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
+ * 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ * 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
+ * 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ * 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ * 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ * 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ * 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ * 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ * 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ * 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ * 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ * 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ * 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25,
+ * 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26,
+ * 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27,
+ * 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28,
+ * 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29,
+ * 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30,
+ * 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31,
+ * 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 };
+ *
+ * // 576 % 18 private static final int ss_mod[] = { 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17 };
+ */
+ @LOC("F") private static/* final */int reorder_table[][]/* = loadReorderTable() */; // SZD:
+ // will
+ // be
+ // generated
+ // on
+ // demand
+
+ /**
+ * Loads the data for the reorder
+ */
+ /*
+ * private static int[][] loadReorderTable() // SZD: table will be generated {
+ * try { Class elemType = int[][].class.getComponentType(); Object o =
+ * JavaLayerUtils.deserializeArrayResource("l3reorder.ser", elemType, 6);
+ * return (int[][])o; } catch (IOException ex) { throw new
+ * ExceptionInInitializerError(ex); } }
+ */
+ @LATTICE("OUT<J,J<I,I<SE,I<WIN,SE<SF,SE<SFB,WIN<SFB,J*,I*,WIN*,SFB*")
+ static int[] reorder(@LOC("SF") int scalefac_band[]) { // SZD: converted from LAME
+ @LOC("J") int j = 0;
+ @LOC("OUT") int ix[] = new int[576];
+ for (int sfb = 0; sfb < 13; sfb++) {
+ int start = scalefac_band[sfb];
+ int end = scalefac_band[sfb + 1];
+ for (int window = 0; window < 3; window++)
+ for (int i = start; i < end; i++)
+ ix[3 * i + window] = j++;
+ }
+ return ix;
+ }
+
+ /*
+ * static final int reorder_table_data[][]; = { { 0, 4, 8, 1, 5, 9, 2, 6, 10,
+ * 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25,
+ * 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49, 38, 44, 50, 39, 45,
+ * 51, 40, 46, 52, 41, 47, 53, 54, 60, 66, 55, 61, 67, 56, 62, 68, 57, 63, 69,
+ * 58, 64, 70, 59, 65, 71, 72, 80, 88, 73, 81, 89, 74, 82, 90, 75, 83, 91, 76,
+ * 84, 92, 77, 85, 93, 78, 86, 94, 79, 87, 95, 96,106,116, 97,107,117,
+ * 98,108,118, 99,109,119,100,110,120,101,
+ * 111,121,102,112,122,103,113,123,104,114,124,105,115,125,126,140,
+ * 154,127,141,155,128,142,156,129,143,157,130,144,158,131,145,159,
+ * 132,146,160,133,147,161,134,148,162,135,149,163,136,150,164,137,
+ * 151,165,138,152,166,139,153,167,168,186,204,169,187,205,170,188,
+ * 206,171,189,207,172,190,208,173,191,209,174,192,210,175,193,211,
+ * 176,194,212,177,195,213,178,196,214,179,197,215,180,198,216,181,
+ * 199,217,182,200,218,183,201,219,184,202,220,185,203,221,222,248,
+ * 274,223,249,275,224,250,276,225,251,277,226,252,278,227,253,279,
+ * 228,254,280,229,255,281,230,256,282,231,257,283,232,258,284,233,
+ * 259,285,234,260,286,235,261,287,236,262,288,237,263,289,238,264,
+ * 290,239,265,291,240,266,292,241,267,293,242,268,294,243,269,295,
+ * 244,270,296,245,271,297,246,272,298,247,273,299,300,332,364,301,
+ * 333,365,302,334,366,303,335,367,304,336,368,305,337,369,306,338,
+ * 370,307,339,371,308,340,372,309,341,373,310,342,374,311,343,375,
+ * 312,344,376,313,345,377,314,346,378,315,347,379,316,348,380,317,
+ * 349,381,318,350,382,319,351,383,320,352,384,321,353,385,322,354,
+ * 386,323,355,387,324,356,388,325,357,389,326,358,390,327,359,391,
+ * 328,360,392,329,361,393,330,362,394,331,363,395,396,438,480,397,
+ * 439,481,398,440,482,399,441,483,400,442,484,401,443,485,402,444,
+ * 486,403,445,487,404,446,488,405,447,489,406,448,490,407,449,491,
+ * 408,450,492,409,451,493,410,452,494,411,453,495,412,454,496,413,
+ * 455,497,414,456,498,415,457,499,416,458,500,417,459,501,418,460,
+ * 502,419,461,503,420,462,504,421,463,505,422,464,506,423,465,507,
+ * 424,466,508,425,467,509,426,468,510,427,469,511,428,470,512,429,
+ * 471,513,430,472,514,431,473,515,432,474,516,433,475,517,434,476,
+ * 518,435,477,519,436,478,520,437,479,521,522,540,558,523,541,559,
+ * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
+ * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
+ * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
+ * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
+ * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
+ * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
+ * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
+ * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
+ * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
+ * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
+ * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
+ * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
+ * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
+ * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
+ * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
+ * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
+ * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
+ * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
+ * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
+ * 285,309,262,286,310,263,287,311,312,344,376,313,345,377,314,346,
+ * 378,315,347,379,316,348,380,317,349,381,318,350,382,319,351,383,
+ * 320,352,384,321,353,385,322,354,386,323,355,387,324,356,388,325,
+ * 357,389,326,358,390,327,359,391,328,360,392,329,361,393,330,362,
+ * 394,331,363,395,332,364,396,333,365,397,334,366,398,335,367,399,
+ * 336,368,400,337,369,401,338,370,402,339,371,403,340,372,404,341,
+ * 373,405,342,374,406,343,375,407,408,452,496,409,453,497,410,454,
+ * 498,411,455,499,412,456,500,413,457,501,414,458,502,415,459,503,
+ * 416,460,504,417,461,505,418,462,506,419,463,507,420,464,508,421,
+ * 465,509,422,466,510,423,467,511,424,468,512,425,469,513,426,470,
+ * 514,427,471,515,428,472,516,429,473,517,430,474,518,431,475,519,
+ * 432,476,520,433,477,521,434,478,522,435,479,523,436,480,524,437,
+ * 481,525,438,482,526,439,483,527,440,484,528,441,485,529,442,486,
+ * 530,443,487,531,444,488,532,445,489,533,446,490,534,447,491,535,
+ * 448,492,536,449,493,537,450,494,538,451,495,539,540,552,564,541,
+ * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
+ * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
+ * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
+ * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
+ * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
+ * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
+ * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
+ * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
+ * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
+ * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
+ * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
+ * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
+ * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
+ * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
+ * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
+ * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
+ * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
+ * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
+ * 285,309,262,286,310,263,287,311,312,342,372,313,343,373,314,344,
+ * 374,315,345,375,316,346,376,317,347,377,318,348,378,319,349,379,
+ * 320,350,380,321,351,381,322,352,382,323,353,383,324,354,384,325,
+ * 355,385,326,356,386,327,357,387,328,358,388,329,359,389,330,360,
+ * 390,331,361,391,332,362,392,333,363,393,334,364,394,335,365,395,
+ * 336,366,396,337,367,397,338,368,398,339,369,399,340,370,400,341,
+ * 371,401,402,442,482,403,443,483,404,444,484,405,445,485,406,446,
+ * 486,407,447,487,408,448,488,409,449,489,410,450,490,411,451,491,
+ * 412,452,492,413,453,493,414,454,494,415,455,495,416,456,496,417,
+ * 457,497,418,458,498,419,459,499,420,460,500,421,461,501,422,462,
+ * 502,423,463,503,424,464,504,425,465,505,426,466,506,427,467,507,
+ * 428,468,508,429,469,509,430,470,510,431,471,511,432,472,512,433,
+ * 473,513,434,474,514,435,475,515,436,476,516,437,477,517,438,478,
+ * 518,439,479,519,440,480,520,441,481,521,522,540,558,523,541,559,
+ * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
+ * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
+ * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
+ * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,100,110, 91,101,111, 92,102,112,
+ * 93,103,113, 94,104,114, 95,105,115, 96,106,116, 97, 107,117, 98,108,118,
+ * 99,109,119,120,132,144,121,133,145,122,134,
+ * 146,123,135,147,124,136,148,125,137,149,126,138,150,127,139,151,
+ * 128,140,152,129,141,153,130,142,154,131,143,155,156,170,184,157,
+ * 171,185,158,172,186,159,173,187,160,174,188,161,175,189,162,176,
+ * 190,163,177,191,164,178,192,165,179,193,166,180,194,167,181,195,
+ * 168,182,196,169,183,197,198,216,234,199,217,235,200,218,236,201,
+ * 219,237,202,220,238,203,221,239,204,222,240,205,223,241,206,224,
+ * 242,207,225,243,208,226,244,209,227,245,210,228,246,211,229,247,
+ * 212,230,248,213,231,249,214,232,250,215,233,251,252,274,296,253,
+ * 275,297,254,276,298,255,277,299,256,278,300,257,279,301,258,280,
+ * 302,259,281,303,260,282,304,261,283,305,262,284,306,263,285,307,
+ * 264,286,308,265,287,309,266,288,310,267,289,311,268,290,312,269,
+ * 291,313,270,292,314,271,293,315,272,294,316,273,295,317,318,348,
+ * 378,319,349,379,320,350,380,321,351,381,322,352,382,323,353,383,
+ * 324,354,384,325,355,385,326,356,386,327,357,387,328,358,388,329,
+ * 359,389,330,360,390,331,361,391,332,362,392,333,363,393,334,364,
+ * 394,335,365,395,336,366,396,337,367,397,338,368,398,339,369,399,
+ * 340,370,400,341,371,401,342,372,402,343,373,403,344,374,404,345,
+ * 375,405,346,376,406,347,377,407,408,464,520,409,465,521,410,466,
+ * 522,411,467,523,412,468,524,413,469,525,414,470,526,415,471,527,
+ * 416,472,528,417,473,529,418,474,530,419,475,531,420,476,532,421,
+ * 477,533,422,478,534,423,479,535,424,480,536,425,481,537,426,482,
+ * 538,427,483,539,428,484,540,429,485,541,430,486,542,431,487,543,
+ * 432,488,544,433,489,545,434,490,546,435,491,547,436,492,548,437,
+ * 493,549,438,494,550,439,495,551,440,496,552,441,497,553,442,498,
+ * 554,443,499,555,444,500,556,445,501,557,446,502,558,447,503,559,
+ * 448,504,560,449,505,561,450,506,562,451,507,563,452,508,564,453,
+ * 509,565,454,510,566,455,511,567,456,512,568,457,513,569,458,514,
+ * 570,459,515,571,460,516,572,461,517,573,462,518,574,463,519,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69, 75, 81, 70, 76,
+ * 82, 71, 77, 83, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107, 88, 98,108,
+ * 89, 99,109, 90,100,110, 91,101,111, 92,102,112, 93,
+ * 103,113,114,126,138,115,127,139,116,128,140,117,129,141,118,130,
+ * 142,119,131,143,120,132,144,121,133,145,122,134,146,123,135,147,
+ * 124,136,148,125,137,149,150,164,178,151,165,179,152,166,180,153,
+ * 167,181,154,168,182,155,169,183,156,170,184,157,171,185,158,172,
+ * 186,159,173,187,160,174,188,161,175,189,162,176,190,163,177,191,
+ * 192,208,224,193,209,225,194,210,226,195,211,227,196,212,228,197,
+ * 213,229,198,214,230,199,215,231,200,216,232,201,217,233,202,218,
+ * 234,203,219,235,204,220,236,205,221,237,206,222,238,207,223,239,
+ * 240,260,280,241,261,281,242,262,282,243,263,283,244,264,284,245,
+ * 265,285,246,266,286,247,267,287,248,268,288,249,269,289,250,270,
+ * 290,251,271,291,252,272,292,253,273,293,254,274,294,255,275,295,
+ * 256,276,296,257,277,297,258,278,298,259,279,299,300,326,352,301,
+ * 327,353,302,328,354,303,329,355,304,330,356,305,331,357,306,332,
+ * 358,307,333,359,308,334,360,309,335,361,310,336,362,311,337,363,
+ * 312,338,364,313,339,365,314,340,366,315,341,367,316,342,368,317,
+ * 343,369,318,344,370,319,345,371,320,346,372,321,347,373,322,348,
+ * 374,323,349,375,324,350,376,325,351,377,378,444,510,379,445,511,
+ * 380,446,512,381,447,513,382,448,514,383,449,515,384,450,516,385,
+ * 451,517,386,452,518,387,453,519,388,454,520,389,455,521,390,456,
+ * 522,391,457,523,392,458,524,393,459,525,394,460,526,395,461,527,
+ * 396,462,528,397,463,529,398,464,530,399,465,531,400,466,532,401,
+ * 467,533,402,468,534,403,469,535,404,470,536,405,471,537,406,472,
+ * 538,407,473,539,408,474,540,409,475,541,410,476,542,411,477,543,
+ * 412,478,544,413,479,545,414,480,546,415,481,547,416,482,548,417,
+ * 483,549,418,484,550,419,485,551,420,486,552,421,487,553,422,488,
+ * 554,423,489,555,424,490,556,425,491,557,426,492,558,427,493,559,
+ * 428,494,560,429,495,561,430,496,562,431,497,563,432,498,564,433,
+ * 499,565,434,500,566,435,501,567,436,502,568,437,503,569,438,504,
+ * 570,439,505,571,440,506,572,441,507,573,442,508,574,443,509,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
+ * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,102,114, 91,103,115, 92,104,116,
+ * 93,105,117, 94,106,118, 95,107,119, 96,108,120, 97, 109,121, 98,110,122,
+ * 99,111,123,100,112,124,101,113,125,126,142,
+ * 158,127,143,159,128,144,160,129,145,161,130,146,162,131,147,163,
+ * 132,148,164,133,149,165,134,150,166,135,151,167,136,152,168,137,
+ * 153,169,138,154,170,139,155,171,140,156,172,141,157,173,174,194,
+ * 214,175,195,215,176,196,216,177,197,217,178,198,218,179,199,219,
+ * 180,200,220,181,201,221,182,202,222,183,203,223,184,204,224,185,
+ * 205,225,186,206,226,187,207,227,188,208,228,189,209,229,190,210,
+ * 230,191,211,231,192,212,232,193,213,233,234,260,286,235,261,287,
+ * 236,262,288,237,263,289,238,264,290,239,265,291,240,266,292,241,
+ * 267,293,242,268,294,243,269,295,244,270,296,245,271,297,246,272,
+ * 298,247,273,299,248,274,300,249,275,301,250,276,302,251,277,303,
+ * 252,278,304,253,279,305,254,280,306,255,281,307,256,282,308,257,
+ * 283,309,258,284,310,259,285,311,312,346,380,313,347,381,314,348,
+ * 382,315,349,383,316,350,384,317,351,385,318,352,386,319,353,387,
+ * 320,354,388,321,355,389,322,356,390,323,357,391,324,358,392,325,
+ * 359,393,326,360,394,327,361,395,328,362,396,329,363,397,330,364,
+ * 398,331,365,399,332,366,400,333,367,401,334,368,402,335,369,403,
+ * 336,370,404,337,371,405,338,372,406,339,373,407,340,374,408,341,
+ * 375,409,342,376,410,343,377,411,344,378,412,345,379,413,414,456,
+ * 498,415,457,499,416,458,500,417,459,501,418,460,502,419,461,503,
+ * 420,462,504,421,463,505,422,464,506,423,465,507,424,466,508,425,
+ * 467,509,426,468,510,427,469,511,428,470,512,429,471,513,430,472,
+ * 514,431,473,515,432,474,516,433,475,517,434,476,518,435,477,519,
+ * 436,478,520,437,479,521,438,480,522,439,481,523,440,482,524,441,
+ * 483,525,442,484,526,443,485,527,444,486,528,445,487,529,446,488,
+ * 530,447,489,531,448,490,532,449,491,533,450,492,534,451,493,535,
+ * 452,494,536,453,495,537,454,496,538,455,497,539,540,552,564,541,
+ * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
+ * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575} };
+ */
+
+ @LOC("F") private static final float cs[] = { 0.857492925712f, 0.881741997318f, 0.949628649103f,
+ 0.983314592492f, 0.995517816065f, 0.999160558175f, 0.999899195243f, 0.999993155067f };
+
+ @LOC("F") private static final float ca[] = { -0.5144957554270f, -0.4717319685650f, -0.3133774542040f,
+ -0.1819131996110f, -0.0945741925262f, -0.0409655828852f, -0.0141985685725f,
+ -0.00369997467375f };
+
+ /************************************************************/
+ /* END OF L3TABLE */
+ /************************************************************/
+
+ /************************************************************/
+ /* L3TYPE */
+ /************************************************************/
+
+ /***************************************************************/
+ /* END OF L3TYPE */
+ /***************************************************************/
+
+ /***************************************************************/
+ /* INV_MDCT */
+ /***************************************************************/
+ @LOC("F") public static final float win[][] = {
+ { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
+ -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
+ -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
+ -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
+ -4.0715656898E-01f, -3.6969460527E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
+ -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
+ -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
+ -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
+ -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f },
+
+ { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
+ -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
+ -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
+ -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
+ -4.0715656898E-01f, -3.6969460527E-01f, -3.3908542600E-01f, -3.1511810350E-01f,
+ -2.9642226150E-01f, -2.8184548650E-01f, -5.4119610000E-01f, -2.6213228100E-01f,
+ -2.5387916537E-01f, -2.3296291359E-01f, -1.9852728987E-01f, -1.5233534808E-01f,
+ -9.6496400054E-02f, -3.3423828516E-02f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
+
+ { -4.8300800645E-02f, -1.5715656932E-01f, -2.8325045177E-01f, -4.2953747763E-01f,
+ -1.2071067795E+00f, -8.2426483178E-01f, -1.1451749106E+00f, -1.7695290101E+00f,
+ -4.5470225061E+00f, -3.4890531002E+00f, -7.3296292804E-01f, -1.5076514758E-01f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
+
+ { 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, -1.5076513660E-01f, -7.3296291107E-01f,
+ -3.4890530566E+00f, -4.5470224727E+00f, -1.7695290031E+00f, -1.1451749092E+00f,
+ -8.3137738100E-01f, -1.3065629650E+00f, -5.4142014250E-01f, -4.6528974900E-01f,
+ -4.1066990750E-01f, -3.7004680800E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
+ -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
+ -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
+ -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
+ -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f } };
+
+ /***************************************************************/
+ /* END OF INV_MDCT */
+ /***************************************************************/
+ @LATTICE("N<VAR")
+ class Sftable {
+ @LOC("VAR") public int[] l;
+ @LOC("VAR") public int[] s;
+
+ public Sftable() {
+ l = new int[5];
+ s = new int[3];
+ }
+ @LATTICE("THIS<IN,THISLOC=THIS")
+ public Sftable(@LOC("IN") int[] thel, @LOC("IN") int[] thes) {
+ l = thel;
+ s = thes;
+ }
+ }
+
+ @LOC("F") public Sftable sftable;
+
+ @LOC("NS") public static final int nr_of_sfb_block[][][] = {
+ { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },
+ { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },
+ { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },
+ { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } },
+ { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } },
+ { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } };
+
+}
+