private void compute_new_v()
  {
	// 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_v0, new_v1, new_v2, new_v3, new_v4, new_v5, new_v6, new_v7, new_v8, new_v9;
	float new_v10, new_v11, new_v12, new_v13, new_v14, new_v15, new_v16, new_v17, new_v18, new_v19;
	float new_v20, new_v21, new_v22, new_v23, new_v24, new_v25, new_v26, new_v27, new_v28, new_v29;
	float new_v30, new_v31;
	  
	new_v0 = new_v1 = new_v2 = new_v3 = new_v4 = new_v5 = new_v6 = new_v7 = new_v8 = new_v9 = 
	new_v10 = new_v11 = new_v12 = new_v13 = new_v14 = new_v15 = new_v16 = new_v17 = new_v18 = new_v19 = 
	new_v20 = new_v21 = new_v22 = new_v23 = new_v24 = new_v25 = new_v26 = new_v27 = new_v28 = new_v29 = 
	new_v30 = new_v31 = 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[] s = samples;
	
	float s0 = s[0];
	float s1 = s[1];
	float s2 = s[2];
	float s3 = s[3];
	float s4 = s[4];
	float s5 = s[5];
	float s6 = s[6];
	float s7 = s[7];
	float s8 = s[8];
	float s9 = s[9];
	float s10 = s[10];	
	float s11 = s[11];
	float s12 = s[12];
	float s13 = s[13];
	float s14 = s[14];
	float s15 = s[15];
	float s16 = s[16];
	float s17 = s[17];
	float s18 = s[18];
	float s19 = s[19];
	float s20 = s[20];	
	float s21 = s[21];
	float s22 = s[22];
	float s23 = s[23];
	float s24 = s[24];
	float s25 = s[25];
	float s26 = s[26];
	float s27 = s[27];
	float s28 = s[28];
	float s29 = s[29];
	float s30 = s[30];	
	float s31 = s[31];
		
	float p0 = s0 + s31;
	float p1 = s1 + s30;
	float p2 = s2 + s29;
	float p3 = s3 + s28;
	float p4 = s4 + s27;
	float p5 = s5 + s26;
	float p6 = s6 + s25;
	float p7 = s7 + s24;
	float p8 = s8 + s23;
	float p9 = s9 + s22;
	float p10 = s10 + s21;
	float p11 = s11 + s20;
	float p12 = s12 + s19;
	float p13 = s13 + s18;
	float p14 = s14 + s17;
	float p15 = s15 + s16;
	
	float pp0 = p0 + p15;
	float pp1 = p1 + p14;
	float pp2 = p2 + p13;
	float pp3 = p3 + p12;
	float pp4 = p4 + p11;
	float pp5 = p5 + p10;
	float pp6 = p6 + p9;
	float pp7 = p7 + p8;
	float pp8 = (p0 - p15) * cos1_32;
	float pp9 = (p1 - p14) * cos3_32;
	float pp10 = (p2 - p13) * cos5_32;
	float pp11 = (p3 - p12) * cos7_32;
	float pp12 = (p4 - p11) * cos9_32;
	float pp13 = (p5 - p10) * cos11_32;
	float pp14 = (p6 - p9) * cos13_32;
	float pp15 = (p7 - p8) * cos15_32;

	p0 = pp0 + pp7;
	p1 = pp1 + pp6;
	p2 = pp2 + pp5;
	p3 = pp3 + pp4;
	p4 = (pp0 - pp7) * cos1_16;
	p5 = (pp1 - pp6) * cos3_16;
	p6 = (pp2 - pp5) * cos5_16;
	p7 = (pp3 - pp4) * cos7_16;
	p8 = pp8 + pp15;
	p9 = pp9 + pp14;
	p10 = pp10 + pp13;
	p11 = pp11 + pp12;
	p12 = (pp8 - pp15) * cos1_16;
	p13 = (pp9 - pp14) * cos3_16;
	p14 = (pp10 - pp13) * cos5_16;
	p15 = (pp11 - pp12) * cos7_16;
	

	pp0 = p0 + p3;
	pp1 = p1 + p2;
	pp2 = (p0 - p3) * cos1_8;
	pp3 = (p1 - p2) * cos3_8;
	pp4 = p4 + p7;
	pp5 = p5 + p6;
	pp6 = (p4 - p7) * cos1_8;
	pp7 = (p5 - p6) * cos3_8;
	pp8 = p8 + p11;
	pp9 = p9 + p10;
	pp10 = (p8 - p11) * cos1_8;
	pp11 = (p9 - p10) * cos3_8;
	pp12 = p12 + p15;
	pp13 = p13 + p14;
	pp14 = (p12 - p15) * cos1_8;
	pp15 = (p13 - p14) * cos3_8;

	p0 = pp0 + pp1;
	p1 = (pp0 - pp1) * cos1_4;
	p2 = pp2 + pp3;
	p3 = (pp2 - pp3) * cos1_4;
	p4 = pp4 + pp5;
	p5 = (pp4 - pp5) * cos1_4;
	p6 = pp6 + pp7;
	p7 = (pp6 - pp7) * cos1_4;
	p8 = pp8 + pp9;
	p9 = (pp8 - pp9) * cos1_4;
	p10 = pp10 + pp11;
	p11 = (pp10 - pp11) * cos1_4;
	p12 = pp12 + pp13;
	p13 = (pp12 - pp13) * cos1_4;
	p14 = pp14 + pp15;
	p15 = (pp14 - pp15) * cos1_4;

	// this is pretty insane coding
	float tmp1;
	new_v19/*36-17*/ = -(new_v4 = (new_v12 = p7) + p5) - p6;
	new_v27/*44-17*/ = -p6 - p7 - p4;
	new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;
	new_v17/*34-17*/ = -(new_v2 = p15 + p13 + p9) - p14;
	new_v21/*38-17*/ = (tmp1 = -p14 - p15 - p10 - p11) - p13;
	new_v29/*46-17*/ = -p14 - p15 - p12 - p8;
	new_v25/*42-17*/ = tmp1 - p12;
	new_v31/*48-17*/ = -p0;
	new_v0 = p1;
	new_v23/*40-17*/ = -(new_v8 = p3) - p2;
	
	p0 = (s0 - s31) * cos1_64;
	p1 = (s1 - s30) * cos3_64;
	p2 = (s2 - s29) * cos5_64;
	p3 = (s3 - s28) * cos7_64;
	p4 = (s4 - s27) * cos9_64;
	p5 = (s5 - s26) * cos11_64;
	p6 = (s6 - s25) * cos13_64;
	p7 = (s7 - s24) * cos15_64;
	p8 = (s8 - s23) * cos17_64;
	p9 = (s9 - s22) * cos19_64;
	p10 = (s10 - s21) * cos21_64;
	p11 = (s11 - s20) * cos23_64;
	p12 = (s12 - s19) * cos25_64;
	p13 = (s13 - s18) * cos27_64;
	p14 = (s14 - s17) * cos29_64;
	p15 = (s15 - s16) * cos31_64;

	
	pp0 = p0 + p15;
	pp1 = p1 + p14;
	pp2 = p2 + p13;
	pp3 = p3 + p12;
	pp4 = p4 + p11;
	pp5 = p5 + p10;
	pp6 = p6 + p9;
	pp7 = p7 + p8;
	pp8 = (p0 - p15) * cos1_32;
	pp9 = (p1 - p14) * cos3_32;
	pp10 = (p2 - p13) * cos5_32;
	pp11 = (p3 - p12) * cos7_32;
	pp12 = (p4 - p11) * cos9_32;
	pp13 = (p5 - p10) * cos11_32;
	pp14 = (p6 - p9) * cos13_32;
	pp15 = (p7 - p8) * cos15_32;
	

	p0 = pp0 + pp7;
	p1 = pp1 + pp6;
	p2 = pp2 + pp5;
	p3 = pp3 + pp4;
	p4 = (pp0 - pp7) * cos1_16;
	p5 = (pp1 - pp6) * cos3_16;
	p6 = (pp2 - pp5) * cos5_16;
	p7 = (pp3 - pp4) * cos7_16;
	p8 = pp8 + pp15;
	p9 = pp9 + pp14;
	p10 = pp10 + pp13;
	p11 = pp11 + pp12;
	p12 = (pp8 - pp15) * cos1_16;
	p13 = (pp9 - pp14) * cos3_16;
	p14 = (pp10 - pp13) * cos5_16;
	p15 = (pp11 - pp12) * cos7_16;


	pp0 = p0 + p3;
	pp1 = p1 + p2;
	pp2 = (p0 - p3) * cos1_8;
	pp3 = (p1 - p2) * cos3_8;
	pp4 = p4 + p7;
	pp5 = p5 + p6;
	pp6 = (p4 - p7) * cos1_8;
	pp7 = (p5 - p6) * cos3_8;
	pp8 = p8 + p11;
	pp9 = p9 + p10;
	pp10 = (p8 - p11) * cos1_8;
	pp11 = (p9 - p10) * cos3_8;
	pp12 = p12 + p15;
	pp13 = p13 + p14;
	pp14 = (p12 - p15) * cos1_8;
	pp15 = (p13 - p14) * cos3_8;

	
	p0 = pp0 + pp1;
	p1 = (pp0 - pp1) * cos1_4;
	p2 = pp2 + pp3;
	p3 = (pp2 - pp3) * cos1_4;
	p4 = pp4 + pp5;
	p5 = (pp4 - pp5) * cos1_4;
	p6 = pp6 + pp7;
	p7 = (pp6 - pp7) * cos1_4;
	p8 = pp8 + pp9;
	p9 = (pp8 - pp9) * cos1_4;
	p10 = pp10 + pp11;
	p11 = (pp10 - pp11) * cos1_4;
	p12 = pp12 + pp13;
	p13 = (pp12 - pp13) * cos1_4;
	p14 = pp14 + pp15;
	p15 = (pp14 - pp15) * cos1_4;
	

	// manually doing something that a compiler should handle sucks
	// coding like this is hard to read
	float tmp2;
	new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11)
							+ p5 + p13;
	new_v7 = (new_v9 = p15 + p11 + p3) + p13;
	new_v16/*33-17*/ = -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;
	new_v18/*35-17*/ = -(new_v3 = tmp1 + p5 + p7) - p6 - p14;

	new_v22/*39-17*/ = (tmp1 = -p10 - p11 - p14 - p15)
									- p13 - p2 - p3;
	new_v20/*37-17*/ = tmp1 - p13 - p5 - p6 - p7;
	new_v24/*41-17*/ = tmp1 - p12 - p2 - p3;
	new_v26/*43-17*/ = tmp1 - p12 - (tmp2 = p4 + p6 + p7);
	new_v30/*47-17*/ = (tmp1 = -p8 - p12 - p14 - p15) - p0;
	new_v28/*45-17*/ = tmp1 - tmp2;

	// insert V[0-15] (== new_v[0-15]) into actual v:	
	// float[] x2 = actual_v + actual_write_pos;
	float dest[] = actual_v;
	
	int pos = actual_write_pos;
	
	dest[0 + pos] = new_v0;
	dest[16 + pos] = new_v1;
	dest[32 + pos] = new_v2;
	dest[48 + pos] = new_v3;
	dest[64 + pos] = new_v4;
	dest[80 + pos] = new_v5;
	dest[96 + pos] = new_v6;
	dest[112 + pos] = new_v7;
	dest[128 + pos] = new_v8;
	dest[144 + pos] = new_v9;
	dest[160 + pos] = new_v10;
	dest[176 + pos] = new_v11;
	dest[192 + pos] = new_v12;
	dest[208 + pos] = new_v13;
	dest[224 + pos] = new_v14;
	dest[240 + pos] = new_v15;

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

	// insert V[17-31] (== -new_v[15-1]) into actual v:
	dest[272 + pos] = -new_v15;
	dest[288 + pos] = -new_v14;
	dest[304 + pos] = -new_v13;
	dest[320 + pos] = -new_v12;
	dest[336 + pos] = -new_v11;
	dest[352 + pos] = -new_v10;
	dest[368 + pos] = -new_v9;
	dest[384 + pos] = -new_v8;
	dest[400 + pos] = -new_v7;
	dest[416 + pos] = -new_v6;
	dest[432 + pos] = -new_v5;
	dest[448 + pos] = -new_v4;
	dest[464 + pos] = -new_v3;
	dest[480 + pos] = -new_v2;
	dest[496 + pos] = -new_v1;

	// insert V[32] (== -new_v[0]) into other v:
	dest = (actual_v==v1) ? v2 : v1;
	
	dest[0 + pos] = -new_v0;
	// insert V[33-48] (== new_v[16-31]) into other v:
	dest[16 + pos] = new_v16;
	dest[32 + pos] = new_v17;
	dest[48 + pos] = new_v18;
	dest[64 + pos] = new_v19;
	dest[80 + pos] = new_v20;
	dest[96 + pos] = new_v21;
	dest[112 + pos] = new_v22;
	dest[128 + pos] = new_v23;
	dest[144 + pos] = new_v24;
	dest[160 + pos] = new_v25;
	dest[176 + pos] = new_v26;
	dest[192 + pos] = new_v27;
	dest[208 + pos] = new_v28;
	dest[224 + pos] = new_v29;
	dest[240 + pos] = new_v30;
	dest[256 + pos] = new_v31;
	
	// insert V[49-63] (== new_v[30-16]) into other v:
	dest[272 + pos] = new_v30;
	dest[288 + pos] = new_v29;
	dest[304 + pos] = new_v28;
	dest[320 + pos] = new_v27;
	dest[336 + pos] = new_v26;
	dest[352 + pos] = new_v25;
	dest[368 + pos] = new_v24;
	dest[384 + pos] = new_v23;
	dest[400 + pos] = new_v22;
	dest[416 + pos] = new_v21;
	dest[432 + pos] = new_v20;
	dest[448 + pos] = new_v19;
	dest[464 + pos] = new_v18;
	dest[480 + pos] = new_v17;
	dest[496 + pos] = new_v16; 			
