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S,LSF,J")
+@LATTICE("SI0*,INIT*,ISR*,ISP*,HD<CH0,LR<ISR,ISR<ISP,SI1<SF2,NS*,CH0<ST,ST<INIT,IS1D*,RO1<RO,RO1*,RO<IS1D,IS1D<SI2,SI2<SI1,BR<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SF2<SFB,LR*,OUT<LR,ISP<RO1,NZ*,SI<SI0,SI0<SF15,SF15<SF1,BR1<NZ,NZ<BR,SI1<RT,RT<SBI,SBI<SI,BUF<FT,SF1<HD1,SF1<HD1,FT<SP,SP<OUT,OUT<SI1,SI1<SI,SFB_SH<BR1,BR1<BR,HD1<HD,OUT*,BR1*,SI1*,CH0*")
@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN,RETURNLOC=OUT")
final class LayerIIIDecoder implements FrameDecoder {
static final double d43 = (4.0 / 3.0);
@LOC("LR")
private float[][][] lr;
@LOC("OUT")
+ private float[] inter; // 576 samples
+ @LOC("OUT")
private float[] out_1d; // 576 samples
@LOC("OUT")
private float[][] prevblck;
// @LOC("SBT") private temporaire2[] III_scalefac_t;
@LOC("SF2")
- private temporaire2[] scalefac;
+ private final temporaire2[] scalefac;
// private III_scalefac_t scalefac;
@LOC("CH0")
private int frame_start;
// @LOC("SI1") private int part2_start;
@LOC("CH0")
- private int channels;
+ private final int channels;
@LOC("CH0")
private int first_channel;
@LOC("CH0")
ro = new float[2][SBLIMIT][SSLIMIT];
lr = new float[2][SBLIMIT][SSLIMIT];
out_1d = new float[SBLIMIT * SSLIMIT];
+ inter = new float[SBLIMIT * SSLIMIT];
prevblck = new float[2][SBLIMIT * SSLIMIT];
k = new float[2][SBLIMIT * SSLIMIT];
nonzero = new int[2];
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
nonzero[0] = nonzero[1] = 576;
- br = new BitReserve();
si = new III_side_info_t();
initialized = true;
init(header);
}
+ // overwrites once per a loop
+ samples1 = new float[32];
+ samples2 = new float[32];
+ // prevblck = new float[2][SBLIMIT * SSLIMIT];
+ si = new III_side_info_t();
+ //
+
@LOC("THIS,LayerIIIDecoder.HD1") int nSlots = header.slots();
@LOC("THIS,LayerIIIDecoder.CH0") int gr;
// }
// System.out.println("CheckSumOut1d = "+CheckSumOut1d);
+ for (@LOC("THIS,LayerIIIDecoder.SI1") int index = 0; index < 576; index++) {
+ out_1d[index] = inter[index];
+ }
+
hybrid(ch, gr);
// float CheckSumOut1d=0;
m = 0;
for (@LOC("THIS,LayerIIIDecoder.NS") int i = 0; i < 4; i++) {
- for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++) {
+ @LOC("THIS,LayerIIIDecoder.NS") int jmax = nr_of_sfb_block[blocknumber][blocktypenumber][i];
+ for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < jmax; j++) {
scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);
m++;
// int[] v = { 0 };
// @LOC("SI1")
// int[] w = { 0 };
- @LOC("SI1")
- int x[] = { 0 };
- @LOC("SI1")
- int y[] = { 0 };
- @LOC("SI1")
- int v[] = { 0 };
- @LOC("SI1")
- int w[] = { 0 };
+ // @LOC("SI1")
+ // int x[] = { 0 };
+ // @LOC("SI1")
+ // int y[] = { 0 };
+ // @LOC("SI1")
+ // int v[] = { 0 };
+ // @LOC("SI1")
+ // int w[] = { 0 };
- @LATTICE("OUT<GLOBAL,GLOBAL<THIS,THISLOC=THIS,GLOBALLOC=GLOBAL,RETURNLOC=OUT")
+ @LATTICE("VAR<OUT,OUT<THIS,THIS<RE,THISLOC=THIS,GLOBALLOC=OUT,RETURNLOC=OUT")
private void huffman_decode(@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_start_local,
@LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
- x[0] = 0;
- y[0] = 0;
- v[0] = 0;
- w[0] = 0;
+
+ @LOC("RE") int x[] = new int[1];
+ @LOC("RE") int y[] = new int[1];
+ @LOC("RE") int v[] = new int[1];
+ @LOC("RE") int w[] = new int[1];
@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_3_end =
part2_start_local + si.ch[ch].gr[gr].part2_3_length;
index = 0;
// Read bigvalues area
- for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
+ TERMINATE: for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
2) {
@LOC("THIS,LayerIIIDecoder.SI2") int htIdx;
// h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
num_bits = br.hsstell();
- while ((num_bits < part2_3_end) && (index < 576)) {
+ TERMINATE: while ((num_bits < part2_3_end) && (index < 576)) {
huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
for (index = 0; index < 576; index++) {
- out_1d[index] = 0.0f;
+ inter[index] = 0.0f;
}
if (si.ch[ch].gr[gr].mixed_block_flag != 0) {
// Modif E.B 02/22/99
@LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
@LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
- out_1d[index] = lr[ch][quotien][reste];
+ inter[index] = lr[ch][quotien][reste];
}
// REORDERING FOR REST SWITCHED SHORT
/*
@LOC("THIS,LayerIIIDecoder.SI1") int reste = src_line % SSLIMIT;
@LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((src_line - reste) / SSLIMIT);
- out_1d[des_line] = lr[ch][quotien][reste];
+ inter[des_line] = lr[ch][quotien][reste];
src_line += sfb_lines;
des_line++;
reste = src_line % SSLIMIT;
quotien = (int) ((src_line - reste) / SSLIMIT);
- out_1d[des_line] = lr[ch][quotien][reste];
+ inter[des_line] = lr[ch][quotien][reste];
src_line += sfb_lines;
des_line++;
reste = src_line % SSLIMIT;
quotien = (int) ((src_line - reste) / SSLIMIT);
- out_1d[des_line] = lr[ch][quotien][reste];
+ inter[des_line] = lr[ch][quotien][reste];
}
}
@LOC("THIS,LayerIIIDecoder.SI1") int j = reorder_table[sfreq][index];
@LOC("THIS,LayerIIIDecoder.SI1") int reste = j % SSLIMIT;
@LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((j - reste) / SSLIMIT);
- out_1d[index] = lr[ch][quotien][reste];
+ inter[index] = lr[ch][quotien][reste];
}
}
} else { // long blocks
// Modif E.B 02/22/99
@LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
@LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
- out_1d[index] = lr[ch][quotien][reste];
+ inter[index] = lr[ch][quotien][reste];
}
}
}
for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
@LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
sfbcnt = 2;
- for (sfb = 12; sfb >= 3; sfb--) {
+ TERMINATE: 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) {
+ TERMINATE: 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.
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
i = (temp << 2) - temp + j * sb;
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].s[j][sfb];
if (is_pos[i] != 7)
if (lsf)
temp = sfBandIndex[sfreq].s[11];
sb = sfBandIndex[sfreq].s[12] - temp;
i = (temp << 2) - temp + j * sb;
-
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = is_pos[sfb];
if (lsf) {
i = 2;
ss = 17;
sb = -1;
- while (i >= 0) {
+ TERMINATE: while (i >= 0) {
if (ro[1][i][ss] != 0.0f) {
sb = (i << 4) + (i << 1) + ss;
i = -1;
i = sfBandIndex[sfreq].l[i];
for (; sfb < 8; sfb++) {
sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].l[sfb];
if (is_pos[i] != 7)
if (lsf)
for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
@LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
sfbcnt = -1;
- for (sfb = 12; sfb >= 0; sfb--) {
+ TERMINATE: 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) {
+ TERMINATE: 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.
temp = sfBandIndex[sfreq].s[sfb];
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
i = (temp << 2) - temp + j * sb;
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].s[j][sfb];
if (is_pos[i] != 7)
if (lsf)
sfb = (temp << 2) - temp + j * sb;
sb = sfBandIndex[sfreq].s[12] - temp2;
i = (temp2 << 2) - temp2 + j * sb;
-
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = is_pos[sfb];
if (lsf) {
i = 31;
ss = 17;
sb = 0;
- while (i >= 0) {
+ TERMINATE: while (i >= 0) {
if (ro[1][i][ss] != 0.0f) {
sb = (i << 4) + (i << 1) + ss;
i = -1;
i = sfBandIndex[sfreq].l[i];
for (; sfb < 21; sfb++) {
sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
- for (; sb > 0; sb--) {
+ TERMINATE: for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].l[sfb];
if (is_pos[i] != 7)
if (lsf)
}
}
sfb = sfBandIndex[sfreq].l[20];
- for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
+ TERMINATE: for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
is_pos[i] = is_pos[sfb]; // error here : i >=576
if (lsf) {
for (ss = 0; ss < 8; ss++) {
@LOC("THIS,LayerIIIDecoder.SI1") int src_idx1 = sb18 + 17 - ss;
@LOC("THIS,LayerIIIDecoder.SI1") int src_idx2 = sb18 + 18 + ss;
- @LOC("THIS,LayerIIIDecoder.OUT") float bu = out_1d[src_idx1];
- @LOC("THIS,LayerIIIDecoder.OUT") 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]);
+ @LOC("THIS,LayerIIIDecoder.OUT") float bu = inter[src_idx1];
+ @LOC("THIS,LayerIIIDecoder.OUT") float bd = inter[src_idx2];
+ inter[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);
+ inter[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);
}
}
}
// Fin Modif
// overlap addition
- // prvblk = prevblck; //eliminated unnecessary areas
-
out_1d[0 + sb18] = rawout[0] + prevblck[ch][sb18 + 0];
prevblck[ch][sb18 + 0] = rawout[18];
out_1d[1 + sb18] = rawout[1] + prevblck[ch][sb18 + 1];
/***************************************************************/
/* 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(@DELEGATE @LOC("IN") int[] thel, @DELEGATE @LOC("IN") int[] thes) {
- l = thel;
- s = thes;
- }
- }
-
- @LOC("F")
- public Sftable sftable;
public static final int nr_of_sfb_block[][][] = {
{ { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },