Logo Search packages:      
Sourcecode: libjlayer-java version File versions  Download package

void javazoom::jl::decoder::SynthesisFilter::compute_new_v_old (  )  [inline, private]

Compute new values via a fast cosine transform.

Definition at line 575 of file SynthesisFilter.java.

  {
      // p is fully initialized from x1
       //float[] p = _p;
       // pp is fully initialized from p
       //float[] pp = _pp; 
        
       //float[] new_v = _new_v;
        
      float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
      float[] p = new float[16];
      float[] pp = new float[16];
        
        
       for (int i=31; i>=0; i--)
       {
             new_v[i] = 0.0f;
       }
       
//    float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
//    float[] p = new float[16];
//    float[] pp = new float[16];

    float[] x1 = samples;
      
      p[0] = x1[0] + x1[31];
      p[1] = x1[1] + x1[30];
      p[2] = x1[2] + x1[29];
      p[3] = x1[3] + x1[28];
      p[4] = x1[4] + x1[27];
      p[5] = x1[5] + x1[26];
      p[6] = x1[6] + x1[25];
      p[7] = x1[7] + x1[24];
      p[8] = x1[8] + x1[23];
      p[9] = x1[9] + x1[22];
      p[10] = x1[10] + x1[21];
      p[11] = x1[11] + x1[20];
      p[12] = x1[12] + x1[19];
      p[13] = x1[13] + x1[18];
      p[14] = x1[14] + x1[17];
      p[15] = x1[15] + x1[16];
      
      pp[0] = p[0] + p[15];
      pp[1] = p[1] + p[14];
      pp[2] = p[2] + p[13];
      pp[3] = p[3] + p[12];
      pp[4] = p[4] + p[11];
      pp[5] = p[5] + p[10];
      pp[6] = p[6] + p[9];
      pp[7] = p[7] + p[8];
      pp[8] = (p[0] - p[15]) * cos1_32;
      pp[9] = (p[1] - p[14]) * cos3_32;
      pp[10] = (p[2] - p[13]) * cos5_32;
      pp[11] = (p[3] - p[12]) * cos7_32;
      pp[12] = (p[4] - p[11]) * cos9_32;
      pp[13] = (p[5] - p[10]) * cos11_32;
      pp[14] = (p[6] - p[9]) * cos13_32;
      pp[15] = (p[7] - p[8]) * cos15_32;

      p[0] = pp[0] + pp[7];
      p[1] = pp[1] + pp[6];
      p[2] = pp[2] + pp[5];
      p[3] = pp[3] + pp[4];
      p[4] = (pp[0] - pp[7]) * cos1_16;
      p[5] = (pp[1] - pp[6]) * cos3_16;
      p[6] = (pp[2] - pp[5]) * cos5_16;
      p[7] = (pp[3] - pp[4]) * cos7_16;
      p[8] = pp[8] + pp[15];
      p[9] = pp[9] + pp[14];
      p[10] = pp[10] + pp[13];
      p[11] = pp[11] + pp[12];
      p[12] = (pp[8] - pp[15]) * cos1_16;
      p[13] = (pp[9] - pp[14]) * cos3_16;
      p[14] = (pp[10] - pp[13]) * cos5_16;
      p[15] = (pp[11] - pp[12]) * cos7_16;
      

      pp[0] = p[0] + p[3];
      pp[1] = p[1] + p[2];
      pp[2] = (p[0] - p[3]) * cos1_8;
      pp[3] = (p[1] - p[2]) * cos3_8;
      pp[4] = p[4] + p[7];
      pp[5] = p[5] + p[6];
      pp[6] = (p[4] - p[7]) * cos1_8;
      pp[7] = (p[5] - p[6]) * cos3_8;
      pp[8] = p[8] + p[11];
      pp[9] = p[9] + p[10];
      pp[10] = (p[8] - p[11]) * cos1_8;
      pp[11] = (p[9] - p[10]) * cos3_8;
      pp[12] = p[12] + p[15];
      pp[13] = p[13] + p[14];
      pp[14] = (p[12] - p[15]) * cos1_8;
      pp[15] = (p[13] - p[14]) * cos3_8;

      p[0] = pp[0] + pp[1];
      p[1] = (pp[0] - pp[1]) * cos1_4;
      p[2] = pp[2] + pp[3];
      p[3] = (pp[2] - pp[3]) * cos1_4;
      p[4] = pp[4] + pp[5];
      p[5] = (pp[4] - pp[5]) * cos1_4;
      p[6] = pp[6] + pp[7];
      p[7] = (pp[6] - pp[7]) * cos1_4;
      p[8] = pp[8] + pp[9];
      p[9] = (pp[8] - pp[9]) * cos1_4;
      p[10] = pp[10] + pp[11];
      p[11] = (pp[10] - pp[11]) * cos1_4;
      p[12] = pp[12] + pp[13];
      p[13] = (pp[12] - pp[13]) * cos1_4;
      p[14] = pp[14] + pp[15];
      p[15] = (pp[14] - pp[15]) * cos1_4;

      // this is pretty insane coding
      float tmp1;
      new_v[36-17] = -(new_v[4] = (new_v[12] = p[7]) + p[5]) - p[6];
      new_v[44-17] = -p[6] - p[7] - p[4];
      new_v[6] = (new_v[10] = (new_v[14] = p[15]) + p[11]) + p[13];
      new_v[34-17] = -(new_v[2] = p[15] + p[13] + p[9]) - p[14];
      new_v[38-17] = (tmp1 = -p[14] - p[15] - p[10] - p[11]) - p[13];
      new_v[46-17] = -p[14] - p[15] - p[12] - p[8];
      new_v[42-17] = tmp1 - p[12];
      new_v[48-17] = -p[0];
      new_v[0] = p[1];
      new_v[40-17] = -(new_v[8] = p[3]) - p[2];
      
      p[0] = (x1[0] - x1[31]) * cos1_64;
      p[1] = (x1[1] - x1[30]) * cos3_64;
      p[2] = (x1[2] - x1[29]) * cos5_64;
      p[3] = (x1[3] - x1[28]) * cos7_64;
      p[4] = (x1[4] - x1[27]) * cos9_64;
      p[5] = (x1[5] - x1[26]) * cos11_64;
      p[6] = (x1[6] - x1[25]) * cos13_64;
      p[7] = (x1[7] - x1[24]) * cos15_64;
      p[8] = (x1[8] - x1[23]) * cos17_64;
      p[9] = (x1[9] - x1[22]) * cos19_64;
      p[10] = (x1[10] - x1[21]) * cos21_64;
      p[11] = (x1[11] - x1[20]) * cos23_64;
      p[12] = (x1[12] - x1[19]) * cos25_64;
      p[13] = (x1[13] - x1[18]) * cos27_64;
      p[14] = (x1[14] - x1[17]) * cos29_64;
      p[15] = (x1[15] - x1[16]) * cos31_64;

      
      pp[0] = p[0] + p[15];
      pp[1] = p[1] + p[14];
      pp[2] = p[2] + p[13];
      pp[3] = p[3] + p[12];
      pp[4] = p[4] + p[11];
      pp[5] = p[5] + p[10];
      pp[6] = p[6] + p[9];
      pp[7] = p[7] + p[8];
      pp[8] = (p[0] - p[15]) * cos1_32;
      pp[9] = (p[1] - p[14]) * cos3_32;
      pp[10] = (p[2] - p[13]) * cos5_32;
      pp[11] = (p[3] - p[12]) * cos7_32;
      pp[12] = (p[4] - p[11]) * cos9_32;
      pp[13] = (p[5] - p[10]) * cos11_32;
      pp[14] = (p[6] - p[9]) * cos13_32;
      pp[15] = (p[7] - p[8]) * cos15_32;
      

      p[0] = pp[0] + pp[7];
      p[1] = pp[1] + pp[6];
      p[2] = pp[2] + pp[5];
      p[3] = pp[3] + pp[4];
      p[4] = (pp[0] - pp[7]) * cos1_16;
      p[5] = (pp[1] - pp[6]) * cos3_16;
      p[6] = (pp[2] - pp[5]) * cos5_16;
      p[7] = (pp[3] - pp[4]) * cos7_16;
      p[8] = pp[8] + pp[15];
      p[9] = pp[9] + pp[14];
      p[10] = pp[10] + pp[13];
      p[11] = pp[11] + pp[12];
      p[12] = (pp[8] - pp[15]) * cos1_16;
      p[13] = (pp[9] - pp[14]) * cos3_16;
      p[14] = (pp[10] - pp[13]) * cos5_16;
      p[15] = (pp[11] - pp[12]) * cos7_16;


      pp[0] = p[0] + p[3];
      pp[1] = p[1] + p[2];
      pp[2] = (p[0] - p[3]) * cos1_8;
      pp[3] = (p[1] - p[2]) * cos3_8;
      pp[4] = p[4] + p[7];
      pp[5] = p[5] + p[6];
      pp[6] = (p[4] - p[7]) * cos1_8;
      pp[7] = (p[5] - p[6]) * cos3_8;
      pp[8] = p[8] + p[11];
      pp[9] = p[9] + p[10];
      pp[10] = (p[8] - p[11]) * cos1_8;
      pp[11] = (p[9] - p[10]) * cos3_8;
      pp[12] = p[12] + p[15];
      pp[13] = p[13] + p[14];
      pp[14] = (p[12] - p[15]) * cos1_8;
      pp[15] = (p[13] - p[14]) * cos3_8;

      
      p[0] = pp[0] + pp[1];
      p[1] = (pp[0] - pp[1]) * cos1_4;
      p[2] = pp[2] + pp[3];
      p[3] = (pp[2] - pp[3]) * cos1_4;
      p[4] = pp[4] + pp[5];
      p[5] = (pp[4] - pp[5]) * cos1_4;
      p[6] = pp[6] + pp[7];
      p[7] = (pp[6] - pp[7]) * cos1_4;
      p[8] = pp[8] + pp[9];
      p[9] = (pp[8] - pp[9]) * cos1_4;
      p[10] = pp[10] + pp[11];
      p[11] = (pp[10] - pp[11]) * cos1_4;
      p[12] = pp[12] + pp[13];
      p[13] = (pp[12] - pp[13]) * cos1_4;
      p[14] = pp[14] + pp[15];
      p[15] = (pp[14] - pp[15]) * cos1_4;
      

      // manually doing something that a compiler should handle sucks
      // coding like this is hard to read
      float tmp2;
      new_v[5] = (new_v[11] = (new_v[13] = (new_v[15] = p[15]) + p[7]) + p[11])
                                          + p[5] + p[13];
      new_v[7] = (new_v[9] = p[15] + p[11] + p[3]) + p[13];
      new_v[33-17] = -(new_v[1] = (tmp1 = p[13] + p[15] + p[9]) + p[1]) - p[14];
      new_v[35-17] = -(new_v[3] = tmp1 + p[5] + p[7]) - p[6] - p[14];

      new_v[39-17] = (tmp1 = -p[10] - p[11] - p[14] - p[15])
                                                      - p[13] - p[2] - p[3];
      new_v[37-17] = tmp1 - p[13] - p[5] - p[6] - p[7];
      new_v[41-17] = tmp1 - p[12] - p[2] - p[3];
      new_v[43-17] = tmp1 - p[12] - (tmp2 = p[4] + p[6] + p[7]);
      new_v[47-17] = (tmp1 = -p[8] - p[12] - p[14] - p[15]) - p[0];
      new_v[45-17] = tmp1 - tmp2;

      // insert V[0-15] (== new_v[0-15]) into actual v:
      x1 = new_v;
      // float[] x2 = actual_v + actual_write_pos;
      float[] dest = actual_v;
      
      dest[0 + actual_write_pos] = x1[0];
      dest[16 + actual_write_pos] = x1[1];
      dest[32 + actual_write_pos] = x1[2];
      dest[48 + actual_write_pos] = x1[3];
      dest[64 + actual_write_pos] = x1[4];
      dest[80 + actual_write_pos] = x1[5];
      dest[96 + actual_write_pos] = x1[6];
      dest[112 + actual_write_pos] = x1[7];
      dest[128 + actual_write_pos] = x1[8];
      dest[144 + actual_write_pos] = x1[9];
      dest[160 + actual_write_pos] = x1[10];
      dest[176 + actual_write_pos] = x1[11];
      dest[192 + actual_write_pos] = x1[12];
      dest[208 + actual_write_pos] = x1[13];
      dest[224 + actual_write_pos] = x1[14];
      dest[240 + actual_write_pos] = x1[15];

      // V[16] is always 0.0:
      dest[256 + actual_write_pos] = 0.0f;

      // insert V[17-31] (== -new_v[15-1]) into actual v:
      dest[272 + actual_write_pos] = -x1[15];
      dest[288 + actual_write_pos] = -x1[14];
      dest[304 + actual_write_pos] = -x1[13];
      dest[320 + actual_write_pos] = -x1[12];
      dest[336 + actual_write_pos] = -x1[11];
      dest[352 + actual_write_pos] = -x1[10];
      dest[368 + actual_write_pos] = -x1[9];
      dest[384 + actual_write_pos] = -x1[8];
      dest[400 + actual_write_pos] = -x1[7];
      dest[416 + actual_write_pos] = -x1[6];
      dest[432 + actual_write_pos] = -x1[5];
      dest[448 + actual_write_pos] = -x1[4];
      dest[464 + actual_write_pos] = -x1[3];
      dest[480 + actual_write_pos] = -x1[2];
      dest[496 + actual_write_pos] = -x1[1];

      // insert V[32] (== -new_v[0]) into other v:
      
  }


Generated by  Doxygen 1.6.0   Back to index