/*
	}
	else
	{
		v1[0 + actual_write_pos] = -new_v0;
		// insert V[33-48] (== new_v[16-31]) into other v:
		v1[16 + actual_write_pos] = new_v16;
		v1[32 + actual_write_pos] = new_v17;
		v1[48 + actual_write_pos] = new_v18;
		v1[64 + actual_write_pos] = new_v19;
		v1[80 + actual_write_pos] = new_v20;
		v1[96 + actual_write_pos] = new_v21;
		v1[112 + actual_write_pos] = new_v22;
		v1[128 + actual_write_pos] = new_v23;
		v1[144 + actual_write_pos] = new_v24;
		v1[160 + actual_write_pos] = new_v25;
		v1[176 + actual_write_pos] = new_v26;
		v1[192 + actual_write_pos] = new_v27;
		v1[208 + actual_write_pos] = new_v28;
		v1[224 + actual_write_pos] = new_v29;
		v1[240 + actual_write_pos] = new_v30;
		v1[256 + actual_write_pos] = new_v31;

		// insert V[49-63] (== new_v[30-16]) into other v:
		v1[272 + actual_write_pos] = new_v30;
		v1[288 + actual_write_pos] = new_v29;
		v1[304 + actual_write_pos] = new_v28;
		v1[320 + actual_write_pos] = new_v27;
		v1[336 + actual_write_pos] = new_v26;
		v1[352 + actual_write_pos] = new_v25;
		v1[368 + actual_write_pos] = new_v24;
		v1[384 + actual_write_pos] = new_v23;
		v1[400 + actual_write_pos] = new_v22;
		v1[416 + actual_write_pos] = new_v21;
		v1[432 + actual_write_pos] = new_v20;
		v1[448 + actual_write_pos] = new_v19;
		v1[464 + actual_write_pos] = new_v18;
		v1[480 + actual_write_pos] = new_v17;
		v1[496 + actual_write_pos] = new_v16;	
	}
*/	
  }