src/main/java/net/sourceforge/jaad/aac/sbr/DCT.java
public static void dct4_kernel(float[] in_real, float[] in_imag, float[] out_real, float[] out_imag) {
		// Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
		int i, i_rev;

		/* Step 2: modulate */
		// 3*32=96 multiplications
		// 3*32=96 additions
		for(i = 0; i<32; i++) {
			float x_re, x_im, tmp;
			x_re = in_real[i];
			x_im = in_imag[i];
			tmp = (x_re+x_im)*dct4_64_tab[i];
			in_real[i] = (x_im*dct4_64_tab[i+64])+tmp;
			in_imag[i] = (x_re*dct4_64_tab[i+32])+tmp;
		}

		/* Step 3: FFT, but with output in bit reverse order */
		fft_dif(in_real, in_imag);

		/* Step 4: modulate + bitreverse reordering */
		// 3*31+2=95 multiplications
		// 3*31+2=95 additions
		for(i = 0; i<16; i++) {
			float x_re, x_im, tmp;
			i_rev = bit_rev_tab[i];
			x_re = in_real[i_rev];
			x_im = in_imag[i_rev];

			tmp = (x_re+x_im)*dct4_64_tab[i+3*32];
			out_real[i] = (x_im*dct4_64_tab[i+5*32])+tmp;
			out_imag[i] = (x_re*dct4_64_tab[i+4*32])+tmp;
		}
		// i = 16, i_rev = 1 = rev(16);
		out_imag[16] = (in_imag[1]-in_real[1])*dct4_64_tab[16+3*32];
		out_real[16] = (in_real[1]+in_imag[1])*dct4_64_tab[16+3*32];
		for(i = 17; i<32; i++) {
			float x_re, x_im, tmp;
			i_rev = bit_rev_tab[i];
			x_re = in_real[i_rev];
			x_im = in_imag[i_rev];
			tmp = (x_re+x_im)*dct4_64_tab[i+3*32];
			out_real[i] = (x_im*dct4_64_tab[i+5*32])+tmp;
			out_imag[i] = (x_re*dct4_64_tab[i+4*32])+tmp;
		}

	}
public static void dct4_kernel(float[] in_real, float[] in_imag, float[] out_real, float[] out_imag) {
		// Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
		int i, i_rev;

		/* Step 2: modulate */
		// 3*32=96 multiplications
		// 3*32=96 additions
		for(i = 0; i<32; i++) {
			float x_re, x_im, tmp;
			x_re = in_real[i];
			x_im = in_imag[i];
			tmp = (x_re+x_im)*dct4_64_tab[i];
			in_real[i] = (x_im*dct4_64_tab[i+64])+tmp;
			in_imag[i] = (x_re*dct4_64_tab[i+32])+tmp;
		}

		/* Step 3: FFT, but with output in bit reverse order */
		fft_dif(in_real, in_imag);

		/* Step 4: modulate + bitreverse reordering */
		// 3*31+2=95 multiplications
		// 3*31+2=95 additions
		for(i = 0; i<16; i++) {
			float x_re, x_im, tmp;
			i_rev = bit_rev_tab[i];
			x_re = in_real[i_rev];
			x_im = in_imag[i_rev];

			tmp = (x_re+x_im)*dct4_64_tab[i+3*32];
			out_real[i] = (x_im*dct4_64_tab[i+5*32])+tmp;
			out_imag[i] = (x_re*dct4_64_tab[i+4*32])+tmp;
		}
		// i = 16, i_rev = 1 = rev(16);
		out_imag[16] = (in_imag[1]-in_real[1])*dct4_64_tab[16+3*32];
		out_real[16] = (in_real[1]+in_imag[1])*dct4_64_tab[16+3*32];
		for(i = 17; i<32; i++) {
			float x_re, x_im, tmp;
			i_rev = bit_rev_tab[i];
			x_re = in_real[i_rev];
			x_im = in_imag[i_rev];
			tmp = (x_re+x_im)*dct4_64_tab[i+3*32];
			out_real[i] = (x_im*dct4_64_tab[i+5*32])+tmp;
			out_imag[i] = (x_re*dct4_64_tab[i+4*32])+tmp;
		}

	}
public static void dct4_kernel ( float [ ] in_real , float [ ] in_imag , float [ ] out_real , float [ ] out_imag ) { // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position int i , i_rev ; /* Step 2: modulate */ // 3*32=96 multiplications // 3*32=96 additions for ( i = 0 ; i < 32 ; i ++ ) { float x_re , x_im , tmp ; x_re = in_real [ i ] ; x_im = in_imag [ i ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i ] ; in_real [ i ] = ( x_im * dct4_64_tab [ i + 64 ] ) + tmp ; in_imag [ i ] = ( x_re * dct4_64_tab [ i + 32 ] ) + tmp ; } /* Step 3: FFT, but with output in bit reverse order */ fft_dif ( in_real , in_imag ) ; /* Step 4: modulate + bitreverse reordering */ // 3*31+2=95 multiplications // 3*31+2=95 additions for ( i = 0 ; i < 16 ; i ++ ) { float x_re , x_im , tmp ; i_rev = bit_rev_tab [ i ] ; x_re = in_real [ i_rev ] ; x_im = in_imag [ i_rev ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i + 3 * 32 ] ; out_real [ i ] = ( x_im * dct4_64_tab [ i + 5 * 32 ] ) + tmp ; out_imag [ i ] = ( x_re * dct4_64_tab [ i + 4 * 32 ] ) + tmp ; } // i = 16, i_rev = 1 = rev(16); out_imag [ 16 ] = ( in_imag [ 1 ] - in_real [ 1 ] ) * dct4_64_tab [ 16 + 3 * 32 ] ; out_real [ 16 ] = ( in_real [ 1 ] + in_imag [ 1 ] ) * dct4_64_tab [ 16 + 3 * 32 ] ; for ( i = 17 ; i < 32 ; i ++ ) { float x_re , x_im , tmp ; i_rev = bit_rev_tab [ i ] ; x_re = in_real [ i_rev ] ; x_im = in_imag [ i_rev ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i + 3 * 32 ] ; out_real [ i ] = ( x_im * dct4_64_tab [ i + 5 * 32 ] ) + tmp ; out_imag [ i ] = ( x_re * dct4_64_tab [ i + 4 * 32 ] ) + tmp ; } }
/* size 64 only!
/ * size 64 only!