From e4f931a6c03d0cac5db470649d693f09c4d89665 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 4 Nov 2024 15:19:16 +0530 Subject: [PATCH] Encoder LTV crash fixes and Q-info updates for lib_com --- lib_com/fft_evs.c | 74 +- lib_com/fft_fx.c | 1753 +++++++++++++++++---------------- lib_com/fft_fx_evs.c | 700 ++++++------- lib_com/ppp_fx.c | 18 +- lib_com/pred_lt4_fx.c | 75 +- lib_com/preemph.c | 16 +- lib_com/preemph_fx.c | 121 ++- lib_com/prot.h | 8 +- lib_com/prot_fx.h | 70 +- lib_enc/ivas_stereo_dmx_evs.c | 9 +- 10 files changed, 1459 insertions(+), 1385 deletions(-) diff --git a/lib_com/fft_evs.c b/lib_com/fft_evs.c index cffdac16b..e53404f0b 100644 --- a/lib_com/fft_evs.c +++ b/lib_com/fft_evs.c @@ -104,17 +104,17 @@ void fft16_with_cmplx_data( cmplx *pInp, Word16 bsacle ); * * \return void */ -static void fft5_with_cmplx_data( cmplx *inp ) +static void fft5_with_cmplx_data( cmplx *inp /*Qx*/ ) { cmplx x0, x1, x2, x3, x4; cmplx y1, y2, y3, y4; cmplx t; - x0 = CL_shr( inp[0], SCALEFACTOR5 ); - x1 = CL_shr( inp[1], SCALEFACTOR5 ); - x2 = CL_shr( inp[2], SCALEFACTOR5 ); - x3 = CL_shr( inp[3], SCALEFACTOR5 ); - x4 = CL_shr( inp[4], SCALEFACTOR5 ); + x0 = CL_shr( inp[0], SCALEFACTOR5 ); // Qx - 4 + x1 = CL_shr( inp[1], SCALEFACTOR5 ); // Qx - 4 + x2 = CL_shr( inp[2], SCALEFACTOR5 ); // Qx - 4 + x3 = CL_shr( inp[3], SCALEFACTOR5 ); // Qx - 4 + x4 = CL_shr( inp[4], SCALEFACTOR5 ); // Qx - 4 y1 = CL_add( x1, x4 ); y4 = CL_sub( x1, x4 ); @@ -162,14 +162,14 @@ static void fft5_with_cmplx_data( cmplx *inp ) * * \return void */ -static void fft8_with_cmplx_data( cmplx *inp ) +static void fft8_with_cmplx_data( cmplx *inp /*Qx*/ ) { cmplx x0, x1, x2, x3, x4, x5, x6, x7; cmplx s0, s1, s2, s3, s4, s5, s6, s7; cmplx t0, t1, t2, t3, t4, t5, t6, t7; /* Pre-additions */ - x0 = CL_shr( inp[0], SCALEFACTOR8 ); + x0 = CL_shr( inp[0], SCALEFACTOR8 ); // Qx - 4 x1 = CL_shr( inp[1], SCALEFACTOR8 ); x2 = CL_shr( inp[2], SCALEFACTOR8 ); x3 = CL_shr( inp[3], SCALEFACTOR8 ); @@ -244,7 +244,7 @@ static void fft8_with_cmplx_data( cmplx *inp ) * \return void */ -static void fft10_with_cmplx_data( cmplx *inp_data ) +static void fft10_with_cmplx_data( cmplx *inp_data /*Qx*/ ) { cmplx r1, r2, r3, r4; cmplx x0, x1, x2, x3, x4, t; @@ -252,7 +252,7 @@ static void fft10_with_cmplx_data( cmplx *inp_data ) /* FOR i=0 */ { - x0 = CL_shr( inp_data[0], SCALEFACTOR10 ); + x0 = CL_shr( inp_data[0], SCALEFACTOR10 ); // Qx - 5 x1 = CL_shr( inp_data[2], SCALEFACTOR10 ); x2 = CL_shr( inp_data[4], SCALEFACTOR10 ); x3 = CL_shr( inp_data[6], SCALEFACTOR10 ); @@ -280,7 +280,7 @@ static void fft10_with_cmplx_data( cmplx *inp_data ) } /* FOR i=1 */ { - x0 = CL_shr( inp_data[5], SCALEFACTOR10 ); + x0 = CL_shr( inp_data[5], SCALEFACTOR10 ); // Qx - 5 x1 = CL_shr( inp_data[1], SCALEFACTOR10 ); x2 = CL_shr( inp_data[3], SCALEFACTOR10 ); x3 = CL_shr( inp_data[7], SCALEFACTOR10 ); @@ -353,14 +353,14 @@ static void fft10_with_cmplx_data( cmplx *inp_data ) * \return void */ -static void fft15_with_cmplx_data( cmplx *inp_data ) +static void fft15_with_cmplx_data( cmplx *inp_data /*Qx*/ ) { cmplx c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14; cmplx c_z0, c_z1, c_z2, c_z3, c_z4, c_z5, c_z6, c_z7, c_z8, c_z9, c_z10, c_z11, c_z12, c_z13, c_z14; cmplx c_y1, c_y2, c_y3, c_y4; cmplx c_t; - c0 = CL_shr( inp_data[0], SCALEFACTOR15 ); + c0 = CL_shr( inp_data[0], SCALEFACTOR15 ); // Qx - 5 c1 = CL_shr( inp_data[3], SCALEFACTOR15 ); c2 = CL_shr( inp_data[6], SCALEFACTOR15 ); c3 = CL_shr( inp_data[9], SCALEFACTOR15 ); @@ -497,8 +497,8 @@ static void fft15_with_cmplx_data( cmplx *inp_data ) * WOPS with 32x16 bit multiplications (scale on ): 288 cycles * WOPS with 32x16 bit multiplications (scale off): 256 cycles * - * \param [i/o] re real input / output - * \param [i/o] im imag input / output + * \param [i/o] re real input / output Qx + * \param [i/o] im imag input / output Qx * \param [i ] s stride real and imag input / output * * \return void @@ -529,7 +529,7 @@ void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ) } } -void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) +void fft16_with_cmplx_data( cmplx *input /*Qx*/, Word16 bScale ) { cmplx x0, x1, x2, x3, temp; cmplx t0, t2, t4, t6, t7; @@ -538,7 +538,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) IF( bScale ) { { - x0 = CL_shr( input[0], SCALEFACTOR16 ); + x0 = CL_shr( input[0], SCALEFACTOR16 ); // Qx - 5 x1 = CL_shr( input[4], SCALEFACTOR16 ); x2 = CL_shr( input[8], SCALEFACTOR16 ); x3 = CL_shr( input[12], SCALEFACTOR16 ); @@ -553,7 +553,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) y[3] = CL_add( t2, t6 ); - x0 = CL_shr( input[1], SCALEFACTOR16 ); + x0 = CL_shr( input[1], SCALEFACTOR16 ); // Qx - 5 x1 = CL_shr( input[5], SCALEFACTOR16 ); x2 = CL_shr( input[9], SCALEFACTOR16 ); x3 = CL_shr( input[13], SCALEFACTOR16 ); @@ -568,7 +568,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) y[7] = CL_add( t2, t6 ); - x0 = CL_shr( input[2], SCALEFACTOR16 ); + x0 = CL_shr( input[2], SCALEFACTOR16 ); // Qx - 5 x1 = CL_shr( input[6], SCALEFACTOR16 ); x2 = CL_shr( input[10], SCALEFACTOR16 ); x3 = CL_shr( input[14], SCALEFACTOR16 ); @@ -584,7 +584,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) y[11] = CL_add( t2, t6 ); - x0 = CL_shr( input[3], SCALEFACTOR16 ); + x0 = CL_shr( input[3], SCALEFACTOR16 ); // Qx - 5 x1 = CL_shr( input[7], SCALEFACTOR16 ); x2 = CL_shr( input[11], SCALEFACTOR16 ); x3 = CL_shr( input[15], SCALEFACTOR16 ); @@ -736,7 +736,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale ) * * \return void */ -static void fft20_with_cmplx_data( cmplx *inp_data ) +static void fft20_with_cmplx_data( cmplx *inp_data /*Qx*/ ) { cmplx r1, r2, r3, r4; cmplx x0, x1, x2, x3, x4; @@ -751,7 +751,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data ) y4 = &y[12]; { - x0 = CL_shr( inp_data[0], SCALEFACTOR20 ); + x0 = CL_shr( inp_data[0], SCALEFACTOR20 ); // Qx - 5 x1 = CL_shr( inp_data[16], SCALEFACTOR20 ); x2 = CL_shr( inp_data[12], SCALEFACTOR20 ); x3 = CL_shr( inp_data[8], SCALEFACTOR20 ); @@ -778,7 +778,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data ) y4[0] = CL_msu_j( r3, r4 ); } { - x0 = CL_shr( inp_data[5], SCALEFACTOR20 ); + x0 = CL_shr( inp_data[5], SCALEFACTOR20 ); // Qx - 5 x1 = CL_shr( inp_data[1], SCALEFACTOR20 ); x2 = CL_shr( inp_data[17], SCALEFACTOR20 ); x3 = CL_shr( inp_data[13], SCALEFACTOR20 ); @@ -805,7 +805,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data ) y4[1] = CL_msu_j( r3, r4 ); } { - x0 = CL_shr( inp_data[10], SCALEFACTOR20 ); + x0 = CL_shr( inp_data[10], SCALEFACTOR20 ); // Qx - 5 x1 = CL_shr( inp_data[6], SCALEFACTOR20 ); x2 = CL_shr( inp_data[2], SCALEFACTOR20 ); x3 = CL_shr( inp_data[18], SCALEFACTOR20 ); @@ -832,7 +832,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data ) y4[2] = CL_msu_j( r3, r4 ); } { - x0 = CL_shr( inp_data[15], SCALEFACTOR20 ); + x0 = CL_shr( inp_data[15], SCALEFACTOR20 ); // Qx - 5 x1 = CL_shr( inp_data[11], SCALEFACTOR20 ); x2 = CL_shr( inp_data[7], SCALEFACTOR20 ); x3 = CL_shr( inp_data[3], SCALEFACTOR20 ); @@ -985,7 +985,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data ) * \return void */ -static void fft30_with_cmplx_data( cmplx *inp ) +static void fft30_with_cmplx_data( cmplx *inp /*Qx*/ ) { cmplx *l = &inp[0]; cmplx *h = &inp[15]; @@ -994,19 +994,19 @@ static void fft30_with_cmplx_data( cmplx *inp ) /* 1. FFT15 stage */ - x[0] = CL_shr( inp[0], SCALEFACTOR30_1 ); + x[0] = CL_shr( inp[0], SCALEFACTOR30_1 ); // Qx - 5 x[1] = CL_shr( inp[18], SCALEFACTOR30_1 ); x[2] = CL_shr( inp[6], SCALEFACTOR30_1 ); x[3] = CL_shr( inp[24], SCALEFACTOR30_1 ); x[4] = CL_shr( inp[12], SCALEFACTOR30_1 ); - x[5] = CL_shr( inp[20], SCALEFACTOR30_1 ); + x[5] = CL_shr( inp[20], SCALEFACTOR30_1 ); // Qx - 5 x[6] = CL_shr( inp[8], SCALEFACTOR30_1 ); x[7] = CL_shr( inp[26], SCALEFACTOR30_1 ); x[8] = CL_shr( inp[14], SCALEFACTOR30_1 ); x[9] = CL_shr( inp[2], SCALEFACTOR30_1 ); - x[10] = CL_shr( inp[10], SCALEFACTOR30_1 ); + x[10] = CL_shr( inp[10], SCALEFACTOR30_1 ); // Qx - 5 x[11] = CL_shr( inp[28], SCALEFACTOR30_1 ); x[12] = CL_shr( inp[16], SCALEFACTOR30_1 ); x[13] = CL_shr( inp[4], SCALEFACTOR30_1 ); @@ -1140,19 +1140,19 @@ static void fft30_with_cmplx_data( cmplx *inp ) /* 2. FFT15 stage */ - x[0] = CL_shr( inp[15], SCALEFACTOR30_1 ); + x[0] = CL_shr( inp[15], SCALEFACTOR30_1 ); // Qx - 5 x[1] = CL_shr( inp[3], SCALEFACTOR30_1 ); x[2] = CL_shr( inp[21], SCALEFACTOR30_1 ); x[3] = CL_shr( inp[9], SCALEFACTOR30_1 ); x[4] = CL_shr( inp[27], SCALEFACTOR30_1 ); - x[5] = CL_shr( inp[5], SCALEFACTOR30_1 ); + x[5] = CL_shr( inp[5], SCALEFACTOR30_1 ); // Qx - 5 x[6] = CL_shr( inp[23], SCALEFACTOR30_1 ); x[7] = CL_shr( inp[11], SCALEFACTOR30_1 ); x[8] = CL_shr( inp[29], SCALEFACTOR30_1 ); x[9] = CL_shr( inp[17], SCALEFACTOR30_1 ); - x[10] = CL_shr( inp[25], SCALEFACTOR30_1 ); + x[10] = CL_shr( inp[25], SCALEFACTOR30_1 ); // Qx - 5 x[11] = CL_shr( inp[13], SCALEFACTOR30_1 ); x[12] = CL_shr( inp[1], SCALEFACTOR30_1 ); x[13] = CL_shr( inp[19], SCALEFACTOR30_1 ); @@ -1425,14 +1425,14 @@ static void fft30_with_cmplx_data( cmplx *inp ) */ -static void fft32_with_cmplx_data( cmplx *inp ) +static void fft32_with_cmplx_data( cmplx *inp /*Qx*/ ) { cmplx x[32], y[32], t[32], s[32], temp, temp1; const cmplx_s *pRotVector_32 = (const cmplx_s *) RotVector_32; /* 1. FFT8 stage */ - x[0] = CL_shr( inp[0], SCALEFACTOR32_1 ); + x[0] = CL_shr( inp[0], SCALEFACTOR32_1 ); // Qx - 5 x[1] = CL_shr( inp[4], SCALEFACTOR32_1 ); x[2] = CL_shr( inp[8], SCALEFACTOR32_1 ); x[3] = CL_shr( inp[12], SCALEFACTOR32_1 ); @@ -1478,7 +1478,7 @@ static void fft32_with_cmplx_data( cmplx *inp ) /* 2. FFT8 stage */ - x[0] = CL_shr( inp[1], SCALEFACTOR32_1 ); + x[0] = CL_shr( inp[1], SCALEFACTOR32_1 ); // Qx - 5 x[1] = CL_shr( inp[5], SCALEFACTOR32_1 ); x[2] = CL_shr( inp[9], SCALEFACTOR32_1 ); x[3] = CL_shr( inp[13], SCALEFACTOR32_1 ); @@ -1525,7 +1525,7 @@ static void fft32_with_cmplx_data( cmplx *inp ) /* 3. FFT8 stage */ - x[0] = CL_shr( inp[2], SCALEFACTOR32_1 ); + x[0] = CL_shr( inp[2], SCALEFACTOR32_1 ); // Qx - 5 x[1] = CL_shr( inp[6], SCALEFACTOR32_1 ); x[2] = CL_shr( inp[10], SCALEFACTOR32_1 ); x[3] = CL_shr( inp[14], SCALEFACTOR32_1 ); @@ -1572,7 +1572,7 @@ static void fft32_with_cmplx_data( cmplx *inp ) /* 4. FFT8 stage */ - x[0] = CL_shr( inp[3], SCALEFACTOR32_1 ); + x[0] = CL_shr( inp[3], SCALEFACTOR32_1 ); // Qx - 5 x[1] = CL_shr( inp[7], SCALEFACTOR32_1 ); x[2] = CL_shr( inp[11], SCALEFACTOR32_1 ); x[3] = CL_shr( inp[15], SCALEFACTOR32_1 ); diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 27adc56fe..6b8b49bd2 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -65,32 +65,32 @@ #define FFTC( x ) WORD322WORD16( (Word32) x ) /* DCT related */ -#define KP559016994_16FX ( FFTC( 1200479845 ) ) /* EDCT & EMDCT constants */ -#define KP951056516_16FX ( FFTC( 2042378325 ) ) /* EDCT & EMDCT constants */ -#define KP587785252_16FX ( FFTC( 1262259213 ) ) /* EDCT & EMDCT constants */ +#define KP559016994_16FX ( FFTC( 1200479845 ) ) /* EDCT & EMDCT constants Q15*/ +#define KP951056516_16FX ( FFTC( 2042378325 ) ) /* EDCT & EMDCT constants Q15*/ +#define KP587785252_16FX ( FFTC( 1262259213 ) ) /* EDCT & EMDCT constants Q15*/ -#define FFT_15PONIT_WNK1 ( FFTC( 0x478dde64 ) ) /* EDCT & EMDCT constants */ -#define FFT_15PONIT_WNK2 ( FFTC( 0x79bc3854 ) ) /* EDCT & EMDCT constants */ -#define FFT_15PONIT_WNK3 ( FFTC( 0x4B3C8C0D ) ) /* EDCT & EMDCT constants */ -#define FFT_15PONIT_WNK4 ( FFTC( 0x6ED9EBA0 ) ) /* EDCT & EMDCT constants */ -#define FFT_15PONIT_WNK5 ( FFTC( 0x20000000 ) ) /* EDCT & EMDCT constants */ +#define FFT_15PONIT_WNK1 ( FFTC( 0x478dde64 ) ) /* EDCT & EMDCT constants Q15*/ +#define FFT_15PONIT_WNK2 ( FFTC( 0x79bc3854 ) ) /* EDCT & EMDCT constants Q15*/ +#define FFT_15PONIT_WNK3 ( FFTC( 0x4B3C8C0D ) ) /* EDCT & EMDCT constants Q15*/ +#define FFT_15PONIT_WNK4 ( FFTC( 0x6ED9EBA0 ) ) /* EDCT & EMDCT constants Q15*/ +#define FFT_15PONIT_WNK5 ( FFTC( 0x20000000 ) ) /* EDCT & EMDCT constants Q15*/ /* FFT constants */ -#define FFT_C31 ( FFTC( 0x91261468 ) ) /* FL2WORD32( -0.86602540) -sqrt(3)/2 */ -#define FFT_C51 ( FFTC( 0x79bc3854 ) ) /* FL2WORD32( 0.95105652) */ -#define FFT_C52 ( FFTC( 0x9d839db0 ) ) /* FL2WORD32(-1.53884180/2) */ -#define FFT_C53 ( FFTC( 0xd18053ce ) ) /* FL2WORD32(-0.36327126) */ -#define FFT_C54 ( FFTC( 0x478dde64 ) ) /* FL2WORD32( 0.55901699) */ -#define FFT_C55 ( FFTC( 0xb0000001 ) ) /* FL2WORD32(-1.25/2) */ -#define FFT_C61 ( FFTC( 0x6ED9EBA0 ) ) -#define FFT_C81 ( FFTC( 0x5a82799a ) ) -#define FFT_C82 ( FFTC( 0xa57d8666 ) ) -#define FFT_C161 ( FFTC( 0x5a82799a ) ) /* FL2WORD32( 7.071067811865475e-1) INV_SQRT2 */ -#define FFT_C162 ( FFTC( 0xa57d8666 ) ) /* FL2WORD32(-7.071067811865475e-1) -INV_SQRT2 */ -#define FFT_C163 ( FFTC( 0x7641af3d ) ) /* FL2WORD32( 9.238795325112867e-1) COS_PI_DIV8 */ -#define FFT_C164 ( FFTC( 0x89be50c3 ) ) /* FL2WORD32(-9.238795325112867e-1) -COS_PI_DIV8 */ -#define FFT_C165 ( FFTC( 0x30fbc54d ) ) /* FL2WORD32( 3.826834323650898e-1) COS_3PI_DIV8 */ -#define FFT_C166 ( FFTC( 0xcf043ab3 ) ) /* FL2WORD32(-3.826834323650898e-1) -COS_3PI_DIV8 */ +#define FFT_C31 ( FFTC( 0x91261468 ) ) /* FL2WORD32( -0.86602540) -sqrt(3)/2 Q15*/ +#define FFT_C51 ( FFTC( 0x79bc3854 ) ) /* FL2WORD32( 0.95105652) Q15*/ +#define FFT_C52 ( FFTC( 0x9d839db0 ) ) /* FL2WORD32(-1.53884180/2) Q15*/ +#define FFT_C53 ( FFTC( 0xd18053ce ) ) /* FL2WORD32(-0.36327126) Q15*/ +#define FFT_C54 ( FFTC( 0x478dde64 ) ) /* FL2WORD32( 0.55901699) Q15*/ +#define FFT_C55 ( FFTC( 0xb0000001 ) ) /* FL2WORD32(-1.25/2) Q15*/ +#define FFT_C61 ( FFTC( 0x6ED9EBA0 ) ) // Q15 +#define FFT_C81 ( FFTC( 0x5a82799a ) ) // Q15 +#define FFT_C82 ( FFTC( 0xa57d8666 ) ) // Q15 +#define FFT_C161 ( FFTC( 0x5a82799a ) ) /* FL2WORD32( 7.071067811865475e-1) INV_SQRT2 Q15*/ +#define FFT_C162 ( FFTC( 0xa57d8666 ) ) /* FL2WORD32(-7.071067811865475e-1) -INV_SQRT2 Q15*/ +#define FFT_C163 ( FFTC( 0x7641af3d ) ) /* FL2WORD32( 9.238795325112867e-1) COS_PI_DIV8 Q15*/ +#define FFT_C164 ( FFTC( 0x89be50c3 ) ) /* FL2WORD32(-9.238795325112867e-1) -COS_PI_DIV8 Q15*/ +#define FFT_C165 ( FFTC( 0x30fbc54d ) ) /* FL2WORD32( 3.826834323650898e-1) COS_3PI_DIV8 Q15*/ +#define FFT_C166 ( FFTC( 0xcf043ab3 ) ) /* FL2WORD32(-3.826834323650898e-1) -COS_3PI_DIV8 Q15*/ #define SCALEFACTOR16 ( 0 ) #define SCALEFACTOR20 ( 0 ) @@ -167,9 +167,9 @@ void DoRTFTn_fx_ivas( static void fft15_shift2( Word16 n1, /* i : length of data */ - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 in0, in8, in16, in24, in32, in1, in9, in17, in25, in33, in2, in10, in18, in26, in34; @@ -192,47 +192,47 @@ static void fft15_shift2( move16(); in16 = Idx[n1 * 2]; move16(); - in24 = Idx[i_mult( n1, 3 )]; + in24 = Idx[( n1 * 3 )]; move16(); in32 = Idx[n1 * 4]; move16(); - in1 = Idx[i_mult( n1, 5 )]; + in1 = Idx[( n1 * 5 )]; move16(); in9 = Idx[n1 * 6]; move16(); - in17 = Idx[i_mult( n1, 7 )]; + in17 = Idx[( n1 * 7 )]; move16(); in25 = Idx[n1 * 8]; move16(); - in33 = Idx[i_mult( n1, 9 )]; + in33 = Idx[( n1 * 9 )]; move16(); in2 = Idx[n1 * 10]; move16(); - in10 = Idx[i_mult( n1, 11 )]; + in10 = Idx[( n1 * 11 )]; move16(); in18 = Idx[n1 * 12]; move16(); - in26 = Idx[i_mult( n1, 13 )]; + in26 = Idx[( n1 * 13 )]; move16(); in34 = Idx[n1 * 14]; move16(); - f2i13 = zRe[in0]; + f2i13 = zRe[in0]; // Qx move32(); - f2i14 = zIm[in0]; + f2i14 = zIm[in0]; // Qx move32(); - f2i21 = zRe[in1]; + f2i21 = zRe[in1]; // Qx move32(); - f2i22 = zRe[in2]; + f2i22 = zRe[in2]; // Qx move32(); - f2i23 = zIm[in1]; + f2i23 = zIm[in1]; // Qx move32(); - f2i24 = zIm[in2]; + f2i24 = zIm[in2]; // Qx move32(); f2i15 = L_add( f2i21, f2i22 ); - f2i16 = Mpy_32_16_1( L_sub( f2i22, f2i21 ), FFT_15PONIT_WNK4 ); - f2i17 = Mpy_32_16_1( L_sub( f2i23, f2i24 ), FFT_15PONIT_WNK4 ); + f2i16 = Mpy_32_16_1( L_sub( f2i22, f2i21 ), FFT_15PONIT_WNK4 ); // Qx + f2i17 = Mpy_32_16_1( L_sub( f2i23, f2i24 ), FFT_15PONIT_WNK4 ); // Qx f2i18 = L_add( f2i23, f2i24 ); fi1 = L_add( f2i13, f2i15 ); fi2 = L_add( f2i14, f2i18 ); @@ -244,44 +244,44 @@ static void fft15_shift2( fi5 = L_add( f2i16, f2i20 ); fi6 = L_sub( f2i20, f2i16 ); - f3i1 = zRe[in9]; + f3i1 = zRe[in9]; // Qx move32(); - f4i2 = zRe[in10]; + f4i2 = zRe[in10]; // Qx move32(); - f4i3 = zRe[in8]; + f4i3 = zRe[in8]; // Qx move32(); f3i2 = L_add( f4i2, f4i3 ); f3i3 = L_sub( f3i1, L_shr( f3i2, 1 ) ); - f3i4 = Mpy_32_16_1( L_sub( f4i3, f4i2 ), FFT_15PONIT_WNK4 ); + f3i4 = Mpy_32_16_1( L_sub( f4i3, f4i2 ), FFT_15PONIT_WNK4 ); // Qx - f3i5 = zIm[in9]; + f3i5 = zIm[in9]; // Qx move32(); - f4i4 = zIm[in10]; + f4i4 = zIm[in10]; // Qx move32(); - f4i5 = zIm[in8]; + f4i5 = zIm[in8]; // Qx move32(); f3i6 = L_add( f4i4, f4i5 ); - f3i7 = Mpy_32_16_1( L_sub( f4i4, f4i5 ), FFT_15PONIT_WNK4 ); + f3i7 = Mpy_32_16_1( L_sub( f4i4, f4i5 ), FFT_15PONIT_WNK4 ); // Qx f3i8 = L_sub( f3i5, L_shr( f3i6, 1 ) ); - f3i9 = zRe[in33]; + f3i9 = zRe[in33]; // Qx move32(); - f4i6 = zRe[in34]; + f4i6 = zRe[in34]; // Qx move32(); - f4i7 = zRe[in32]; + f4i7 = zRe[in32]; // Qx move32(); f3i10 = L_add( f4i6, f4i7 ); f3i11 = L_sub( f3i9, L_shr( f3i10, 1 ) ); - f3i12 = Mpy_32_16_1( L_sub( f4i7, f4i6 ), FFT_15PONIT_WNK4 ); + f3i12 = Mpy_32_16_1( L_sub( f4i7, f4i6 ), FFT_15PONIT_WNK4 ); // Qx - f3i13 = zIm[in33]; + f3i13 = zIm[in33]; // Qx move32(); - f4i8 = zIm[in34]; + f4i8 = zIm[in34]; // Qx move32(); - f4i9 = zIm[in32]; + f4i9 = zIm[in32]; // Qx move32(); f3i14 = L_add( f4i8, f4i9 ); - f3i15 = Mpy_32_16_1( L_sub( f4i8, f4i9 ), FFT_15PONIT_WNK4 ); + f3i15 = Mpy_32_16_1( L_sub( f4i8, f4i9 ), FFT_15PONIT_WNK4 ); // Qx f4i1 = L_sub( f3i13, L_shr( f3i14, 1 ) ); fi7 = L_add( f3i1, f3i2 ); @@ -303,44 +303,44 @@ static void fft15_shift2( fi23 = L_add( f3i11, f3i15 ); fi24 = L_add( fi22, fi23 ); - f4i10 = zRe[in24]; + f4i10 = zRe[in24]; // Qx move32(); - fo6 = zRe[in25]; + fo6 = zRe[in25]; // Qx move32(); - fo7 = zRe[in26]; + fo7 = zRe[in26]; // Qx move32(); f4i11 = L_add( fo6, fo7 ); f4i12 = L_sub( f4i10, L_shr( f4i11, 1 ) ); - f4i13 = Mpy_32_16_1( L_sub( fo7, fo6 ), FFT_15PONIT_WNK4 ); + f4i13 = Mpy_32_16_1( L_sub( fo7, fo6 ), FFT_15PONIT_WNK4 ); // Qx - f4i14 = zIm[in24]; + f4i14 = zIm[in24]; // Qx move32(); - fo8 = zIm[in25]; + fo8 = zIm[in25]; // Qx move32(); - fo9 = zIm[in26]; + fo9 = zIm[in26]; // Qx move32(); f4i15 = L_add( fo8, fo9 ); - f4i16 = Mpy_32_16_1( L_sub( fo8, fo9 ), FFT_15PONIT_WNK4 ); + f4i16 = Mpy_32_16_1( L_sub( fo8, fo9 ), FFT_15PONIT_WNK4 ); // Qx f4i17 = L_sub( f4i14, L_shr( f4i15, 1 ) ); - f4i18 = zRe[in18]; + f4i18 = zRe[in18]; // Qx move32(); - f2o10 = zRe[in16]; + f2o10 = zRe[in16]; // Qx move32(); - f2o11 = zRe[in17]; + f2o11 = zRe[in17]; // Qx move32(); f4i19 = L_add( f2o10, f2o11 ); f4i20 = L_sub( f4i18, L_shr( f4i19, 1 ) ); - fo1 = Mpy_32_16_1( L_sub( f2o11, f2o10 ), FFT_15PONIT_WNK4 ); + fo1 = Mpy_32_16_1( L_sub( f2o11, f2o10 ), FFT_15PONIT_WNK4 ); // Qx - fo2 = zIm[in18]; + fo2 = zIm[in18]; // Qx move32(); - f2o12 = zIm[in16]; + f2o12 = zIm[in16]; // Qx move32(); - f2o13 = zIm[in17]; + f2o13 = zIm[in17]; // Qx move32(); fo3 = L_add( f2o12, f2o13 ); - fo4 = Mpy_32_16_1( L_sub( f2o12, f2o13 ), FFT_15PONIT_WNK4 ); + fo4 = Mpy_32_16_1( L_sub( f2o12, f2o13 ), FFT_15PONIT_WNK4 ); // Qx fo5 = L_sub( fo2, L_shr( fo3, 1 ) ); fi25 = L_add( f4i10, f4i11 ); @@ -362,13 +362,13 @@ static void fft15_shift2( f2i11 = L_add( f4i20, fo4 ); f2i12 = L_add( f2i10, f2i11 ); - fo10 = Mpy_32_16_1( L_sub( fi27, fi9 ), FFT_15PONIT_WNK1 ); + fo10 = Mpy_32_16_1( L_sub( fi27, fi9 ), FFT_15PONIT_WNK1 ); // Qx fo11 = L_add( fi27, fi9 ); - fo12 = L_sub( fi1, Mpy_32_16_1( fo11, FFT_15PONIT_WNK5 ) ); + fo12 = L_sub( fi1, Mpy_32_16_1( fo11, FFT_15PONIT_WNK5 ) ); // Qx fo15 = L_sub( fi13, fi14 ); fo16 = L_sub( f2i1, f2i2 ); - fo13 = L_sub( Mpy_32_16_1( fo15, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo16, FFT_15PONIT_WNK3 ) ); - fo14 = L_add( Mpy_32_16_1( fo15, FFT_15PONIT_WNK3 ), Mpy_32_16_1( fo16, FFT_15PONIT_WNK2 ) ); + fo13 = L_sub( Mpy_32_16_1( fo15, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo16, FFT_15PONIT_WNK3 ) ); // Qx + fo14 = L_add( Mpy_32_16_1( fo15, FFT_15PONIT_WNK3 ), Mpy_32_16_1( fo16, FFT_15PONIT_WNK2 ) ); // Qx zRe[in0] = L_add( fi1, fo11 ); move32(); @@ -383,13 +383,13 @@ static void fft15_shift2( zRe[in33] = L_add( fo18, fo13 ); move32(); - f2o1 = Mpy_32_16_1( L_sub( f2i3, fi15 ), FFT_15PONIT_WNK1 ); + f2o1 = Mpy_32_16_1( L_sub( f2i3, fi15 ), FFT_15PONIT_WNK1 ); // Qx f2o2 = L_add( f2i3, fi15 ); - f2o3 = L_sub( fi2, Mpy_32_16_1( f2o2, FFT_15PONIT_WNK5 ) ); + f2o3 = L_sub( fi2, Mpy_32_16_1( f2o2, FFT_15PONIT_WNK5 ) ); // Qx f2o6 = L_sub( fi7, fi8 ); f2o7 = L_sub( fi25, fi26 ); - f2o4 = L_sub( Mpy_32_16_1( f2o6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f2o7, FFT_15PONIT_WNK3 ) ); - f2o5 = L_add( Mpy_32_16_1( f2o6, FFT_15PONIT_WNK3 ), Mpy_32_16_1( f2o7, FFT_15PONIT_WNK2 ) ); + f2o4 = L_sub( Mpy_32_16_1( f2o6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f2o7, FFT_15PONIT_WNK3 ) ); // Qx + f2o5 = L_add( Mpy_32_16_1( f2o6, FFT_15PONIT_WNK3 ), Mpy_32_16_1( f2o7, FFT_15PONIT_WNK2 ) ); // Qx zIm[in0] = L_add( fi2, f2o2 ); move32(); f2o8 = L_add( f2o1, f2o3 ); @@ -403,13 +403,13 @@ static void fft15_shift2( zIm[in9] = L_add( f2o4, f2o9 ); move32(); - f2o14 = Mpy_32_16_1( L_sub( fi30, fi12 ), FFT_15PONIT_WNK1 ); + f2o14 = Mpy_32_16_1( L_sub( fi30, fi12 ), FFT_15PONIT_WNK1 ); // Qx f2o15 = L_add( fi30, fi12 ); - f3o1 = L_sub( fi3, Mpy_32_16_1( f2o15, FFT_15PONIT_WNK5 ) ); + f3o1 = L_sub( fi3, Mpy_32_16_1( f2o15, FFT_15PONIT_WNK5 ) ); // Qx f3o4 = L_sub( fi16, fi17 ); f3o5 = L_sub( f2i4, f2i5 ); - f3o2 = L_sub( Mpy_32_16_1( f3o4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o5, FFT_15PONIT_WNK3 ) ); - f3o3 = L_add( Mpy_32_16_1( f3o5, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o4, FFT_15PONIT_WNK3 ) ); + f3o2 = L_sub( Mpy_32_16_1( f3o4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o5, FFT_15PONIT_WNK3 ) ); // Qx + f3o3 = L_add( Mpy_32_16_1( f3o5, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o4, FFT_15PONIT_WNK3 ) ); // Qx zRe[in2] = L_add( fi3, f2o15 ); move32(); f3o6 = L_add( f2o14, f3o1 ); @@ -423,13 +423,13 @@ static void fft15_shift2( zRe[in32] = L_add( f3o7, f3o2 ); move32(); - f3o8 = Mpy_32_16_1( L_sub( f2i6, fi18 ), FFT_15PONIT_WNK1 ); + f3o8 = Mpy_32_16_1( L_sub( f2i6, fi18 ), FFT_15PONIT_WNK1 ); // Qx f3o9 = L_add( f2i6, fi18 ); - f3o10 = L_sub( fi6, Mpy_32_16_1( f3o9, FFT_15PONIT_WNK5 ) ); + f3o10 = L_sub( fi6, Mpy_32_16_1( f3o9, FFT_15PONIT_WNK5 ) ); // Qx f3o13 = L_sub( fi10, fi11 ); f3o14 = L_sub( fi28, fi29 ); - f3o11 = L_sub( Mpy_32_16_1( f3o13, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o14, FFT_15PONIT_WNK3 ) ); - f3o12 = L_add( Mpy_32_16_1( f3o14, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o13, FFT_15PONIT_WNK3 ) ); + f3o11 = L_sub( Mpy_32_16_1( f3o13, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o14, FFT_15PONIT_WNK3 ) ); // Qx + f3o12 = L_add( Mpy_32_16_1( f3o14, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o13, FFT_15PONIT_WNK3 ) ); // Qx zIm[in2] = L_add( fi6, f3o9 ); move32(); f3o15 = L_add( f3o8, f3o10 ); @@ -443,13 +443,13 @@ static void fft15_shift2( zIm[in32] = L_sub( f4o1, f3o11 ); move32(); - f4o2 = Mpy_32_16_1( L_sub( f2i9, fi21 ), FFT_15PONIT_WNK1 ); + f4o2 = Mpy_32_16_1( L_sub( f2i9, fi21 ), FFT_15PONIT_WNK1 ); // Qx f4o3 = L_add( f2i9, fi21 ); - f4o4 = L_sub( fi5, Mpy_32_16_1( f4o3, FFT_15PONIT_WNK5 ) ); + f4o4 = L_sub( fi5, Mpy_32_16_1( f4o3, FFT_15PONIT_WNK5 ) ); // Qx f4o7 = L_sub( f2i10, f2i11 ); f4o8 = L_sub( fi22, fi23 ); - f4o5 = L_add( Mpy_32_16_1( f4o8, FFT_15PONIT_WNK3 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK2 ) ); - f4o6 = L_sub( Mpy_32_16_1( f4o8, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK3 ) ); + f4o5 = L_add( Mpy_32_16_1( f4o8, FFT_15PONIT_WNK3 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK2 ) ); // Qx + f4o6 = L_sub( Mpy_32_16_1( f4o8, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK3 ) ); // Qx zIm[in1] = L_add( fi5, f4o3 ); move32(); f4o9 = L_sub( f4o4, f4o2 ); @@ -464,13 +464,13 @@ static void fft15_shift2( zIm[in16] = L_add( f4o5, f4o10 ); move32(); - f4o11 = Mpy_32_16_1( L_sub( f2i12, fi24 ), FFT_15PONIT_WNK1 ); + f4o11 = Mpy_32_16_1( L_sub( f2i12, fi24 ), FFT_15PONIT_WNK1 ); // Qx f4o12 = L_add( f2i12, fi24 ); - f4o13 = L_sub( fi4, Mpy_32_16_1( f4o12, FFT_15PONIT_WNK5 ) ); + f4o13 = L_sub( fi4, Mpy_32_16_1( f4o12, FFT_15PONIT_WNK5 ) ); // Qx f4o16 = L_sub( f2i7, f2i8 ); f4o17 = L_sub( fi19, fi20 ); - f4o14 = L_add( Mpy_32_16_1( f4o16, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o17, FFT_15PONIT_WNK3 ) ); - f4o15 = L_sub( Mpy_32_16_1( f4o17, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o16, FFT_15PONIT_WNK3 ) ); + f4o14 = L_add( Mpy_32_16_1( f4o16, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o17, FFT_15PONIT_WNK3 ) ); // Qx + f4o15 = L_sub( Mpy_32_16_1( f4o17, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o16, FFT_15PONIT_WNK3 ) ); // Qx zRe[in1] = L_add( fi4, f4o12 ); move32(); f4o18 = L_sub( f4o13, f4o11 ); @@ -495,9 +495,9 @@ static void fft15_shift2( static void fft15_shift8( Word16 n1, /* i : length of data */ - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 in0, in8, in16, in24, in32, in1, in9, in17, in25, in33, in2, in10, in18, in26, in34; @@ -520,41 +520,41 @@ static void fft15_shift8( move16(); in16 = Idx[n1 * 2]; move16(); - in24 = Idx[i_mult( n1, 3 )]; + in24 = Idx[( n1 * 3 )]; move16(); in32 = Idx[n1 * 4]; move16(); - in1 = Idx[i_mult( n1, 5 )]; + in1 = Idx[( n1 * 5 )]; move16(); in9 = Idx[n1 * 6]; move16(); - in17 = Idx[i_mult( n1, 7 )]; + in17 = Idx[( n1 * 7 )]; move16(); in25 = Idx[n1 * 8]; move16(); - in33 = Idx[i_mult( n1, 9 )]; + in33 = Idx[( n1 * 9 )]; move16(); in2 = Idx[n1 * 10]; move16(); - in10 = Idx[i_mult( n1, 11 )]; + in10 = Idx[( n1 * 11 )]; move16(); in18 = Idx[n1 * 12]; move16(); - in26 = Idx[i_mult( n1, 13 )]; + in26 = Idx[( n1 * 13 )]; move16(); in34 = Idx[n1 * 14]; move16(); - f2i13 = zRe[in0]; - f2i14 = zIm[in0]; - f3i6 = zRe[in1]; - f3i7 = zRe[in2]; - f3i8 = zIm[in1]; - f3i9 = zIm[in2]; + f2i13 = zRe[in0]; // Qx + f2i14 = zIm[in0]; // Qx + f3i6 = zRe[in1]; // Qx + f3i7 = zRe[in2]; // Qx + f3i8 = zIm[in1]; // Qx + f3i9 = zIm[in2]; // Qx f2i15 = L_add( f3i6, f3i7 ); - f3i1 = Mpy_32_16_1( L_sub( f3i7, f3i6 ), FFT_15PONIT_WNK4 ); - f3i2 = Mpy_32_16_1( L_sub( f3i8, f3i9 ), FFT_15PONIT_WNK4 ); + f3i1 = Mpy_32_16_1( L_sub( f3i7, f3i6 ), FFT_15PONIT_WNK4 ); // Qx + f3i2 = Mpy_32_16_1( L_sub( f3i8, f3i9 ), FFT_15PONIT_WNK4 ); // Qx f3i3 = L_add( f3i8, f3i9 ); fi1 = L_add( f2i13, f2i15 ); @@ -594,15 +594,15 @@ static void fft15_shift8( f3i11 = L_add( f4i11, f4i12 ); f3i12 = L_sub( f3i10, L_shr( f3i11, 1 ) ); - f3i13 = Mpy_32_16_1( L_sub( f4i12, f4i11 ), FFT_15PONIT_WNK4 ); + f3i13 = Mpy_32_16_1( L_sub( f4i12, f4i11 ), FFT_15PONIT_WNK4 ); // Qx f3i15 = L_add( f4i13, f4i14 ); - f4i1 = Mpy_32_16_1( L_sub( f4i13, f4i14 ), FFT_15PONIT_WNK4 ); + f4i1 = Mpy_32_16_1( L_sub( f4i13, f4i14 ), FFT_15PONIT_WNK4 ); // Qx f4i2 = L_sub( f3i14, L_shr( f3i15, 1 ) ); f4i4 = L_add( f4i15, fo1 ); f4i5 = L_sub( f4i3, L_shr( f4i4, 1 ) ); - f4i6 = Mpy_32_16_1( L_sub( fo1, f4i15 ), FFT_15PONIT_WNK4 ); + f4i6 = Mpy_32_16_1( L_sub( fo1, f4i15 ), FFT_15PONIT_WNK4 ); // Qx f4i8 = L_add( fo2, fo3 ); - f4i9 = Mpy_32_16_1( L_sub( fo2, fo3 ), FFT_15PONIT_WNK4 ); + f4i9 = Mpy_32_16_1( L_sub( fo2, fo3 ), FFT_15PONIT_WNK4 ); // Qx f4i10 = L_sub( f4i7, L_shr( f4i8, 1 ) ); fi7 = L_add( f3i10, f3i11 ); @@ -652,15 +652,15 @@ static void fft15_shift8( fo5 = L_add( f2o5, f2o6 ); fo6 = L_sub( fo4, L_shr( fo5, 1 ) ); - fo7 = Mpy_32_16_1( L_sub( f2o6, f2o5 ), FFT_15PONIT_WNK4 ); + fo7 = Mpy_32_16_1( L_sub( f2o6, f2o5 ), FFT_15PONIT_WNK4 ); // Qx fo9 = L_add( f2o7, f2o8 ); - fo10 = Mpy_32_16_1( L_sub( f2o7, f2o8 ), FFT_15PONIT_WNK4 ); + fo10 = Mpy_32_16_1( L_sub( f2o7, f2o8 ), FFT_15PONIT_WNK4 ); // Qx fo11 = L_sub( fo8, L_shr( fo9, 1 ) ); fo13 = L_add( f2o9, f2o10 ); fo14 = L_sub( fo12, L_shr( fo13, 1 ) ); - fo15 = Mpy_32_16_1( L_sub( f2o10, f2o9 ), FFT_15PONIT_WNK4 ); + fo15 = Mpy_32_16_1( L_sub( f2o10, f2o9 ), FFT_15PONIT_WNK4 ); // Qx f2o2 = L_add( f2o11, f2o12 ); - f2o3 = Mpy_32_16_1( L_sub( f2o11, f2o12 ), FFT_15PONIT_WNK4 ); + f2o3 = Mpy_32_16_1( L_sub( f2o11, f2o12 ), FFT_15PONIT_WNK4 ); // Qx f2o4 = L_sub( f2o1, L_shr( f2o2, 1 ) ); fi25 = L_add( fo4, fo5 ); @@ -682,13 +682,13 @@ static void fft15_shift8( f2i11 = L_add( fo14, f2o3 ); f2i12 = L_add( f2i10, f2i11 ); - f2o13 = Mpy_32_16_1( L_sub( fi27, fi9 ), FFT_15PONIT_WNK1 ); + f2o13 = Mpy_32_16_1( L_sub( fi27, fi9 ), FFT_15PONIT_WNK1 ); // Qx f2o14 = L_add( fi27, fi9 ); - f2o15 = L_sub( fi1, Mpy_32_16_1( f2o14, FFT_15PONIT_WNK5 ) ); + f2o15 = L_sub( fi1, Mpy_32_16_1( f2o14, FFT_15PONIT_WNK5 ) ); // Qx f3o3 = L_sub( fi13, fi14 ); f3o4 = L_sub( f2i1, f2i2 ); - f3o1 = L_sub( Mpy_32_16_1( f3o3, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o4, FFT_15PONIT_WNK3 ) ); - f3o2 = L_add( Mpy_32_16_1( f3o4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o3, FFT_15PONIT_WNK3 ) ); + f3o1 = L_sub( Mpy_32_16_1( f3o3, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o4, FFT_15PONIT_WNK3 ) ); // Qx + f3o2 = L_add( Mpy_32_16_1( f3o4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o3, FFT_15PONIT_WNK3 ) ); // Qx zRe[in0] = L_add( fi1, f2o14 ); move32(); f3o5 = L_add( f2o13, f2o15 ); @@ -702,13 +702,13 @@ static void fft15_shift8( zRe[in9] = L_add( f3o6, f3o1 ); move32(); - f3o7 = Mpy_32_16_1( L_sub( f2i3, fi15 ), FFT_15PONIT_WNK1 ); + f3o7 = Mpy_32_16_1( L_sub( f2i3, fi15 ), FFT_15PONIT_WNK1 ); // Qx f3o8 = L_add( f2i3, fi15 ); - f3o9 = L_sub( fi2, Mpy_32_16_1( f3o8, FFT_15PONIT_WNK5 ) ); + f3o9 = L_sub( fi2, Mpy_32_16_1( f3o8, FFT_15PONIT_WNK5 ) ); // Qx f3o12 = L_sub( fi7, fi8 ); f3o13 = L_sub( fi25, fi26 ); - f3o10 = L_sub( Mpy_32_16_1( f3o12, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o13, FFT_15PONIT_WNK3 ) ); - f3o11 = L_add( Mpy_32_16_1( f3o13, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o12, FFT_15PONIT_WNK3 ) ); + f3o10 = L_sub( Mpy_32_16_1( f3o12, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o13, FFT_15PONIT_WNK3 ) ); // Qx + f3o11 = L_add( Mpy_32_16_1( f3o13, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f3o12, FFT_15PONIT_WNK3 ) ); // Qx zIm[in0] = L_add( fi2, f3o8 ); move32(); f3o14 = L_add( f3o7, f3o9 ); @@ -722,13 +722,13 @@ static void fft15_shift8( zIm[in33] = L_add( f3o10, f3o15 ); move32(); - f4o1 = Mpy_32_16_1( L_sub( fi30, fi12 ), FFT_15PONIT_WNK1 ); + f4o1 = Mpy_32_16_1( L_sub( fi30, fi12 ), FFT_15PONIT_WNK1 ); // Qx f4o2 = L_add( fi30, fi12 ); - f4o3 = L_sub( fi3, Mpy_32_16_1( f4o2, FFT_15PONIT_WNK5 ) ); + f4o3 = L_sub( fi3, Mpy_32_16_1( f4o2, FFT_15PONIT_WNK5 ) ); // Qx f4o6 = L_sub( fi16, fi17 ); f4o7 = L_sub( f2i4, f2i5 ); - f4o4 = L_sub( Mpy_32_16_1( f4o6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK3 ) ); - f4o5 = L_add( Mpy_32_16_1( f4o7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o6, FFT_15PONIT_WNK3 ) ); + f4o4 = L_sub( Mpy_32_16_1( f4o6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o7, FFT_15PONIT_WNK3 ) ); // Qx + f4o5 = L_add( Mpy_32_16_1( f4o7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o6, FFT_15PONIT_WNK3 ) ); // Qx zRe[in2] = L_add( fi3, f4o2 ); move32(); f4o8 = L_add( f4o1, f4o3 ); @@ -742,13 +742,13 @@ static void fft15_shift8( zRe[in8] = L_add( f4o9, f4o4 ); move32(); - f4o10 = Mpy_32_16_1( L_sub( f2i6, fi18 ), FFT_15PONIT_WNK1 ); + f4o10 = Mpy_32_16_1( L_sub( f2i6, fi18 ), FFT_15PONIT_WNK1 ); // Qx f4o11 = L_add( f2i6, fi18 ); - f4o12 = L_sub( fi6, Mpy_32_16_1( f4o11, FFT_15PONIT_WNK5 ) ); + f4o12 = L_sub( fi6, Mpy_32_16_1( f4o11, FFT_15PONIT_WNK5 ) ); // Qx f4o15 = L_sub( fi10, fi11 ); f5o1 = L_sub( fi28, fi29 ); - f4o13 = L_sub( Mpy_32_16_1( f4o15, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o1, FFT_15PONIT_WNK3 ) ); - f4o14 = L_add( Mpy_32_16_1( f5o1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o15, FFT_15PONIT_WNK3 ) ); + f4o13 = L_sub( Mpy_32_16_1( f4o15, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o1, FFT_15PONIT_WNK3 ) ); // Qx + f4o14 = L_add( Mpy_32_16_1( f5o1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f4o15, FFT_15PONIT_WNK3 ) ); // Qx zIm[in2] = L_add( fi6, f4o11 ); move32(); f5o2 = L_add( f4o10, f4o12 ); @@ -762,13 +762,13 @@ static void fft15_shift8( zIm[in8] = L_sub( f5o3, f4o13 ); move32(); - f5o4 = Mpy_32_16_1( L_sub( f2i9, fi21 ), FFT_15PONIT_WNK1 ); + f5o4 = Mpy_32_16_1( L_sub( f2i9, fi21 ), FFT_15PONIT_WNK1 ); // Qx f5o5 = L_add( f2i9, fi21 ); - f5o6 = L_sub( fi5, Mpy_32_16_1( f5o5, FFT_15PONIT_WNK5 ) ); + f5o6 = L_sub( fi5, Mpy_32_16_1( f5o5, FFT_15PONIT_WNK5 ) ); // Qx f5o9 = L_sub( f2i10, f2i11 ); f5o10 = L_sub( fi22, fi23 ); - f5o7 = L_add( Mpy_32_16_1( f5o9, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o10, FFT_15PONIT_WNK3 ) ); - f5o8 = L_sub( Mpy_32_16_1( f5o10, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o9, FFT_15PONIT_WNK3 ) ); + f5o7 = L_add( Mpy_32_16_1( f5o9, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o10, FFT_15PONIT_WNK3 ) ); // Qx + f5o8 = L_sub( Mpy_32_16_1( f5o10, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o9, FFT_15PONIT_WNK3 ) ); // Qx zIm[in1] = L_add( fi5, f5o5 ); move32(); f5o11 = L_sub( f5o6, f5o4 ); @@ -783,13 +783,13 @@ static void fft15_shift8( zIm[in25] = L_add( f5o7, f5o12 ); move32(); - f5o13 = Mpy_32_16_1( L_sub( f2i12, fi24 ), FFT_15PONIT_WNK1 ); + f5o13 = Mpy_32_16_1( L_sub( f2i12, fi24 ), FFT_15PONIT_WNK1 ); // Qx f5o14 = L_add( f2i12, fi24 ); - f5o15 = L_sub( fi4, Mpy_32_16_1( f5o14, FFT_15PONIT_WNK5 ) ); + f5o15 = L_sub( fi4, Mpy_32_16_1( f5o14, FFT_15PONIT_WNK5 ) ); // Qx f5o18 = L_sub( f2i7, f2i8 ); f5o19 = L_sub( fi19, fi20 ); - f5o16 = L_add( Mpy_32_16_1( f5o18, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o19, FFT_15PONIT_WNK3 ) ); - f5o17 = L_sub( Mpy_32_16_1( f5o19, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o18, FFT_15PONIT_WNK3 ) ); + f5o16 = L_add( Mpy_32_16_1( f5o18, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o19, FFT_15PONIT_WNK3 ) ); // Qx + f5o17 = L_sub( Mpy_32_16_1( f5o19, FFT_15PONIT_WNK2 ), Mpy_32_16_1( f5o18, FFT_15PONIT_WNK3 ) ); // Qx zRe[in1] = L_add( fi4, f5o14 ); move32(); f5o21 = L_sub( f5o15, f5o13 ); @@ -813,10 +813,10 @@ static void fft15_shift8( *-----------------------------------------------------------------*/ static void fft5_shift1( - Word16 n1, /* i : length of data */ - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 n1, /* i : length of data Q0 */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word32 fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8; @@ -829,29 +829,29 @@ static void fft5_shift1( move16(); in3 = Idx[n1 * 2]; move16(); - in4 = Idx[i_mult( n1, 3 )]; + in4 = Idx[( n1 * 3 )]; move16(); in5 = Idx[n1 * 4]; move16(); - fi1 = zRe[in1]; + fi1 = zRe[in1]; // Qx move32(); - fi2 = zIm[in1]; + fi2 = zIm[in1]; // Qx move32(); - fo3 = zRe[in2]; + fo3 = zRe[in2]; // Qx move32(); - fo4 = zRe[in5]; + fo4 = zRe[in5]; // Qx move32(); - fo6 = zRe[in3]; + fo6 = zRe[in3]; // Qx move32(); - fo7 = zRe[in4]; + fo7 = zRe[in4]; // Qx move32(); fo5 = L_add( fo3, fo4 ); fo8 = L_add( fo6, fo7 ); fi3 = L_add( fo5, fo8 ); fi4 = L_sub( fo6, fo7 ); - fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx fi6 = L_sub( fo3, fo4 ); fo3 = zIm[in2]; @@ -868,15 +868,15 @@ static void fft5_shift1( fi7 = L_sub( fo3, fo4 ); fi8 = L_add( fo5, fo8 ); fo1 = L_sub( fo6, fo7 ); - fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx zRe[in1] = L_add( fi1, fi3 ); move32(); zIm[in1] = L_add( fi2, fi8 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi1, L_shr( fi3, 2 ) ); fo5 = L_add( fi5, fo7 ); fo6 = L_sub( fo7, fi5 ); @@ -890,8 +890,8 @@ static void fft5_shift1( zRe[in5] = L_sub( fo5, fo3 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi2, L_shr( fi8, 2 ) ); fo5 = L_add( fo2, fo7 ); fo6 = L_sub( fo7, fo2 ); @@ -914,10 +914,10 @@ static void fft5_shift1( *-----------------------------------------------------------------*/ static void fft5_shift4( - Word16 n1, /* i : length of data */ - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 n1, /* i : length of data Q0 */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word32 fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8; @@ -930,29 +930,29 @@ static void fft5_shift4( move16(); in3 = Idx[n1 * 2]; move16(); - in4 = Idx[i_mult( n1, 3 )]; + in4 = Idx[( n1 * 3 )]; move16(); in5 = Idx[n1 * 4]; move16(); - fi1 = zRe[in1]; + fi1 = zRe[in1]; // Qx move32(); - fi2 = zIm[in1]; + fi2 = zIm[in1]; // Qx move32(); - fo3 = zRe[in2]; + fo3 = zRe[in2]; // Qx move32(); - fo4 = zRe[in5]; + fo4 = zRe[in5]; // Qx move32(); - fo6 = zRe[in3]; + fo6 = zRe[in3]; // Qx move32(); - fo7 = zRe[in4]; + fo7 = zRe[in4]; // Qx move32(); fo5 = L_add( fo3, fo4 ); fo8 = L_add( fo6, fo7 ); fi3 = L_add( fo5, fo8 ); fi4 = L_sub( fo6, fo7 ); - fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx fi6 = L_sub( fo3, fo4 ); fo3 = zIm[in2]; @@ -969,15 +969,15 @@ static void fft5_shift4( fi7 = L_sub( fo3, fo4 ); fi8 = L_add( fo5, fo8 ); fo1 = L_sub( fo6, fo7 ); - fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx zRe[in1] = L_add( fi1, fi3 ); move32(); zIm[in1] = L_add( fi2, fi8 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi1, L_shr( fi3, 2 ) ); fo5 = L_add( fi5, fo7 ); fo6 = L_sub( fo7, fi5 ); @@ -991,8 +991,8 @@ static void fft5_shift4( zRe[in5] = L_add( fo5, fo3 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi2, L_shr( fi8, 2 ) ); fo5 = L_add( fo2, fo7 ); fo6 = L_sub( fo7, fo2 ); @@ -1015,9 +1015,9 @@ static void fft5_shift4( *-----------------------------------------------------------------*/ static void fft5_32( - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word32 fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8; @@ -1035,24 +1035,24 @@ static void fft5_32( in5 = Idx[128]; move16(); - fi1 = zRe[in1]; + fi1 = zRe[in1]; // Qx move32(); - fi2 = zIm[in1]; + fi2 = zIm[in1]; // Qx move32(); - fo3 = zRe[in2]; + fo3 = zRe[in2]; // Qx move32(); - fo4 = zRe[in5]; + fo4 = zRe[in5]; // Qx move32(); - fo6 = zRe[in3]; + fo6 = zRe[in3]; // Qx move32(); - fo7 = zRe[in4]; + fo7 = zRe[in4]; // Qx move32(); fo5 = L_add( fo3, fo4 ); fo8 = L_add( fo6, fo7 ); fi3 = L_add( fo5, fo8 ); fi4 = L_sub( fo6, fo7 ); - fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx fi6 = L_sub( fo3, fo4 ); fo3 = zIm[in2]; @@ -1069,15 +1069,15 @@ static void fft5_32( fi7 = L_sub( fo3, fo4 ); fi8 = L_add( fo5, fo8 ); fo1 = L_sub( fo6, fo7 ); - fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx zRe[in1] = L_add( fi1, fi3 ); move32(); zIm[in1] = L_add( fi2, fi8 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi1, L_shr( fi3, 2 ) ); fo5 = L_add( fi5, fo7 ); fo6 = L_sub( fo7, fi5 ); @@ -1091,8 +1091,8 @@ static void fft5_32( zRe[in5] = L_sub( fo6, fo4 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi2, L_shr( fi8, 2 ) ); fo5 = L_add( fo2, fo7 ); fo6 = L_sub( fo7, fo2 ); @@ -1115,9 +1115,9 @@ static void fft5_32( *-----------------------------------------------------------------*/ static void fft64( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1126,9 +1126,9 @@ static void fft64( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1140,9 +1140,9 @@ static void fft64( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } @@ -1156,9 +1156,9 @@ static void fft64( *-----------------------------------------------------------------*/ static void fft32_15( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1168,9 +1168,9 @@ static void fft32_15( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1182,9 +1182,9 @@ static void fft32_15( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } @@ -1197,9 +1197,9 @@ static void fft32_15( *-----------------------------------------------------------------*/ static void fft32_5( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1209,9 +1209,9 @@ static void fft32_5( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1223,9 +1223,9 @@ static void fft32_5( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } @@ -1238,9 +1238,9 @@ static void fft32_5( *-----------------------------------------------------------------*/ static void fft16_ivas( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1250,9 +1250,9 @@ static void fft16_ivas( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1264,9 +1264,9 @@ static void fft16_ivas( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } @@ -1279,9 +1279,9 @@ static void fft16_ivas( *-----------------------------------------------------------------*/ static void fft8( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id; @@ -1291,9 +1291,9 @@ static void fft8( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1303,9 +1303,9 @@ static void fft8( { id = Idx[i]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } @@ -1318,9 +1318,9 @@ static void fft8( *-----------------------------------------------------------------*/ static void fft8_5( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1332,7 +1332,7 @@ static void fft8_5( move16(); z[2 * i] = x[id]; move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1344,9 +1344,9 @@ static void fft8_5( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } return; @@ -1358,10 +1358,10 @@ static void fft8_5( *-----------------------------------------------------------------*/ static void fft5_8( - Word16 n1, /* i : length of data */ - Word32 *zRe, /* i/o: real part of input and output data */ - Word32 *zIm, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 n1, /* i : length of data Q0 */ + Word32 *zRe, /* i/o: real part of input and output data Qx */ + Word32 *zIm, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word32 fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8; @@ -1374,29 +1374,29 @@ static void fft5_8( move16(); in3 = Idx[n1 * 2]; move16(); - in4 = Idx[i_mult( n1, 3 )]; + in4 = Idx[( n1 * 3 )]; move16(); in5 = Idx[n1 * 4]; move16(); - fi1 = zRe[in1]; + fi1 = zRe[in1]; // Qx move32(); - fi2 = zIm[in1]; + fi2 = zIm[in1]; // Qx move32(); - fo3 = zRe[in2]; + fo3 = zRe[in2]; // Qx move32(); - fo4 = zRe[in5]; + fo4 = zRe[in5]; // Qx move32(); - fo6 = zRe[in3]; + fo6 = zRe[in3]; // Qx move32(); - fo7 = zRe[in4]; + fo7 = zRe[in4]; // Qx move32(); fo5 = L_add( fo3, fo4 ); fo8 = L_add( fo6, fo7 ); fi3 = L_add( fo5, fo8 ); fi4 = L_sub( fo6, fo7 ); - fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx fi6 = L_sub( fo3, fo4 ); fo3 = zIm[in2]; @@ -1413,15 +1413,15 @@ static void fft5_8( fi7 = L_sub( fo3, fo4 ); fi8 = L_add( fo5, fo8 ); fo1 = L_sub( fo6, fo7 ); - fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx zRe[in1] = L_add( fi1, fi3 ); move32(); zIm[in1] = L_add( fi2, fi8 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi1, L_shr( fi3, 2 ) ); fo5 = L_add( fi5, fo7 ); fo6 = L_sub( fo7, fi5 ); @@ -1435,8 +1435,8 @@ static void fft5_8( zRe[in4] = L_add( fo5, fo3 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi2, L_shr( fi8, 2 ) ); fo5 = L_add( fo2, fo7 ); fo6 = L_sub( fo7, fo2 ); @@ -1459,9 +1459,9 @@ static void fft5_8( *-----------------------------------------------------------------*/ static void fft4_5( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1471,9 +1471,9 @@ static void fft4_5( { id = Idx[i]; move16(); - z[2 * i] = x[id]; + z[2 * i] = x[id]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[id]; + z[( ( i << 1 ) + 1 )] = y[id]; // Qx move32(); } @@ -1485,9 +1485,9 @@ static void fft4_5( move16(); id = Idx[jd]; move16(); - x[id] = z[2 * i]; + x[id] = z[2 * i]; // Qx move32(); - y[id] = z[add( shl( i, 1 ), 1 )]; + y[id] = z[( ( i << 1 ) + 1 )]; // Qx move32(); } return; @@ -1499,10 +1499,11 @@ static void fft4_5( *-----------------------------------------------------------------*/ static void fft5_4( - Word16 n1, - Word32 *zRe, - Word32 *zIm, - const Word16 *Idx ) + Word16 n1, // Q0 + Word32 *zRe, // Qx + Word32 *zIm, // Qx + const Word16 *Idx // Q0 +) { Word32 fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8; Word32 fo1, fo2, fo3, fo4, fo5, fo6, fo7, fo8; @@ -1514,29 +1515,29 @@ static void fft5_4( move16(); in3 = Idx[n1 * 2]; move16(); - in4 = Idx[i_mult( n1, 3 )]; + in4 = Idx[( n1 * 3 )]; move16(); in5 = Idx[n1 * 4]; move16(); - fi1 = zRe[in1]; + fi1 = zRe[in1]; // Qx move32(); - fi2 = zIm[in1]; + fi2 = zIm[in1]; // Qx move32(); - fo3 = zRe[in2]; + fo3 = zRe[in2]; // Qx move32(); - fo4 = zRe[in5]; + fo4 = zRe[in5]; // Qx move32(); - fo6 = zRe[in3]; + fo6 = zRe[in3]; // Qx move32(); - fo7 = zRe[in4]; + fo7 = zRe[in4]; // Qx move32(); fo5 = L_add( fo3, fo4 ); fo8 = L_add( fo6, fo7 ); fi3 = L_add( fo5, fo8 ); fi4 = L_sub( fo6, fo7 ); - fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fi5 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx fi6 = L_sub( fo3, fo4 ); fo3 = zIm[in2]; @@ -1553,15 +1554,15 @@ static void fft5_4( fi7 = L_sub( fo3, fo4 ); fi8 = L_add( fo5, fo8 ); fo1 = L_sub( fo6, fo7 ); - fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); + fo2 = Mpy_32_16_1( L_sub( fo5, fo8 ), FFT_15PONIT_WNK1 ); // Qx zRe[in1] = L_add( fi1, fi3 ); move32(); zIm[in1] = L_add( fi2, fi8 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi7, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fo1, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fo1, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi7, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi1, L_shr( fi3, 2 ) ); fo5 = L_add( fi5, fo7 ); fo6 = L_sub( fo7, fi5 ); @@ -1575,8 +1576,8 @@ static void fft5_4( zRe[in5] = L_add( fo5, fo3 ); move32(); - fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); - fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); + fo3 = L_add( Mpy_32_16_1( fi6, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi4, FFT_15PONIT_WNK3 ) ); // Qx + fo4 = L_sub( Mpy_32_16_1( fi4, FFT_15PONIT_WNK2 ), Mpy_32_16_1( fi6, FFT_15PONIT_WNK3 ) ); // Qx fo7 = L_sub( fi2, L_shr( fi8, 2 ) ); fo5 = L_add( fo2, fo7 ); fo6 = L_sub( fo7, fo2 ); @@ -1599,8 +1600,8 @@ static void fft5_4( *-----------------------------------------------------------------*/ void DoRTFT80_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1626,8 +1627,8 @@ void DoRTFT80_fx( *-----------------------------------------------------------------*/ void DoRTFT120_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1653,8 +1654,8 @@ void DoRTFT120_fx( *-----------------------------------------------------------------*/ void DoRTFT160_fx( - Word32 x[], /* i/o: real part of input and output data */ - Word32 y[] /* i/o: imaginary part of input and output data */ + Word32 x[], /* i/o: real part of input and output data Qx */ + Word32 y[] /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1680,8 +1681,8 @@ void DoRTFT160_fx( *-----------------------------------------------------------------*/ void DoRTFT320_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1707,8 +1708,8 @@ void DoRTFT320_fx( *-----------------------------------------------------------------*/ void DoRTFT480_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1734,8 +1735,8 @@ void DoRTFT480_fx( *-----------------------------------------------------------------*/ void DoRTFT40_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1760,8 +1761,8 @@ void DoRTFT40_fx( *-----------------------------------------------------------------*/ void DoRTFT20_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word16 j; @@ -1787,8 +1788,8 @@ void DoRTFT20_fx( *-----------------------------------------------------------------*/ void DoRTFT128_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { @@ -1799,7 +1800,7 @@ void DoRTFT128_fx( { z[2 * i] = x[i]; move32(); - z[add( shl( i, 1 ), 1 )] = y[i]; + z[( ( i << 1 ) + 1 )] = y[i]; move32(); } @@ -1813,7 +1814,7 @@ void DoRTFT128_fx( { x[128 - i] = z[2 * i]; move32(); - y[128 - i] = z[add( shl( i, 1 ), 1 )]; + y[128 - i] = z[( ( i << 1 ) + 1 )]; move32(); } @@ -1826,10 +1827,10 @@ void DoRTFT128_fx( *-----------------------------------------------------------------*/ static void cdftForw( - Word16 n, /* i : data length of real and imag */ - Word32 *a, /* i/o: input/output data */ - const Word16 *ip, /* i : work area for bit reversal */ - const Word16 *w /* i : cos/sin table */ + Word16 n, /* i : data length of real and imag Q0 */ + Word32 *a, /* i/o: input/output data Qx */ + const Word16 *ip, /* i : work area for bit reversal Qx */ + const Word16 *w /* i : cos/sin table Q15 */ ) { /* bit reversal */ @@ -1845,9 +1846,9 @@ static void cdftForw( *-----------------------------------------------------------------*/ static void bitrv2_SR( - Word16 n, /* i : data length of real and imag */ - const Word16 *ip, /* i/o: work area for bit reversal */ - Word32 *a /* i/o: input/output data */ + Word16 n, /* i : data length of real and imag Q0 */ + const Word16 *ip, /* i/o: work area for bit reversal Q0 */ + Word32 *a /* i/o: input/output data Qx */ ) { Word16 j, j1, k, k1, m, m2; @@ -1882,7 +1883,7 @@ static void bitrv2_SR( m = 1; move16(); - WHILE( shl( m, 3 ) < l ) + WHILE( ( m << 3 ) < l ) { l = shr( l, 1 ); m = shl( m, 1 ); @@ -1900,21 +1901,21 @@ static void bitrv2_SR( { j1 = add( shl( j, 1 ), ip[k] ); k1 = add( shl( k, 1 ), ip[j] ); - xr = a[j1]; + xr = a[j1]; // Qx move32(); - xi = a[j1 + 1]; + xi = a[j1 + 1]; // Qx move32(); - yr = a[k1]; + yr = a[k1]; // Qx move32(); - yi = a[k1 + 1]; + yi = a[k1 + 1]; // Qx move32(); - a[j1] = yr; + a[j1] = yr; // Qx move32(); - a[j1 + 1] = yi; + a[j1 + 1] = yi; // Qx move32(); - a[k1] = xr; + a[k1] = xr; // Qx move32(); - a[k1 + 1] = xi; + a[k1 + 1] = xi; // Qx move32(); j1 = add( j1, m2 ); k1 = add( k1, 2 * m2 ); @@ -2047,9 +2048,9 @@ static void bitrv2_SR( *-----------------------------------------------------------------*/ static void cftfsub( - Word16 n, /* i : data length of real and imag */ - Word32 *a, /* i/o: input/output data */ - const Word16 *w /* i : cos/sin table */ + Word16 n, /* i : data length of real and imag Q0 */ + Word32 *a, /* i/o: input/output data Qx */ + const Word16 *w /* i : cos/sin table Q15 */ ) { Word16 j, j1, j2, j3, l; @@ -2065,7 +2066,7 @@ static void cftfsub( l = 8; move16(); - WHILE( LT_16( shl( l, 2 ), n ) ) + WHILE( ( ( l << 2 ) < n ) ) { cftmdl( n, l, a, w ); l = shl( l, 2 ); @@ -2079,14 +2080,14 @@ static void cftfsub( j1 = add( j, l ); j2 = add( j1, l ); j3 = add( j2, l ); - x0r = L_add( a[j], a[j1] ); - x0i = L_add( a[j + 1], a[j1 + 1] ); - x1r = L_sub( a[j], a[j1] ); - x1i = L_sub( a[j + 1], a[j1 + 1] ); - x2r = L_add( a[j2], a[j3] ); - x2i = L_add( a[j2 + 1], a[j3 + 1] ); - x3r = L_sub( a[j2], a[j3] ); - x3i = L_sub( a[j2 + 1], a[j3 + 1] ); + x0r = L_add( a[j], a[j1] ); // Qx + x0i = L_add( a[j + 1], a[j1 + 1] ); // Qx + x1r = L_sub( a[j], a[j1] ); // Qx + x1i = L_sub( a[j + 1], a[j1 + 1] ); // Qx + x2r = L_add( a[j2], a[j3] ); // Qx + x2i = L_add( a[j2 + 1], a[j3 + 1] ); // Qx + x3r = L_sub( a[j2], a[j3] ); // Qx + x3i = L_sub( a[j2 + 1], a[j3 + 1] ); // Qx a[j] = L_add( x0r, x2r ); move32(); a[j + 1] = L_add( x0i, x2i ); @@ -2132,23 +2133,23 @@ static void cftfsub( *-----------------------------------------------------------------*/ static void cft1st( - Word16 n, /* i : data length of real and imag */ - Word32 *a, /* i/o: input/output data */ - const Word16 *w /* i : cos/sin table */ + Word16 n, /* i : data length of real and imag Q0 */ + Word32 *a, /* i/o: input/output data Qx */ + const Word16 *w /* i : cos/sin table Q15 */ ) { Word16 j, k1, k2; Word16 wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, wtmp; Word32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; - x0r = L_add( a[0], a[2] ); - x0i = L_add( a[1], a[3] ); - x1r = L_sub( a[0], a[2] ); - x1i = L_sub( a[1], a[3] ); - x2r = L_add( a[4], a[6] ); - x2i = L_add( a[5], a[7] ); - x3r = L_sub( a[4], a[6] ); - x3i = L_sub( a[5], a[7] ); + x0r = L_add( a[0], a[2] ); // Qx + x0i = L_add( a[1], a[3] ); // Qx + x1r = L_sub( a[0], a[2] ); // Qx + x1i = L_sub( a[1], a[3] ); // Qx + x2r = L_add( a[4], a[6] ); // Qx + x2i = L_add( a[5], a[7] ); // Qx + x3r = L_sub( a[4], a[6] ); // Qx + x3i = L_sub( a[5], a[7] ); // Qx a[0] = L_add( x0r, x2r ); move32(); a[1] = L_add( x0i, x2i ); @@ -2295,10 +2296,10 @@ static void cft1st( *-----------------------------------------------------------------*/ static void cftmdl( - Word16 n, /* i : data length of real and imag */ - Word16 l, /* i : initial shift for processing */ - Word32 *a, /* i/o: input/output data */ - const Word16 *w /* i : cos/sin table */ + Word16 n, /* i : data length of real and imag Q0 */ + Word16 l, /* i : initial shift for processing Q0 */ + Word32 *a, /* i/o: input/output data Qx */ + const Word16 *w /* i : cos/sin table Q15 */ ) { Word16 j, j1, j2, j3, k, k1, k2, m, m2; @@ -2311,14 +2312,14 @@ static void cftmdl( j1 = add( j, l ); j2 = add( j1, l ); j3 = add( j2, l ); - x0r = L_add( a[j], a[j1] ); - x0i = L_add( a[j + 1], a[j1 + 1] ); - x1r = L_sub( a[j], a[j1] ); - x1i = L_sub( a[j + 1], a[j1 + 1] ); - x2r = L_add( a[j2], a[j3] ); - x2i = L_add( a[j2 + 1], a[j3 + 1] ); - x3r = L_sub( a[j2], a[j3] ); - x3i = L_sub( a[j2 + 1], a[j3 + 1] ); + x0r = L_add( a[j], a[j1] ); // Qx + x0i = L_add( a[j + 1], a[j1 + 1] ); // Qx + x1r = L_sub( a[j], a[j1] ); // Qx + x1i = L_sub( a[j + 1], a[j1 + 1] ); // Qx + x2r = L_add( a[j2], a[j3] ); // Qx + x2i = L_add( a[j2 + 1], a[j3 + 1] ); // Qx + x3r = L_sub( a[j2], a[j3] ); // Qx + x3i = L_sub( a[j2 + 1], a[j3 + 1] ); // Qx a[j] = L_add( x0r, x2r ); move32(); a[j + 1] = L_add( x0i, x2i ); @@ -2414,21 +2415,21 @@ static void cftmdl( move32(); x0r = L_sub( x0r, x2r ); x0i = L_sub( x0i, x2i ); - a[j2] = L_sub( Mpy_32_16_1( x0r, wk2r ), Mpy_32_16_1( x0i, wk2i ) ); + a[j2] = L_sub( Mpy_32_16_1( x0r, wk2r ), Mpy_32_16_1( x0i, wk2i ) ); // Qx move32(); - a[j2 + 1] = L_add( Mpy_32_16_1( x0i, wk2r ), Mpy_32_16_1( x0r, wk2i ) ); + a[j2 + 1] = L_add( Mpy_32_16_1( x0i, wk2r ), Mpy_32_16_1( x0r, wk2i ) ); // Qx move32(); x0r = L_sub( x1r, x3i ); x0i = L_add( x1i, x3r ); - a[j1] = L_sub( Mpy_32_16_1( x0r, wk1r ), Mpy_32_16_1( x0i, wk1i ) ); + a[j1] = L_sub( Mpy_32_16_1( x0r, wk1r ), Mpy_32_16_1( x0i, wk1i ) ); // Qx move32(); - a[j1 + 1] = L_add( Mpy_32_16_1( x0i, wk1r ), Mpy_32_16_1( x0r, wk1i ) ); + a[j1 + 1] = L_add( Mpy_32_16_1( x0i, wk1r ), Mpy_32_16_1( x0r, wk1i ) ); // Qx move32(); x0r = L_add( x1r, x3i ); x0i = L_sub( x1i, x3r ); - a[j3] = L_sub( Mpy_32_16_1( x0r, wk3r ), Mpy_32_16_1( x0i, wk3i ) ); + a[j3] = L_sub( Mpy_32_16_1( x0r, wk3r ), Mpy_32_16_1( x0i, wk3i ) ); // Qx move32(); - a[j3 + 1] = L_add( Mpy_32_16_1( x0i, wk3r ), Mpy_32_16_1( x0r, wk3i ) ); + a[j3 + 1] = L_add( Mpy_32_16_1( x0i, wk3r ), Mpy_32_16_1( x0r, wk3i ) ); // Qx move32(); } @@ -2461,21 +2462,21 @@ static void cftmdl( move32(); x0r = L_sub( x0r, x2r ); x0i = L_sub( x0i, x2i ); - a[j2] = L_negate( L_add( Mpy_32_16_1( x0r, wk2i ), Mpy_32_16_1( x0i, wk2r ) ) ); + a[j2] = L_negate( L_add( Mpy_32_16_1( x0r, wk2i ), Mpy_32_16_1( x0i, wk2r ) ) ); // Qx move32(); - a[j2 + 1] = L_sub( Mpy_32_16_1( x0r, wk2r ), Mpy_32_16_1( x0i, wk2i ) ); + a[j2 + 1] = L_sub( Mpy_32_16_1( x0r, wk2r ), Mpy_32_16_1( x0i, wk2i ) ); // Qx move32(); x0r = L_sub( x1r, x3i ); x0i = L_add( x1i, x3r ); - a[j1] = L_sub( Mpy_32_16_1( x0r, wk1r ), Mpy_32_16_1( x0i, wk1i ) ); + a[j1] = L_sub( Mpy_32_16_1( x0r, wk1r ), Mpy_32_16_1( x0i, wk1i ) ); // Qx move32(); - a[j1 + 1] = L_add( Mpy_32_16_1( x0i, wk1r ), Mpy_32_16_1( x0r, wk1i ) ); + a[j1 + 1] = L_add( Mpy_32_16_1( x0i, wk1r ), Mpy_32_16_1( x0r, wk1i ) ); // Qx move32(); x0r = L_add( x1r, x3i ); x0i = L_sub( x1i, x3r ); - a[j3] = L_sub( Mpy_32_16_1( x0r, wk3r ), Mpy_32_16_1( x0i, wk3i ) ); + a[j3] = L_sub( Mpy_32_16_1( x0r, wk3r ), Mpy_32_16_1( x0i, wk3i ) ); // Qx move32(); - a[j3 + 1] = L_add( Mpy_32_16_1( x0i, wk3r ), Mpy_32_16_1( x0r, wk3i ) ); + a[j3 + 1] = L_add( Mpy_32_16_1( x0i, wk3r ), Mpy_32_16_1( x0r, wk3i ) ); // Qx move32(); } } @@ -2484,9 +2485,9 @@ static void cftmdl( } static void cftbsub( - Word16 n, - Word32 *a, - const Word16 *w /* i : cos/sin table */ + Word16 n, // Q0 + Word32 *a, // Qx + const Word16 *w /* i : cos/sin table Q15 */ ) { Word16 j, j1, j2, j3, l; @@ -2500,7 +2501,7 @@ static void cftbsub( l = 8; move16(); - WHILE( LT_16( shl( l, 2 ), n ) ) + WHILE( ( ( l << 2 ) < n ) ) { cftmdl( n, l, a, w ); l = shl( l, 2 ); @@ -2514,14 +2515,14 @@ static void cftbsub( j1 = add( j, l ); j2 = add( j1, l ); j3 = add( j2, l ); - x0r = L_add( a[j], a[j1] ); - x0i = L_negate( L_add( a[j + 1], a[j1 + 1] ) ); - x1r = L_sub( a[j], a[j1] ); - x1i = L_sub( a[j1 + 1], a[j + 1] ); - x2r = L_add( a[j2], a[j3] ); - x2i = L_add( a[j2 + 1], a[j3 + 1] ); - x3r = L_sub( a[j2], a[j3] ); - x3i = L_sub( a[j2 + 1], a[j3 + 1] ); + x0r = L_add( a[j], a[j1] ); // Qx + x0i = L_negate( L_add( a[j + 1], a[j1 + 1] ) ); // Qx + x1r = L_sub( a[j], a[j1] ); // Qx + x1i = L_sub( a[j1 + 1], a[j + 1] ); // Qx + x2r = L_add( a[j2], a[j3] ); // Qx + x2i = L_add( a[j2 + 1], a[j3 + 1] ); // Qx + x3r = L_sub( a[j2], a[j3] ); // Qx + x3i = L_sub( a[j2 + 1], a[j3 + 1] ); // Qx a[j] = L_add( x0r, x2r ); move32(); a[j + 1] = L_sub( x0i, x2i ); @@ -2562,10 +2563,11 @@ static void cftbsub( } static void rftfsub( - Word16 n, - Word32 *a, - Word16 nc, - const Word16 *c ) + Word16 n, // Q0 + Word32 *a, // Qx + Word16 nc, // Q0 + const Word16 *c // Q15 +) { Word16 j, k, kk, ks, m; Word16 wkr, wki; @@ -2579,8 +2581,8 @@ static void rftfsub( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( (Word16) 0x4000, c[sub( nc, kk )] ); - wki = c[kk]; + wkr = sub( extract_l( 0x4000 ) /*0.5.Q15*/, c[( nc - kk )] ); + wki = c[kk]; // Q15 move16(); xr = L_sub( a[j], a[k] ); xi = L_add( a[j + 1], a[k + 1] ); @@ -2601,10 +2603,11 @@ static void rftfsub( static void rftbsub( - Word16 n, - Word32 *a, - Word16 nc, - const Word16 *c ) + Word16 n, // Q0 + Word32 *a, // Qx + Word16 nc, // Q0 + const Word16 *c // Q15 +) { Word16 j, k, kk, ks, m; Word16 wkr, wki; @@ -2619,12 +2622,12 @@ static void rftbsub( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( (Word16) 0x4000, c[sub( nc, kk )] ); - wki = c[kk]; + wkr = sub( extract_l( 0x4000 ) /*0.5.Q15*/, c[( nc - kk )] ); + wki = c[kk]; // Q15 xr = L_sub( a[j], a[k] ); xi = L_add( a[j + 1], a[k + 1] ); - yr = L_add( Mpy_32_16_1( xr, wkr ), Mpy_32_16_1( xi, wki ) ); - yi = L_sub( Mpy_32_16_1( xi, wkr ), Mpy_32_16_1( xr, wki ) ); + yr = L_add( Mpy_32_16_1( xr, wkr ), Mpy_32_16_1( xi, wki ) ); // Qx + yi = L_sub( Mpy_32_16_1( xi, wkr ), Mpy_32_16_1( xr, wki ) ); // Qx a[j] = L_sub( a[j], yr ); move32(); a[j + 1] = L_sub( yi, a[j + 1] ); @@ -2641,10 +2644,11 @@ static void rftbsub( static void dctsub( - Word16 n, - Word32 *a, - Word16 nc, - const Word16 *c ) + Word16 n, // Q0 + Word32 *a, // Qx + Word16 nc, // Q0 + const Word16 *c // Q15 +) { Word16 j, k, kk, ks, m; Word16 wkr, wki; @@ -2658,15 +2662,15 @@ static void dctsub( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( c[kk], c[sub( nc, kk )] ); - wki = add( c[kk], c[sub( nc, kk )] ); - xr = L_sub( Mpy_32_16_1( a[j], wki ), Mpy_32_16_1( a[k], wkr ) ); - a[j] = L_add( Mpy_32_16_1( a[j], wkr ), Mpy_32_16_1( a[k], wki ) ); + wkr = sub( c[kk], c[( nc - kk )] ); // Q15 + wki = add( c[kk], c[( nc - kk )] ); // Q15 + xr = L_sub( Mpy_32_16_1( a[j], wki ), Mpy_32_16_1( a[k], wkr ) ); // Qx + a[j] = L_add( Mpy_32_16_1( a[j], wkr ), Mpy_32_16_1( a[k], wki ) ); // Qx move32(); a[k] = xr; move32(); } - a[m] = Mpy_32_16_1( a[m], c[0] ); + a[m] = Mpy_32_16_1( a[m], c[0] ); // Qx move32(); return; @@ -2680,12 +2684,13 @@ static void dctsub( *-----------------------------------------------------------------*/ void edct2_fx_ivas( - const Word16 n, + const Word16 n, // Q0 const Word16 isgn, - Word32 *in, - Word32 *a, + Word32 *in, // Qx + Word32 *a, // Qx const Word16 *ip, - const Word16 *w ) + const Word16 *w // Q15 +) { Word16 j, nw, nc; Word32 xr; @@ -2694,7 +2699,7 @@ void edct2_fx_ivas( nw = ip[0]; move16(); - if ( GT_16( n, shl( nw, 2 ) ) ) + IF( GT_16( n, shl( nw, 2 ) ) ) { nw = shr( n, 2 ); } @@ -2776,9 +2781,9 @@ void edct2_fx_ivas( } void DoRTFTn_fx_ivas( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 n /* i : size of the FFT up to 1024 */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y, /* i/o: imaginary part of input and output data Qx */ + const Word16 n /* i : size of the FFT up to 1024 Q0*/ ) { @@ -2787,9 +2792,9 @@ void DoRTFTn_fx_ivas( FOR( i = 0; i < n; i++ ) { - z[2 * i] = x[i]; + z[2 * i] = x[i]; // Qx move32(); - z[add( shl( i, 1 ), 1 )] = y[i]; + z[( ( i << 1 ) + 1 )] = y[i]; // Qx move32(); } @@ -2817,15 +2822,15 @@ void DoRTFTn_fx_ivas( assert( 0 ); } - x[0] = z[0]; + x[0] = z[0]; // Qx move32(); - y[0] = z[1]; + y[0] = z[1]; // Qx move32(); FOR( i = 1; i < n; i++ ) { - x[sub( n, i )] = z[2 * i]; + x[( n - i )] = z[2 * i]; move32(); - y[sub( n, i )] = z[add( shl( i, 1 ), 1 )]; + y[( n - i )] = z[( ( i << 1 ) + 1 )]; move32(); } @@ -2833,15 +2838,16 @@ void DoRTFTn_fx_ivas( } void fft3_fx_ivas( - const Word32 X[], - Word32 Y[], - const Word16 n ) + const Word32 X[], // Qx + Word32 Y[], // Qx + const Word16 n // Q0 +) { Word32 Z[PH_ECU_SPEC_SIZE]; Word32 *Z0, *Z1, *Z2; Word32 *z0, *z1, *z2; const Word32 *x; - const Word16 *t_sin = sincos_t_rad3_fx; + const Word16 *t_sin = sincos_t_rad3_fx; // Q15 Word16 m, step, order; Word16 i, j; Word16 c1_ind, s1_ind, c2_ind, s2_ind; @@ -2902,8 +2908,8 @@ void fft3_fx_ivas( /* Butterflies of order 3. */ /* pointer initialization */ - RY = &Y[0]; - IY = &Y[n]; + RY = &Y[0]; // Qx + IY = &Y[n]; // Qx RZ0 = &Z0[0]; IZ0 = &Z0[m]; RZ1 = &Z1[0]; @@ -2928,42 +2934,42 @@ void fft3_fx_ivas( move32(); /* first 3/12 */ - FOR( i = 1; i < i_mult( 3, shr( m, 3 ) ); ( i++, c1_ind = add( c1_ind, c1_step ), s1_ind = add( s1_ind, s1_step ), c2_ind = add( c2_ind, c2_step ), s2_ind = add( s2_ind, s2_step ) ) ) + FOR( i = 1; i < ( 3 * ( m >> 3 ) ); ( i++, c1_ind = ( c1_ind + c1_step ), s1_ind = ( s1_ind + s1_step ), c2_ind = ( c2_ind + c2_step ), s2_ind = ( s2_ind + s2_step ) ) ) { RY[i] = L_add( RZ0[i], L_add( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), L_add( Mpy_32_16_1( RZ2[i], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY[-i] = L_sub( IZ0[-i], L_add( L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ) ), L_sub( Mpy_32_16_1( RZ2[i], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-i], t_sin[c2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[-i], t_sin[c2_ind] ) ) ) ); // Qx move32(); } /* next 1/12 */ - FOR( ; i < 4 * m / 8; ( i++, c1_ind = add( c1_ind, c1_step ), s1_ind = add( s1_ind, s1_step ), c2_ind = sub( c2_ind, c2_step ), s2_ind = sub( s2_ind, s2_step ) ) ) + FOR( ; i < 4 * m / 8; ( i++, c1_ind = ( c1_ind + c1_step ), s1_ind = ( s1_ind + s1_step ), c2_ind = ( c2_ind - c2_step ), s2_ind = ( s2_ind - s2_step ) ) ) { RY[i] = L_add( RZ0[i], L_sub( L_add( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ) ), L_sub( Mpy_32_16_1( RZ2[i], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-i], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[-i], t_sin[s2_ind] ) ) ) ); // Qx move32(); IY[-i] = L_sub( IZ0[-i], L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), L_sub( Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ), L_add( Mpy_32_16_1( RZ2[i], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-i], t_sin[c2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-i], t_sin[c2_ind] ) ) ) ) ); // Qx move32(); } /* special case: i = m/2 i.e. 1/3 */ RY[i] = L_add( RZ0[i], L_sub( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), - Mpy_32_16_1( RZ2[i], t_sin[c2_ind] ) ) ); + Mpy_32_16_1( RZ2[i], t_sin[c2_ind] ) ) ); // Qx move32(); IY[-i] = L_negate( L_add( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[i], t_sin[s2_ind] ) ) ); + Mpy_32_16_1( RZ2[i], t_sin[s2_ind] ) ) ); // Qx move32(); i = add( i, 1 ); @@ -2973,92 +2979,92 @@ void fft3_fx_ivas( s2_ind = sub( s2_ind, s2_step ); /* next 2/12 */ - FOR( j = i - 2; i < 6 * m / 8; ( i++, j--, c1_ind = add( c1_ind, c1_step ), s1_ind = add( s1_ind, s1_step ), c2_ind = sub( c2_ind, c2_step ), s2_ind = sub( s2_ind, s2_step ) ) ) + FOR( j = i - 2; i < 6 * m / 8; ( i++, j--, c1_ind = ( c1_ind + c1_step ), s1_ind = ( s1_ind + s1_step ), c2_ind = ( c2_ind - c2_step ), s2_ind = ( s2_ind - s2_step ) ) ) { RY[i] = L_add( RZ0[j], L_sub( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), L_add( Mpy_32_16_1( IZ1[-j], t_sin[s1_ind] ), L_add( Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY[-i] = L_negate( L_add( IZ0[-j], L_add( Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ), L_add( Mpy_32_16_1( IZ1[-j], t_sin[c1_ind] ), L_sub( Mpy_32_16_1( RZ2[j], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ) ); // Qx move32(); } /*--------------------------half--------------------------*/ /* next 2/12 */ - FOR( ; i < 8 * m / 8; ( i++, j--, c1_ind = sub( c1_ind, c1_step ), s1_ind = sub( s1_ind, s1_step ), c2_ind = add( c2_ind, c2_step ), s2_ind = add( s2_ind, s2_step ) ) ) + FOR( ; i < 8 * m / 8; ( i++, j--, c1_ind = ( c1_ind - c1_step ), s1_ind = ( s1_ind - s1_step ), c2_ind = ( c2_ind + c2_step ), s2_ind = ( s2_ind + s2_step ) ) ) { RY[i] = L_sub( RZ0[j], L_add( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), L_add( Mpy_32_16_1( IZ1[-j], t_sin[s1_ind] ), L_sub( Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY[-i] = L_negate( L_add( IZ0[-j], L_sub( Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ), L_add( Mpy_32_16_1( IZ1[-j], t_sin[c1_ind] ), L_add( Mpy_32_16_1( RZ2[j], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ) ); // Qx move32(); } /* special case: i = m, i.e 2/3 */ RY[i] = L_sub( RZ0[j], L_add( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), - Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ) ) ); + Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ) ) ); // Qx move32(); IY[-i] = L_sub( Mpy_32_16_1( RZ2[j], t_sin[s2_ind] ), - Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ) ); + Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ) ); // Qx move32(); i = add( i, 1 ); c1_ind = sub( c1_ind, c1_step ), s1_ind = sub( s1_ind, s1_step ), c2_ind = add( c2_ind, c2_step ), s2_ind = add( s2_ind, s2_step ); /* next 1/12 */ - FOR( j = 1; i < i_mult( 9, shr( m, 3 ) ); ( i++, j++, c1_ind = sub( c1_ind, c1_step ), s1_ind = sub( s1_ind, s1_step ), c2_ind = add( c2_ind, c2_step ), s2_ind = add( s2_ind, s2_step ) ) ) + FOR( j = 1; i < ( 9 * ( m >> 3 ) ); ( i++, j++, c1_ind = ( c1_ind - c1_step ), s1_ind = ( s1_ind - s1_step ), c2_ind = ( c2_ind + c2_step ), s2_ind = ( s2_ind + s2_step ) ) ) { RY[i] = L_sub( RZ0[j], L_sub( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), L_sub( Mpy_32_16_1( IZ1[-j], t_sin[s1_ind] ), L_add( Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY[-i] = L_sub( IZ0[-j], L_add( Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ), L_sub( Mpy_32_16_1( IZ1[-j], t_sin[c1_ind] ), L_sub( Mpy_32_16_1( RZ2[j], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ) ); // Qx move32(); } /* last 3/12 */ - FOR( ; i < 12 * m / 8; ( i++, j++, c1_ind = sub( c1_ind, c1_step ), s1_ind = sub( s1_ind, s1_step ), c2_ind = sub( c2_ind, c2_step ), s2_ind = sub( s2_ind, s2_step ) ) ) + FOR( ; i < 12 * m / 8; ( i++, j++, c1_ind = ( c1_ind - c1_step ), s1_ind = ( s1_ind - s1_step ), c2_ind = ( c2_ind - c2_step ), s2_ind = ( s2_ind - s2_step ) ) ) { RY[i] = L_sub( RZ0[j], L_sub( L_sub( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), Mpy_32_16_1( IZ1[-j], t_sin[s1_ind] ) ), L_sub( Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[s2_ind] ) ) ) ); // Qx move32(); IY[-i] = L_sub( IZ0[-j], L_sub( L_add( Mpy_32_16_1( RZ1[j], t_sin[s1_ind] ), Mpy_32_16_1( IZ1[-j], t_sin[c1_ind] ) ), L_add( Mpy_32_16_1( RZ2[j], t_sin[s2_ind] ), - Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[-j], t_sin[c2_ind] ) ) ) ); // Qx move32(); } /* special case: i = 3*m/2 */ RY[i] = L_sub( RZ0[j], L_sub( Mpy_32_16_1( RZ1[j], t_sin[c1_ind] ), - Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ) ) ); + Mpy_32_16_1( RZ2[j], t_sin[c2_ind] ) ) ); // Qx move32(); return; } void ifft3_fx_ivas( - const Word32 Z[], + const Word32 Z[], // Qx Word32 X[], const Word16 n ) { Word32 Y[PH_ECU_SPEC_SIZE]; - const Word16 *t_sin = sincos_t_rad3_fx; + const Word16 *t_sin = sincos_t_rad3_fx; // Q15 Word16 m, step, step2, order; Word16 i; Word16 c0_ind, s0_ind, c1_ind, s1_ind, c2_ind, s2_ind; @@ -3103,7 +3109,7 @@ void ifft3_fx_ivas( RY2 = &RY1[m]; IY2 = &RY2[m]; - RZ0 = &Z[0]; + RZ0 = &Z[0]; // Qx RZ1 = RZ0 + m; RZ2 = RZ0 + sub( shr( n, 1 ), shr( m, 1 ) ); IZ0 = &Z[n]; @@ -3139,7 +3145,7 @@ void ifft3_fx_ivas( L_add( Mpy_32_16_1( RZ1[0], t_sin[c1_ind] ), L_add( Mpy_32_16_1( RZ2[0], t_sin[c2_ind] ), L_add( Mpy_32_16_1( IZ1[0], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[0], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[0], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); c0_ind = sub( c0_ind, step ); @@ -3148,39 +3154,39 @@ void ifft3_fx_ivas( s1_ind = sub( s1_ind, step ); c2_ind = sub( c2_ind, step ); s2_ind = add( s2_ind, step ); - FOR( i = 1; i < m / 4; ( i++, c0_ind = sub( c0_ind, step ), s0_ind = add( s0_ind, step ), c1_ind = add( c1_ind, step ), s1_ind = sub( s1_ind, step ), c2_ind = sub( c2_ind, step ), s2_ind = add( s2_ind, step ) ) ) + FOR( i = 1; i < m / 4; ( i++, c0_ind = ( c0_ind - step ), s0_ind = ( s0_ind + step ), c1_ind = ( c1_ind + step ), s1_ind = ( s1_ind - step ), c2_ind = ( c2_ind - step ), s2_ind = ( s2_ind + step ) ) ) { RY1[i] = L_sub( Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ), L_add( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), L_add( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ), L_add( Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ) ); // Qx move32(); IY1[-i] = L_add( L_sub( Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ), Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ) ), L_add( Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ), L_add( Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ), L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); } - FOR( ; i < m / 2; ( i++, c0_ind = sub( c0_ind, step ), s0_ind = add( s0_ind, step ), c1_ind = add( c1_ind, step ), s1_ind = sub( s1_ind, step ), c2_ind = add( c2_ind, step ), s2_ind = sub( s2_ind, step ) ) ) + FOR( ; i < m / 2; ( i++, c0_ind = ( c0_ind - step ), s0_ind = ( s0_ind + step ), c1_ind = ( c1_ind + step ), s1_ind = ( s1_ind - step ), c2_ind = ( c2_ind + step ), s2_ind = ( s2_ind - step ) ) ) { RY1[i] = L_sub( Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ), L_add( L_sub( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ) ), L_add( Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY1[-i] = L_sub( Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ), L_sub( L_add( Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ), Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ) ), L_add( Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ), L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); } @@ -3190,7 +3196,7 @@ void ifft3_fx_ivas( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ) ), L_add( Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); /* Construction of Y2 */ @@ -3211,7 +3217,7 @@ void ifft3_fx_ivas( L_sub( L_add( Mpy_32_16_1( RZ1[0], t_sin[c1_ind] ), Mpy_32_16_1( RZ2[0], t_sin[c2_ind] ) ), L_add( Mpy_32_16_1( IZ1[0], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[0], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[0], t_sin[s2_ind] ) ) ) ); // Qx move32(); c0_ind = sub( c0_ind, step2 ); @@ -3220,75 +3226,75 @@ void ifft3_fx_ivas( s1_ind = add( s1_ind, step2 ); c2_ind = add( c2_ind, step2 ); s2_ind = sub( s2_ind, step2 ); - FOR( i = 1; i < m / 8; ( i++, c0_ind = sub( c0_ind, step2 ), s0_ind = add( s0_ind, step2 ), c1_ind = sub( c1_ind, step2 ), s1_ind = add( s1_ind, step2 ), c2_ind = add( c2_ind, step2 ), s2_ind = sub( s2_ind, step2 ) ) ) + FOR( i = 1; i < m / 8; ( i++, c0_ind = ( c0_ind - step2 ), s0_ind = ( s0_ind + step2 ), c1_ind = ( c1_ind - step2 ), s1_ind = ( s1_ind + step2 ), c2_ind = ( c2_ind + step2 ), s2_ind = ( s2_ind - step2 ) ) ) { RY2[i] = L_sub( Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ), L_add( L_add( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ) ), L_sub( Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY2[-i] = L_add( L_sub( Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ), Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ) ), L_add( Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ), L_sub( Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ), L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); } - FOR( ; i < m / 4; ( i++, c0_ind = sub( c0_ind, step2 ), s0_ind = add( s0_ind, step2 ), c1_ind = add( c1_ind, step2 ), s1_ind = sub( s1_ind, step2 ), c2_ind = add( c2_ind, step2 ), s2_ind = sub( s2_ind, step2 ) ) ) + FOR( ; i < m / 4; ( i++, c0_ind = ( c0_ind - step2 ), s0_ind = ( s0_ind + step2 ), c1_ind = ( c1_ind + step2 ), s1_ind = ( s1_ind - step2 ), c2_ind = ( c2_ind + step2 ), s2_ind = ( s2_ind - step2 ) ) ) { RY2[i] = L_add( Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ), L_sub( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), L_sub( L_add( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ), Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ) ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ) ); // Qx move32(); IY2[-i] = L_add( Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ), L_add( Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ), L_sub( Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ), L_sub( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ) ) ); // Qx move32(); } - FOR( ; i < i_mult( 3, shr( m, 3 ) ); ( i++, c0_ind = sub( c0_ind, step2 ), s0_ind = add( s0_ind, step2 ), c1_ind = add( c1_ind, step2 ), s1_ind = sub( s1_ind, step2 ), c2_ind = sub( c2_ind, step2 ), s2_ind = add( s2_ind, step2 ) ) ) + FOR( ; i < ( 3 * ( m >> 3 ) ); ( i++, c0_ind = ( c0_ind - step2 ), s0_ind = ( s0_ind + step2 ), c1_ind = ( c1_ind + step2 ), s1_ind = ( s1_ind - step2 ), c2_ind = ( c2_ind - step2 ), s2_ind = ( s2_ind + step2 ) ) ) { RY2[i] = L_sub( L_add( Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ), Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ) ), L_sub( L_add( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ), Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ) ), L_sub( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); // Qx move32(); IY2[-i] = L_sub( L_add( Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ), L_add( Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ), L_add( Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ), Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ) ) ) ), L_add( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ); // Qx move32(); } - FOR( ; i < m / 2; ( i++, c0_ind = add( c0_ind, step2 ), s0_ind = sub( s0_ind, step2 ), c1_ind = add( c1_ind, step2 ), s1_ind = sub( s1_ind, step2 ), c2_ind = sub( c2_ind, step2 ), s2_ind = add( s2_ind, step2 ) ) ) + FOR( ; i < m / 2; ( i++, c0_ind = ( c0_ind + step2 ), s0_ind = ( s0_ind - step2 ), c1_ind = ( c1_ind + step2 ), s1_ind = ( s1_ind - step2 ), c2_ind = ( c2_ind - step2 ), s2_ind = ( s2_ind + step2 ) ) ) { RY2[i] = L_sub( L_sub( Mpy_32_16_1( RZ1[i], t_sin[c1_ind] ), Mpy_32_16_1( RZ0[i], t_sin[c0_ind] ) ), L_sub( L_add( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ), Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ) ), L_sub( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); // Qx move32(); IY2[-i] = L_add( L_sub( Mpy_32_16_1( IZ1[-i], t_sin[c1_ind] ), Mpy_32_16_1( IZ0[-i], t_sin[c0_ind] ) ), L_sub( L_add( Mpy_32_16_1( IZ2[i], t_sin[c2_ind] ), Mpy_32_16_1( RZ0[i], t_sin[s0_ind] ) ), L_add( Mpy_32_16_1( RZ1[i], t_sin[s1_ind] ), - Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( RZ2[-i], t_sin[s2_ind] ) ) ) ); // Qx move32(); } @@ -3298,7 +3304,7 @@ void ifft3_fx_ivas( L_sub( L_add( Mpy_32_16_1( RZ2[-i], t_sin[c2_ind] ), Mpy_32_16_1( IZ0[-i], t_sin[s0_ind] ) ), L_sub( Mpy_32_16_1( IZ1[-i], t_sin[s1_ind] ), - Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); + Mpy_32_16_1( IZ2[i], t_sin[s2_ind] ) ) ) ); // Qx move32(); /* Compute the inverse FFT for all 3 blocks. */ @@ -3311,16 +3317,16 @@ void ifft3_fx_ivas( y2 = RY2; /* Interlacing and scaling, scale = 1/3 */ - scale = (Word16) ( 0x2AAB ); + scale = extract_l( 0x2AAB /*(1/3).Q15*/ ); FOR( i = 0; i < n; ) { - X[i] = Mpy_32_16_1( ( *y0++ ), scale ); + X[i] = Mpy_32_16_1( ( *y0++ ), scale ); // Qx move32(); i = add( i, 1 ); - X[i] = Mpy_32_16_1( ( *y1++ ), scale ); + X[i] = Mpy_32_16_1( ( *y1++ ), scale ); // Qx move32(); i = add( i, 1 ); - X[i] = Mpy_32_16_1( ( *y2++ ), scale ); + X[i] = Mpy_32_16_1( ( *y2++ ), scale ); // Qx move32(); i = add( i, 1 ); } @@ -3330,8 +3336,8 @@ void ifft3_fx_ivas( static void rfft_post( - const Word16 *sine_table, - Word32 *buf, + const Word16 *sine_table, // Q15 + Word32 *buf, // hFdCngCom->fftBuffer_exp(Qx) const Word16 len ) { Word32 tmp1, tmp2, tmp3, tmp4; @@ -3345,68 +3351,69 @@ static void rfft_post( buf[0] = tmp1; move32(); - FOR( i = 1; i <= shr( add( len, 2 ), 2 ); i++ ) + FOR( i = 1; i <= ( ( len + 2 ) >> 2 ); i++ ) { - s = sine_table[i]; /* sin(pi*i/(len/2)) */ + s = sine_table[i]; /* sin(pi*i/(len/2)) Q15*/ move16(); - c = sine_table[add( i, shr( len, 2 ) )]; /* cos(pi*i/(len/2)) */ + c = sine_table[( i + ( len >> 2 ) )]; /* cos(pi*i/(len/2)) Q15*/ move16(); - tmp1 = L_sub( buf[2 * i], buf[sub( len, shl( i, 1 ) )] ); - tmp2 = L_add( buf[add( shl( i, 1 ), 1 )], buf[add( sub( len, shl( i, 1 ) ), 1 )] ); - tmp3 = L_sub( Mpy_32_16_1( tmp1, s ), Mpy_32_16_1( tmp2, c ) ); /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ - tmp4 = L_add( Mpy_32_16_1( tmp1, c ), Mpy_32_16_1( tmp2, s ) ); /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ - tmp1 = L_add( buf[2 * i], buf[sub( len, shl( i, 1 ) )] ); - tmp2 = L_sub( buf[add( shl( i, 1 ), 1 )], buf[add( sub( len, shl( i, 1 ) ), 1 )] ); + tmp1 = L_sub( buf[2 * i], buf[( len - ( i << 1 ) )] ); + tmp2 = L_add( buf[( ( i << 1 ) + 1 )], buf[( ( len - ( i << 1 ) ) + 1 )] ); + tmp3 = L_sub( Mpy_32_16_1( tmp1, s ), Mpy_32_16_1( tmp2, c ) ); /* real part of j*W(k,N)*[T(k) - T'(N-k)] Qx*/ + tmp4 = L_add( Mpy_32_16_1( tmp1, c ), Mpy_32_16_1( tmp2, s ) ); /* imag part of j*W(k,N)*[T(k) - T'(N-k)] Qx*/ + tmp1 = L_add( buf[2 * i], buf[( len - ( i << 1 ) )] ); + tmp2 = L_sub( buf[( ( i << 1 ) + 1 )], buf[( ( len - ( i << 1 ) ) + 1 )] ); buf[2 * i] = L_shr( L_sub( tmp1, tmp3 ), 1 ); move32(); - buf[add( shl( i, 1 ), 1 )] = L_shr( L_sub( tmp2, tmp4 ), 1 ); + buf[( ( i << 1 ) + 1 )] = L_shr( L_sub( tmp2, tmp4 ), 1 ); move32(); - buf[sub( len, shl( i, 1 ) )] = L_shr( L_add( tmp1, tmp3 ), 1 ); + buf[( len - ( i << 1 ) )] = L_shr( L_add( tmp1, tmp3 ), 1 ); move32(); - buf[add( sub( len, shl( i, 1 ) ), 1 )] = L_negate( L_shr( L_add( tmp2, tmp4 ), 1 ) ); + buf[( ( len - ( i << 1 ) ) + 1 )] = L_negate( L_shr( L_add( tmp2, tmp4 ), 1 ) ); move32(); } } static void rfft_pre( - const Word16 *sine_table, - Word32 *buf, - const Word16 len ) + const Word16 *sine_table, // Q15 + Word32 *buf, // hFdCngCom->fftBuffer_exp (Qx) + const Word16 len // Q0 +) { - const Word16 scale = (Word16) ( 1.0f / len * 32768.0 ); + const Word16 scale = ( div_s( 1, len ) ); // Q15 Word32 tmp1, tmp2, tmp3, tmp4; Word16 s, c; Word16 i = 0; - tmp1 = L_add( buf[0], buf[1] ); - buf[1] = Mpy_32_16_1( L_sub( buf[0], buf[1] ), scale ); + tmp1 = L_add( buf[0], buf[1] ); // Qx + buf[1] = Mpy_32_16_1( L_sub( buf[0], buf[1] ), scale ); // Qx move32(); - buf[0] = Mpy_32_16_1( tmp1, scale ); + buf[0] = Mpy_32_16_1( tmp1, scale ); // Qx move32(); - FOR( i = 1; i <= shr( add( len, 2 ), 2 ); i++ ) + FOR( i = 1; i <= ( ( len + 2 ) >> 2 ); i++ ) { - s = sine_table[i]; /* sin(pi*i/(len/2)) */ + s = sine_table[i]; /* sin(pi*i/(len/2)) Q15*/ move16(); - c = sine_table[add( i, shr( len, 2 ) )]; /* cos(pi*i/(len/2)) */ + c = sine_table[( i + ( len >> 2 ) )]; /* cos(pi*i/(len/2)) Q15*/ move16(); - tmp1 = L_sub( buf[2 * i], buf[sub( len, shl( i, 1 ) )] ); - tmp2 = L_add( buf[add( shl( i, 1 ), 1 )], buf[add( sub( len, shl( i, 1 ) ), 1 )] ); - tmp3 = L_add( Mpy_32_16_1( tmp1, s ), Mpy_32_16_1( tmp2, c ) ); /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ - tmp4 = L_sub( Mpy_32_16_1( tmp2, s ), Mpy_32_16_1( tmp1, c ) ); /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ - tmp1 = L_add( buf[2 * i], buf[sub( len, shl( i, 1 ) )] ); - tmp2 = L_sub( buf[add( shl( i, 1 ), 1 )], buf[add( sub( len, shl( i, 1 ) ), 1 )] ); + tmp1 = L_sub( buf[2 * i], buf[( len - ( i << 1 ) )] ); // Qx + tmp2 = L_add( buf[( ( i << 1 ) + 1 )], buf[( ( len - ( i << 1 ) ) + 1 )] ); // Qx + tmp3 = L_add( Mpy_32_16_1( tmp1, s ), Mpy_32_16_1( tmp2, c ) ); /* real part of j*W(k,N)*[T(k) - T'(N-k)] Qx*/ + tmp4 = L_sub( Mpy_32_16_1( tmp2, s ), Mpy_32_16_1( tmp1, c ) ); /* imag part of j*W(k,N)*[T(k) - T'(N-k)] Qx*/ + tmp1 = L_add( buf[2 * i], buf[( len - ( i << 1 ) )] ); // Qx + tmp2 = L_sub( buf[( ( i << 1 ) + 1 )], buf[( ( len - ( i << 1 ) ) + 1 )] ); // Qx - buf[2 * i] = Mpy_32_16_1( L_add( tmp1, tmp3 ), scale ); + buf[2 * i] = Mpy_32_16_1( L_add( tmp1, tmp3 ), scale ); // Qx move32(); - buf[add( shl( i, 1 ), 1 )] = L_negate( Mpy_32_16_1( L_add( tmp2, tmp4 ), scale ) ); + buf[( ( i << 1 ) + 1 )] = L_negate( Mpy_32_16_1( L_add( tmp2, tmp4 ), scale ) ); // Qx move32(); - buf[sub( len, shl( i, 1 ) )] = Mpy_32_16_1( L_sub( tmp1, tmp3 ), scale ); + buf[( len - ( i << 1 ) )] = Mpy_32_16_1( L_sub( tmp1, tmp3 ), scale ); // Qx move32(); - buf[add( sub( len, shl( i, 1 ) ), 1 )] = Mpy_32_16_1( L_sub( tmp2, tmp4 ), scale ); + buf[( ( len - ( i << 1 ) ) + 1 )] = Mpy_32_16_1( L_sub( tmp2, tmp4 ), scale ); // Qx move32(); } @@ -3414,9 +3421,9 @@ static void rfft_pre( } Word16 RFFTN_fx( - Word32 *data, - const Word16 *sine_table, - const Word16 len, + Word32 *data, // hFdCngCom->fftBuffer_exp (Qx) + const Word16 *sine_table, // Q15 + const Word16 len, // Q0 const Word16 sign ) { assert( len <= 640 && len > 0 ); @@ -3435,7 +3442,7 @@ Word16 RFFTN_fx( { x[i] = data[2 * i]; move32(); - y[i] = data[add( shl( i, 1 ), 1 )]; + y[i] = data[( ( i << 1 ) + 1 )]; move32(); } DoRTFT320_fx( x, y ); @@ -3443,7 +3450,7 @@ Word16 RFFTN_fx( { data[2 * i] = x[i]; move32(); - data[add( shl( i, 1 ), 1 )] = y[i]; + data[( ( i << 1 ) + 1 )] = y[i]; move32(); } @@ -3472,7 +3479,7 @@ Word16 RFFTN_fx( { reordered_data[2 * i] = data[i]; move32(); - reordered_data[add( shl( i, 1 ), 1 )] = data[sub( len, i )]; + reordered_data[( ( i << 1 ) + 1 )] = data[( len - i )]; move32(); } } @@ -3486,7 +3493,7 @@ Word16 RFFTN_fx( { reordered_data[i] = data[2 * i]; move32(); - reordered_data[sub( len, i )] = data[add( shl( i, 1 ), 1 )]; + reordered_data[( len - i )] = data[( ( i << 1 ) + 1 )]; move32(); } ifft_rel_fx32( reordered_data, len, log2 ); @@ -3503,10 +3510,11 @@ Word16 RFFTN_fx( } static void butterfly( - const Word32 a, - const Word32 b, - Word32 *aPlusb, - Word32 *aMinusb ) + const Word32 a, // Qx + const Word32 b, // Qx + Word32 *aPlusb, // Qx + Word32 *aMinusb // Qx +) { *aPlusb = L_add( a, b ); move32(); @@ -3517,7 +3525,8 @@ static void butterfly( } static void fft2( - Word32 *pInOut ) + Word32 *pInOut // Qx +) { /* FFT MATRIX: 1.0000 1.0000 @@ -3550,7 +3559,7 @@ static void fft2( static const Word16 C31 = 0x4000; /*0.5f in Q15 cos(PI/3); sin(2*PI/3) */ static const Word16 C32 = 0x6ED9; /*0.866025403784439f in Q15 cos(PI/3); sin(2*PI/3) */ -static void fft3_2( Word32 *pInOut ) +static void fft3_2( Word32 *pInOut /*Qx*/ ) { Word32 re1, im1; Word32 re2, im2; @@ -3559,17 +3568,17 @@ static void fft3_2( Word32 *pInOut ) Word32 tmp1, tmp2; Word32 tmp3, tmp4; - re1 = pInOut[0]; + re1 = pInOut[0]; // Qx move32(); - im1 = pInOut[1]; + im1 = pInOut[1]; // Qx move32(); - re2 = pInOut[2]; + re2 = pInOut[2]; // Qx move32(); - im2 = pInOut[3]; + im2 = pInOut[3]; // Qx move32(); - re3 = pInOut[4]; + re3 = pInOut[4]; // Qx move32(); - im3 = pInOut[5]; + im3 = pInOut[5]; // Qx move32(); /* FFT MATRIX: @@ -3586,20 +3595,20 @@ static void fft3_2( Word32 *pInOut ) move32(); pInOut[1] = L_add( im1, tmp3 ); move32(); - pInOut[2] = L_sub( re1, L_sub( Mpy_32_16_1( tmp1, C31 ), Mpy_32_16_1( tmp4, C32 ) ) ); + pInOut[2] = L_sub( re1, L_sub( Mpy_32_16_1( tmp1, C31 ), Mpy_32_16_1( tmp4, C32 ) ) ); // Qx move32(); - pInOut[4] = L_sub( re1, L_add( Mpy_32_16_1( tmp1, C31 ), Mpy_32_16_1( tmp4, C32 ) ) ); + pInOut[4] = L_sub( re1, L_add( Mpy_32_16_1( tmp1, C31 ), Mpy_32_16_1( tmp4, C32 ) ) ); // Qx move32(); - pInOut[3] = L_sub( im1, L_add( Mpy_32_16_1( tmp2, C32 ), Mpy_32_16_1( tmp3, C31 ) ) ); + pInOut[3] = L_sub( im1, L_add( Mpy_32_16_1( tmp2, C32 ), Mpy_32_16_1( tmp3, C31 ) ) ); // Qx move32(); - pInOut[5] = L_add( im1, L_sub( Mpy_32_16_1( tmp2, C32 ), Mpy_32_16_1( tmp3, C31 ) ) ); + pInOut[5] = L_add( im1, L_sub( Mpy_32_16_1( tmp2, C32 ), Mpy_32_16_1( tmp3, C31 ) ) ); // Qx move32(); } static void fft4( - Word32 *pInOut ) + Word32 *pInOut /*Qx*/ ) { Word32 re1, im1; Word32 re2, im2; @@ -3664,13 +3673,13 @@ static void fft4( return; } -static const Word16 C51 = 0x278D; /* 0.309016994374947f cos(2*PI/5); */ -static const Word16 C52 = 0x79bc; /* 0.951056516295154f sin(2*PI/5); */ -static const Word16 C53 = 0x678D; /* 0.809016994374947f cos( PI/5); */ -static const Word16 C54 = 0x4B3D; /* 0.587785252292473f sin( PI/5); */ +static const Word16 C51 = 0x278D; /* 0.309016994374947f cos(2*PI/5); Q15*/ +static const Word16 C52 = 0x79bc; /* 0.951056516295154f sin(2*PI/5); Q15*/ +static const Word16 C53 = 0x678D; /* 0.809016994374947f cos( PI/5); Q15*/ +static const Word16 C54 = 0x4B3D; /* 0.587785252292473f sin( PI/5); Q15*/ static void fft5( - cmplx *pInOut ) + cmplx *pInOut /*Qx*/ ) { cmplx x[5]; cmplx t[4]; @@ -3707,22 +3716,22 @@ static void fft5( pInOut[0] = CL_add( x[0], CL_add( t[0], t[2] ) ); move32(); - pInOut[1] = CL_add( CL_add( x[0], CL_sub( CL_scale( t[0], C51 ), CL_scale( t[2], C53 ) ) ), CL_add( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C52 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C54 ) ) ) ); + pInOut[1] = CL_add( CL_add( x[0], CL_sub( CL_scale( t[0], C51 ), CL_scale( t[2], C53 ) ) ), CL_add( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C52 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C54 ) ) ) ); // Qx move32(); - pInOut[4] = CL_add( x[0], CL_sub( CL_scale( t[0], C51 ), CL_add( CL_scale( t[2], C53 ), CL_add( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C52 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C54 ) ) ) ) ) ); + pInOut[4] = CL_add( x[0], CL_sub( CL_scale( t[0], C51 ), CL_add( CL_scale( t[2], C53 ), CL_add( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C52 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C54 ) ) ) ) ) ); // Qx move32(); - pInOut[2] = CL_add( CL_sub( x[0], CL_scale( t[0], C53 ) ), CL_add( CL_scale( t[2], C51 ), CL_sub( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C54 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C52 ) ) ) ) ); + pInOut[2] = CL_add( CL_sub( x[0], CL_scale( t[0], C53 ) ), CL_add( CL_scale( t[2], C51 ), CL_sub( CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C54 ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C52 ) ) ) ) ); // Qx move32(); - pInOut[3] = CL_add( CL_sub( x[0], CL_scale( t[0], C53 ) ), CL_add( CL_sub( CL_scale( t[2], C51 ), CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C54 ) ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C52 ) ) ) ); + pInOut[3] = CL_add( CL_sub( x[0], CL_scale( t[0], C53 ) ), CL_add( CL_sub( CL_scale( t[2], C51 ), CL_conjugate( CL_scale( CL_swap_real_imag( t[1] ), C54 ) ) ), CL_conjugate( CL_scale( CL_swap_real_imag( t[3] ), C52 ) ) ) ); // Qx move32(); return; } -static const Word16 C81 = 0x5a82; /* 0.707106781186548f cos(PI/4); */ +static const Word16 C81 = 0x5a82; /* 0.707106781186548f cos(PI/4); Q15*/ static void fft8_2( - Word32 *pInOut ) + Word32 *pInOut /*Qx*/ ) { Word32 re0, im0, re4, im4; @@ -3802,8 +3811,8 @@ static void fft8_2( } static void nextFFT( - Word32 *x, - const Word16 length ) + Word32 *x, /*Qx*/ + const Word16 length /*Qx*/ ) { cmplx val[5]; SWITCH( length ) @@ -3822,7 +3831,7 @@ static void nextFFT( { val[i].re = x[2 * i]; move32(); - val[i].im = x[add( shl( i, 1 ), 1 )]; + val[i].im = x[( ( i << 1 ) + 1 )]; move32(); } fft5( val ); @@ -3830,7 +3839,7 @@ static void nextFFT( { x[2 * i] = val[i].re; move32(); - x[add( shl( i, 1 ), 1 )] = val[i].im; + x[( ( i << 1 ) + 1 )] = val[i].im; move32(); } BREAK; @@ -3863,20 +3872,20 @@ static __inline Word16 findFactor( move16(); BREAK; } - i = add( i, 1 ); + i += 1; } return factor; } static __inline void twiddle( - Word32 *x, + Word32 *x, // Qx const Word16 length, const Word16 n1, const Word16 n2 ) { Word16 i, ii; - const Word16 *ptr_sin = &sin_twiddle_table_25_5_5[0]; - const Word16 *ptr_cos = &cos_twiddle_table_25_5_5[0]; + const Word16 *ptr_sin = &sin_twiddle_table_25_5_5[0]; // Q15 + const Word16 *ptr_cos = &cos_twiddle_table_25_5_5[0]; // Q15 test(); test(); @@ -3884,8 +3893,8 @@ static __inline void twiddle( test(); IF( EQ_16( length, 16 ) && EQ_16( n1, 8 ) && EQ_16( n2, 2 ) ) { - ptr_sin = &sin_twiddle_table_16_8_2[0]; - ptr_cos = &cos_twiddle_table_16_8_2[0]; + ptr_sin = &sin_twiddle_table_16_8_2[0]; // Q15 + ptr_cos = &cos_twiddle_table_16_8_2[0]; // Q15 } ELSE IF( NE_16( length, 25 ) || NE_16( n1, 5 ) || NE_16( n2, 5 ) ) { @@ -3897,11 +3906,11 @@ static __inline void twiddle( FOR( ii = 1; ii < n2; ii++ ) { Word32 xRe, xIm; - xRe = x[shl( ( add( i_mult( i, n2 ), ii ) ), 1 )]; - xIm = x[add( shl( ( add( i_mult( i, n2 ), ii ) ), 1 ), 1 )]; - x[shl( ( add( i_mult( i, n2 ), ii ) ), 1 )] = L_sub( Mpy_32_16_1( xRe, ptr_cos[add( i_mult( i, n2 ), ii )] ), Mpy_32_16_1( xIm, ptr_sin[add( i_mult( i, n2 ), ii )] ) ); + xRe = x[( ( ( ( i * n2 ) + ii ) ) << 1 )]; // Qx + xIm = x[( ( ( ( ( i * n2 ) + ii ) ) << 1 ) + 1 )]; // Qx + x[( ( ( ( i * n2 ) + ii ) ) << 1 )] = L_sub( Mpy_32_16_1( xRe, ptr_cos[( ( i * n2 ) + ii )] ), Mpy_32_16_1( xIm, ptr_sin[( ( i * n2 ) + ii )] ) ); // Qx move32(); - x[add( shl( ( add( i_mult( i, n2 ), ii ) ), 1 ), 1 )] = L_add( Mpy_32_16_1( xRe, ptr_sin[add( i_mult( i, n2 ), ii )] ), Mpy_32_16_1( xIm, ptr_cos[add( i_mult( i, n2 ), ii )] ) ); + x[( ( ( ( ( i * n2 ) + ii ) ) << 1 ) + 1 )] = L_add( Mpy_32_16_1( xRe, ptr_sin[( ( i * n2 ) + ii )] ), Mpy_32_16_1( xIm, ptr_cos[( ( i * n2 ) + ii )] ) ); // Qx move32(); } } @@ -3909,9 +3918,10 @@ static __inline void twiddle( } static void cooleyTukeyFFT( - Word32 *x, + Word32 *x, // Qx const Word16 length, - Word32 *scratch ) + Word32 *scratch // Qx +) { Word16 factor; Word16 i, ii; @@ -3937,9 +3947,9 @@ static void cooleyTukeyFFT( case 5: FOR( i = 0; i < 5; i++ ) { - val[i].re = x[2 * i]; + val[i].re = x[2 * i]; // Qx move32(); - val[i].im = x[add( shl( i, 1 ), 1 )]; + val[i].im = x[( ( i << 1 ) + 1 )]; // Qx move32(); } fft5( val ); @@ -3947,7 +3957,7 @@ static void cooleyTukeyFFT( { x[2 * i] = val[i].re; move32(); - x[add( shl( i, 1 ), 1 )] = val[i].im; + x[( ( i << 1 ) + 1 )] = val[i].im; move32(); } BREAK; @@ -3958,14 +3968,14 @@ static void cooleyTukeyFFT( { factor = findFactor( length ); - IF( GT_16( factor, 0 ) && GT_16( idiv1616( length, factor ), 1 ) ) + IF( ( factor > 0 ) && GT_16( idiv1616( length, factor ), 1 ) ) { n1 = factor; move16(); n2 = idiv1616( length, factor ); /* DATA Resorting for stage1 */ - dest = scratch; + dest = scratch; // Qx FOR( i = 0; i < 2 * n1; i += 2 ) { src = x + i; @@ -3980,7 +3990,7 @@ static void cooleyTukeyFFT( src += 2 * n1; } } - src = scratch; + src = scratch; // Qx dest = x; FOR( i = 0; i < length; i++ ) { @@ -4003,9 +4013,9 @@ static void cooleyTukeyFFT( { FOR( ii = 0; ii < n1; ii++ ) { - scratch[2 * cnt] = x[shl( add( i, i_mult( ii, n2 ) ), 1 )]; + scratch[2 * cnt] = x[( ( i + ( ii * n2 ) ) << 1 )]; move32(); - scratch[add( shl( cnt, 1 ), 1 )] = x[add( shl( add( i, i_mult( ii, n2 ) ), 1 ), 1 )]; + scratch[( ( cnt << 1 ) + 1 )] = x[( ( ( i + ( ii * n2 ) ) << 1 ) + 1 )]; move32(); cnt = add( cnt, 1 ); } @@ -4021,9 +4031,9 @@ static void cooleyTukeyFFT( { FOR( ii = 0; ii < n2; ii++ ) { - x[2 * cnt] = scratch[shl( add( i, i_mult( ii, n1 ) ), 1 )]; + x[2 * cnt] = scratch[( ( i + ( ii * n1 ) ) << 1 )]; move32(); - x[add( shl( cnt, 1 ), 1 )] = scratch[add( shl( add( i, i_mult( ii, n1 ) ), 1 ), 1 )]; + x[( ( cnt << 1 ) + 1 )] = scratch[( ( ( i + ( ii * n1 ) ) << 1 ) + 1 )]; move32(); cnt = add( cnt, 1 ); } @@ -4040,9 +4050,9 @@ static void cooleyTukeyFFT( } static void pfaDFT( - Word32 *x, - const Word16 length, - Word32 *scratch1, + Word32 *x, // Qx + const Word16 length, // Q0 + Word32 *scratch1, // Qx const Word16 numFactors, const Word16 *factor ) { @@ -4060,17 +4070,17 @@ static void pfaDFT( Word16 n1 = idiv1616( length, n2 ); Word16 idx, incr; - WHILE( ( i_mult( n1_inv, n1 ) % n2 ) != 1 ) + WHILE( ( ( n1_inv * n1 ) % n2 ) != 1 ) { n1_inv = add( n1_inv, 1 ); } - WHILE( ( i_mult( n2_inv, n2 ) % n1 ) != 1 ) + WHILE( ( ( n2_inv * n2 ) % n1 ) != 1 ) { n2_inv = add( n2_inv, 1 ); } idx = 0; move16(); - incr = i_mult( n1, n1_inv ); + incr = ( n1 * n1_inv ); move16(); cnt = 0; move16(); @@ -4081,7 +4091,7 @@ static void pfaDFT( tmp[cnt] = x[2 * idx]; move32(); cnt = add( cnt, 1 ); - tmp[cnt] = x[add( shl( idx, 1 ), 1 )]; + tmp[cnt] = x[( ( idx << 1 ) + 1 )]; // Qx move32(); cnt = add( cnt, 1 ); @@ -4092,10 +4102,10 @@ static void pfaDFT( idx = sub( idx, length ); } } - tmp[cnt] = x[2 * idx]; + tmp[cnt] = x[2 * idx]; // Qx move32(); cnt = add( cnt, 1 ); - tmp[cnt] = x[add( shl( idx, 1 ), 1 )]; + tmp[cnt] = x[( ( idx << 1 ) + 1 )]; // Qx move32(); cnt = add( cnt, 1 ); idx = add( idx, 1 ); @@ -4108,9 +4118,9 @@ static void pfaDFT( { FOR( i = 0; i < n2; i++ ) { - x[shl( add( cnt, i_mult( i, n1 ) ), 1 )] = tmp[shl( add( i_mult( cnt, n2 ), i ), 1 )]; + x[( ( cnt + ( i * n1 ) ) << 1 )] = tmp[( ( ( cnt * n2 ) + i ) << 1 )]; move32(); - x[add( shl( add( cnt, i_mult( i, n1 ) ), 1 ), 1 )] = tmp[add( shl( add( i_mult( cnt, n2 ), i ), 1 ), 1 )]; + x[( ( ( cnt + ( i * n1 ) ) << 1 ) + 1 )] = tmp[( ( ( ( cnt * n2 ) + i ) << 1 ) + 1 )]; move32(); } } @@ -4130,7 +4140,7 @@ static void pfaDFT( tmp[2 * idx] = x[cnt]; move32(); cnt = add( cnt, 1 ); - tmp[add( shl( idx, 1 ), 1 )] = x[cnt]; + tmp[( ( idx << 1 ) + 1 )] = x[cnt]; move32(); cnt = add( cnt, 1 ); idx = add( idx, n2 ); @@ -4145,7 +4155,7 @@ static void pfaDFT( { x[2 * cnt] = tmp[2 * cnt]; move32(); - x[add( shl( cnt, 1 ), 1 )] = tmp[add( shl( cnt, 1 ), 1 )]; + x[( ( cnt << 1 ) + 1 )] = tmp[( ( cnt << 1 ) + 1 )]; move32(); } } @@ -4158,10 +4168,11 @@ static void pfaDFT( } static void fftf_interleave( - Word32 *re, - Word32 *im, - Word32 *out, - const Word16 len ) + Word32 *re, // Qx + Word32 *im, // Qx + Word32 *out, // Qx + const Word16 len // Q0 +) { Word16 i = 0; move16(); @@ -4178,10 +4189,11 @@ static void fftf_interleave( } static void fftf_deinterleave( - Word32 *in, - Word32 *re, - Word32 *im, - const Word16 len ) + Word32 *in, // Qx + Word32 *re, // Qx + Word32 *im, // Qx + const Word16 len // Q0 +) { Word16 i = 0; move16(); @@ -4198,8 +4210,8 @@ static void fftf_deinterleave( } static void DoRTFT600( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx*/ + Word32 *y /* i/o: imaginary part of input and output data Qx*/ ) { Word32 scratch[1200], cmplx[1200]; @@ -4216,8 +4228,8 @@ static void DoRTFT600( } static void DoRTFT400( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word32 scratch[800], cmplx[800]; @@ -4234,8 +4246,8 @@ static void DoRTFT400( } static void DoRTFT240( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word32 scratch[480], cmplx[480]; @@ -4252,8 +4264,8 @@ static void DoRTFT240( } static void DoRTFT200( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word32 scratch[400], cmplx[400]; @@ -4269,8 +4281,8 @@ static void DoRTFT200( } static void DoRTFT100( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ + Word32 *x, /* i/o: real part of input and output data Qx */ + Word32 *y /* i/o: imaginary part of input and output data Qx */ ) { Word32 scratch[200], cmplx[200]; @@ -4287,9 +4299,10 @@ static void DoRTFT100( void DoFFT_fx( - Word32 *re2, - Word32 *im2, - const Word16 length ) + Word32 *re2, // Qx + Word32 *im2, // Qx + const Word16 length // Q0 +) { SWITCH( length ) { @@ -4350,7 +4363,8 @@ void DoFFT_fx( *-----------------------------------------------------------------*/ static void fft_len5( - cmplx *x ) + cmplx *x // Qx +) { cmplx y1, y2, y3, y4; cmplx t; @@ -4359,18 +4373,18 @@ static void fft_len5( y4 = CL_sub( x[1], x[4] ); y3 = CL_add( x[2], x[3] ); y2 = CL_sub( x[2], x[3] ); - t = CL_scale( CL_sub( y1, y3 ), FFT_C54 ); + t = CL_scale( CL_sub( y1, y3 ), FFT_C54 ); // Qx y1 = CL_add( y1, y3 ); x[0] = CL_add( x[0], y1 ); move64(); - y1 = CL_add( x[0], CL_shl( CL_scale( y1, FFT_C55 ), 1 ) ); + y1 = CL_add( x[0], CL_shl( CL_scale( y1, FFT_C55 ), 1 ) ); // Qx y3 = CL_sub( y1, t ); y1 = CL_add( y1, t ); t = CL_scale( CL_add( y4, y2 ), FFT_C51 ); - y4 = CL_add( t, CL_shl( CL_scale( y4, FFT_C52 ), 1 ) ); - y2 = CL_add( t, CL_scale( y2, FFT_C53 ) ); + y4 = CL_add( t, CL_shl( CL_scale( y4, FFT_C52 ), 1 ) ); // Qx + y2 = CL_add( t, CL_scale( y2, FFT_C53 ) ); // Qx x[1] = CL_msu_j( y1, y2 ); move64(); @@ -4385,7 +4399,8 @@ static void fft_len5( } static void fft_len8( - cmplx *x ) + cmplx *x // Qx +) { cmplx t[8], s[8]; @@ -4452,7 +4467,8 @@ static void fft_len8( } static void fft_len10( - cmplx *x ) + cmplx *x // Qx +) { cmplx t; cmplx s[4]; @@ -4466,22 +4482,22 @@ static void fft_len10( move64(); s[1] = CL_sub( x[2], x[8] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[0] = CL_add( x[0], s[0] ); move64(); - s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx move64(); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[2] = CL_msu_j( s[0], s[1] ); @@ -4501,21 +4517,21 @@ static void fft_len10( move64(); s[1] = CL_sub( x[7], x[3] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[1] = CL_add( x[5], s[0] ); move64(); - s[0] = CL_add( y[1], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[1], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[3] = CL_msu_j( s[0], s[1] ); @@ -4558,7 +4574,8 @@ static void fft_len10( } static void fft_len15( - cmplx *x ) + cmplx *x // Qx +) { cmplx t; cmplx s[5]; @@ -4572,21 +4589,21 @@ static void fft_len15( move64(); s[1] = CL_sub( x[6], x[9] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[0] = CL_add( x[0], s[0] ); move64(); - s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[1] = CL_msu_j( s[0], s[1] ); @@ -4606,21 +4623,21 @@ static void fft_len15( move64(); s[1] = CL_sub( x[11], x[14] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[5] = CL_add( x[5], s[0] ); move64(); - s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[6] = CL_msu_j( s[0], s[1] ); @@ -4640,21 +4657,21 @@ static void fft_len15( move64(); s[1] = CL_sub( x[1], x[4] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[10] = CL_add( x[10], s[0] ); move64(); - s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[11] = CL_msu_j( s[0], s[1] ); @@ -4668,7 +4685,7 @@ static void fft_len15( s[0] = CL_add( y[5], y[10] ); move64(); - s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); // Qx move64(); x[0] = CL_add( y[0], s[0] ); move64(); @@ -4682,7 +4699,7 @@ static void fft_len15( s[0] = CL_add( y[6], y[11] ); move64(); - s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); // Qx move64(); x[6] = CL_add( y[1], s[0] ); move64(); @@ -4696,7 +4713,7 @@ static void fft_len15( s[0] = CL_add( y[7], y[12] ); move64(); - s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); // Qx move64(); x[12] = CL_add( y[2], s[0] ); move64(); @@ -4710,7 +4727,7 @@ static void fft_len15( s[0] = CL_add( y[8], y[13] ); move64(); - s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); // Qx move64(); x[3] = CL_add( y[3], s[0] ); move64(); @@ -4724,7 +4741,7 @@ static void fft_len15( s[0] = CL_add( y[9], y[14] ); move64(); - s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); // Qx move64(); x[9] = CL_add( y[4], s[0] ); move64(); @@ -4740,19 +4757,20 @@ static void fft_len15( } static void fft_len16( - cmplx *x ) + cmplx *x // Qx +) { cmplx s[4]; cmplx t[4]; cmplx y[16]; - s[0] = CL_shr( x[0], SCALEFACTOR16 ); + s[0] = CL_shr( x[0], SCALEFACTOR16 ); // Qx move64(); - s[1] = CL_shr( x[4], SCALEFACTOR16 ); + s[1] = CL_shr( x[4], SCALEFACTOR16 ); // Qx move64(); - s[2] = CL_shr( x[8], SCALEFACTOR16 ); + s[2] = CL_shr( x[8], SCALEFACTOR16 ); // Qx move64(); - s[3] = CL_shr( x[12], SCALEFACTOR16 ); + s[3] = CL_shr( x[12], SCALEFACTOR16 ); // Qx move64(); t[0] = CL_add( s[0], s[2] ); @@ -4773,13 +4791,13 @@ static void fft_len16( y[3] = CL_add( t[1], t[3] ); move64(); - s[0] = CL_shr( x[1], SCALEFACTOR16 ); + s[0] = CL_shr( x[1], SCALEFACTOR16 ); // Qx move64(); - s[1] = CL_shr( x[5], SCALEFACTOR16 ); + s[1] = CL_shr( x[5], SCALEFACTOR16 ); // Qx move64(); - s[2] = CL_shr( x[9], SCALEFACTOR16 ); + s[2] = CL_shr( x[9], SCALEFACTOR16 ); // Qx move64(); - s[3] = CL_shr( x[13], SCALEFACTOR16 ); + s[3] = CL_shr( x[13], SCALEFACTOR16 ); // Qx move64(); t[0] = CL_add( s[0], s[2] ); @@ -4800,13 +4818,13 @@ static void fft_len16( y[7] = CL_add( t[1], t[3] ); move64(); - s[0] = CL_shr( x[2], SCALEFACTOR16 ); + s[0] = CL_shr( x[2], SCALEFACTOR16 ); // Qx move64(); - s[1] = CL_shr( x[6], SCALEFACTOR16 ); + s[1] = CL_shr( x[6], SCALEFACTOR16 ); // Qx move64(); - s[2] = CL_shr( x[10], SCALEFACTOR16 ); + s[2] = CL_shr( x[10], SCALEFACTOR16 ); // Qx move64(); - s[3] = CL_shr( x[14], SCALEFACTOR16 ); + s[3] = CL_shr( x[14], SCALEFACTOR16 ); // Qx move64(); t[0] = CL_add( s[0], s[2] ); @@ -4829,13 +4847,13 @@ static void fft_len16( y[11] = CL_add( t[1], t[3] ); move64(); - s[0] = CL_shr( x[3], SCALEFACTOR16 ); + s[0] = CL_shr( x[3], SCALEFACTOR16 ); // Qx move64(); - s[1] = CL_shr( x[7], SCALEFACTOR16 ); + s[1] = CL_shr( x[7], SCALEFACTOR16 ); // Qx move64(); - s[2] = CL_shr( x[11], SCALEFACTOR16 ); + s[2] = CL_shr( x[11], SCALEFACTOR16 ); // Qx move64(); - s[3] = CL_shr( x[15], SCALEFACTOR16 ); + s[3] = CL_shr( x[15], SCALEFACTOR16 ); // Qx move64(); t[0] = CL_add( s[0], s[2] ); @@ -4856,17 +4874,17 @@ static void fft_len16( y[15] = CL_add( t[1], t[3] ); move64(); - s[0] = CL_scale( y[11], FFT_C162 ); + s[0] = CL_scale( y[11], FFT_C162 ); // Qx move64(); y[11] = CL_mac_j( s[0], s[0] ); move64(); - s[0] = CL_scale( y[14], FFT_C162 ); + s[0] = CL_scale( y[14], FFT_C162 ); // Qx move64(); y[14] = CL_mac_j( s[0], s[0] ); move64(); - s[0] = CL_scale( y[6], FFT_C161 ); + s[0] = CL_scale( y[6], FFT_C161 ); // Qx move64(); y[6] = CL_mac_j( s[0], s[0] ); move64(); @@ -4875,7 +4893,7 @@ static void fft_len16( y[6] = CL_conjugate( y[6] ); move64(); - s[0] = CL_scale( y[9], FFT_C161 ); + s[0] = CL_scale( y[9], FFT_C161 ); // Qx move64(); y[9] = CL_mac_j( s[0], s[0] ); move64(); @@ -4884,30 +4902,30 @@ static void fft_len16( y[9] = CL_conjugate( y[9] ); move64(); - s[0] = CL_scale( y[5], FFT_C163 ); + s[0] = CL_scale( y[5], FFT_C163 ); // Qx move64(); - s[1] = CL_scale( y[5], FFT_C166 ); + s[1] = CL_scale( y[5], FFT_C166 ); // Qx move64(); y[5] = CL_mac_j( s[0], s[1] ); move64(); - s[0] = CL_scale( y[7], FFT_C165 ); + s[0] = CL_scale( y[7], FFT_C165 ); // Qx move64(); - s[1] = CL_scale( y[7], FFT_C164 ); + s[1] = CL_scale( y[7], FFT_C164 ); // Qx move64(); y[7] = CL_mac_j( s[0], s[1] ); move64(); - s[0] = CL_scale( y[13], FFT_C165 ); + s[0] = CL_scale( y[13], FFT_C165 ); // Qx move64(); - s[1] = CL_scale( y[13], FFT_C164 ); + s[1] = CL_scale( y[13], FFT_C164 ); // Qx move64(); y[13] = CL_mac_j( s[0], s[1] ); move64(); - s[0] = CL_scale( y[15], FFT_C164 ); + s[0] = CL_scale( y[15], FFT_C164 ); // Qx move64(); - s[1] = CL_scale( y[15], FFT_C165 ); + s[1] = CL_scale( y[15], FFT_C165 ); // Qx move64(); y[15] = CL_mac_j( s[0], s[1] ); move64(); @@ -4988,7 +5006,8 @@ static void fft_len16( } static void fft_len20_fx( - cmplx *x ) + cmplx *x // Qx +) { cmplx s[4]; cmplx xx[5]; @@ -4996,15 +5015,15 @@ static void fft_len20_fx( cmplx tt[4]; cmplx y[20]; - xx[0] = CL_shr( x[0], SCALEFACTOR20 ); + xx[0] = CL_shr( x[0], SCALEFACTOR20 ); // Qx move64(); - xx[1] = CL_shr( x[16], SCALEFACTOR20 ); + xx[1] = CL_shr( x[16], SCALEFACTOR20 ); // Qx move64(); - xx[2] = CL_shr( x[12], SCALEFACTOR20 ); + xx[2] = CL_shr( x[12], SCALEFACTOR20 ); // Qx move64(); - xx[3] = CL_shr( x[8], SCALEFACTOR20 ); + xx[3] = CL_shr( x[8], SCALEFACTOR20 ); // Qx move64(); - xx[4] = CL_shr( x[4], SCALEFACTOR20 ); + xx[4] = CL_shr( x[4], SCALEFACTOR20 ); // Qx move64(); s[0] = CL_add( xx[1], xx[4] ); @@ -5020,14 +5039,14 @@ static void fft_len20_fx( move64(); y[0] = CL_add( xx[0], s[0] ); move64(); - s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); move64(); @@ -5065,14 +5084,14 @@ static void fft_len20_fx( move64(); y[1] = CL_add( xx[0], s[0] ); move64(); - s[0] = CL_add( y[1], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[1], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); move64(); @@ -5110,14 +5129,14 @@ static void fft_len20_fx( move64(); y[2] = CL_add( xx[0], s[0] ); move64(); - s[0] = CL_add( y[2], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[2], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); move64(); @@ -5155,14 +5174,14 @@ static void fft_len20_fx( move64(); y[3] = CL_add( xx[0], s[0] ); move64(); - s[0] = CL_add( y[3], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[3], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); move64(); @@ -5270,7 +5289,8 @@ static void fft_len20_fx( } static void fft_len30( - cmplx *x ) + cmplx *x // Qx +) { cmplx t; cmplx s[4]; @@ -5323,20 +5343,20 @@ static void fft_len30( move64(); s[1] = CL_sub( xx[2], xx[3] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[0] = CL_add( xx[0], s[0] ); - s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[1] = CL_msu_j( s[0], s[1] ); @@ -5361,16 +5381,16 @@ static void fft_len30( move64(); y[5] = CL_add( xx[5], s[0] ); move64(); - s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[6] = CL_msu_j( s[0], s[1] ); @@ -5395,13 +5415,13 @@ static void fft_len30( move64(); y[10] = CL_add( xx[10], s[0] ); move64(); - s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); move64(); @@ -5417,7 +5437,7 @@ static void fft_len30( s[0] = CL_add( y[5], y[10] ); move64(); - s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); // Qx move64(); z[0] = CL_add( y[0], s[0] ); move64(); @@ -5431,7 +5451,7 @@ static void fft_len30( s[0] = CL_add( y[6], y[11] ); move64(); - s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); // Qx move64(); z[6] = CL_add( y[1], s[0] ); move64(); @@ -5445,7 +5465,7 @@ static void fft_len30( s[0] = CL_add( y[7], y[12] ); move64(); - s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); // Qx move64(); z[12] = CL_add( y[2], s[0] ); move64(); @@ -5459,7 +5479,7 @@ static void fft_len30( s[0] = CL_add( y[8], y[13] ); move64(); - s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); // Qx move64(); z[3] = CL_add( y[3], s[0] ); move64(); @@ -5473,7 +5493,7 @@ static void fft_len30( s[0] = CL_add( y[9], y[14] ); move64(); - s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); // Qx move64(); z[9] = CL_add( y[4], s[0] ); move64(); @@ -5526,21 +5546,21 @@ static void fft_len30( move64(); s[1] = CL_sub( xx[2], xx[3] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[0] = CL_add( xx[0], s[0] ); move64(); - s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[0], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[1] = CL_msu_j( s[0], s[1] ); @@ -5560,21 +5580,21 @@ static void fft_len30( move64(); s[1] = CL_sub( xx[7], xx[8] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[5] = CL_add( xx[5], s[0] ); move64(); - s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[5], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[6] = CL_msu_j( s[0], s[1] ); @@ -5594,21 +5614,21 @@ static void fft_len30( move64(); s[1] = CL_sub( xx[12], xx[13] ); move64(); - t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); + t = CL_scale( CL_sub( s[0], s[2] ), FFT_C54 ); // Qx s[0] = CL_add( s[0], s[2] ); move64(); y[10] = CL_add( xx[10], s[0] ); move64(); - s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); + s[0] = CL_add( y[10], CL_shl( CL_scale( s[0], FFT_C55 ), 1 ) ); // Qx move64(); s[2] = CL_sub( s[0], t ); move64(); s[0] = CL_add( s[0], t ); move64(); - t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); - s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); + t = CL_scale( CL_add( s[3], s[1] ), FFT_C51 ); // Qx + s[3] = CL_add( t, CL_shl( CL_scale( s[3], FFT_C52 ), 1 ) ); // Qx move64(); - s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); + s[1] = CL_add( t, CL_scale( s[1], FFT_C53 ) ); // Qx move64(); y[11] = CL_msu_j( s[0], s[1] ); @@ -5622,7 +5642,7 @@ static void fft_len30( s[0] = CL_add( y[5], y[10] ); move64(); - s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[5], y[10] ), FFT_C31 ); // Qx move64(); z[15] = CL_add( y[0], s[0] ); move64(); @@ -5636,7 +5656,7 @@ static void fft_len30( s[0] = CL_add( y[6], y[11] ); move64(); - s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[6], y[11] ), FFT_C31 ); // Qx move64(); z[21] = CL_add( y[1], s[0] ); move64(); @@ -5650,7 +5670,7 @@ static void fft_len30( s[0] = CL_add( y[7], y[12] ); move64(); - s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[7], y[12] ), FFT_C31 ); // Qx move64(); z[27] = CL_add( y[2], s[0] ); move64(); @@ -5664,7 +5684,7 @@ static void fft_len30( s[0] = CL_add( y[8], y[13] ); move64(); - s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[8], y[13] ), FFT_C31 ); // Qx move64(); z[18] = CL_add( y[3], s[0] ); move64(); @@ -5678,7 +5698,7 @@ static void fft_len30( s[0] = CL_add( y[9], y[14] ); move64(); - s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); + s[1] = CL_scale( CL_sub( y[9], y[14] ), FFT_C31 ); // Qx move64(); z[24] = CL_add( y[4], s[0] ); move64(); @@ -5844,7 +5864,8 @@ static void fft_len30( } static void fft_len32( - cmplx *x ) + cmplx *x // Qx +) { cmplx t[8], s[8], xx[8]; cmplx y[32]; @@ -5902,9 +5923,9 @@ static void fft_len32( move64(); { - s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); + s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); // Qx move64(); - s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); + s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); // Qx move64(); s[7] = CL_conjugate( s[7] ); move64(); @@ -6056,9 +6077,9 @@ static void fft_len32( move64(); { - s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); + s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); // Qx move64(); - s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); + s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); // Qx move64(); s[7] = CL_conjugate( s[7] ); move64(); @@ -6133,9 +6154,9 @@ static void fft_len32( move64(); { - s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); + s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); // Qx move64(); - s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); + s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); // Qx move64(); s[7] = CL_conjugate( s[7] ); move64(); @@ -6161,43 +6182,43 @@ static void fft_len32( { ab = y[9]; move64(); - y[9] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[0] ), CL_scale( ab, FFT_RotVector_32_fx[1] ) ); + y[9] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[0] ), CL_scale( ab, FFT_RotVector_32_fx[1] ) ); // Qx move64(); }; { ab = y[10]; move64(); - y[10] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[2] ), CL_scale( ab, FFT_RotVector_32_fx[3] ) ); + y[10] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[2] ), CL_scale( ab, FFT_RotVector_32_fx[3] ) ); // Qx move64(); }; { ab = y[11]; move64(); - y[11] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[4] ), CL_scale( ab, FFT_RotVector_32_fx[5] ) ); + y[11] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[4] ), CL_scale( ab, FFT_RotVector_32_fx[5] ) ); // Qx move64(); }; { ab = y[12]; move64(); - y[12] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[6] ), CL_scale( ab, FFT_RotVector_32_fx[7] ) ); + y[12] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[6] ), CL_scale( ab, FFT_RotVector_32_fx[7] ) ); // Qx move64(); }; { ab = y[13]; move64(); - y[13] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[8] ), CL_scale( ab, FFT_RotVector_32_fx[9] ) ); + y[13] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[8] ), CL_scale( ab, FFT_RotVector_32_fx[9] ) ); // Qx move64(); }; { ab = y[14]; move64(); - y[14] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[10] ), CL_scale( ab, FFT_RotVector_32_fx[11] ) ); + y[14] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[10] ), CL_scale( ab, FFT_RotVector_32_fx[11] ) ); // Qx move64(); }; { ab = y[15]; move64(); - y[15] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[12] ), CL_scale( ab, FFT_RotVector_32_fx[13] ) ); + y[15] = CL_mac_j( CL_scale( ab, FFT_RotVector_32_fx[12] ), CL_scale( ab, FFT_RotVector_32_fx[13] ) ); // Qx move64(); }; { @@ -6427,8 +6448,8 @@ static void fft_len32( } static void fft_lenN( - cmplx *x, - const Word16 *W, + cmplx *x, // Qx + const Word16 *W, // Q15 const Word16 len, const Word16 dim1, const Word16 dim2, @@ -6442,9 +6463,9 @@ static void fft_lenN( { FOR( j = 0; j < dim1; j++ ) { - xx[add( i_mult( i, dim1 ), j )].re = x[add( i, i_mult( j, dim2 ) )].re; + xx[( ( i * dim1 ) + j )].re = x[( i + ( j * dim2 ) )].re; // Qx move64(); - xx[add( i_mult( i, dim1 ), j )].im = x[add( i, i_mult( j, dim2 ) )].im; + xx[( ( i * dim1 ) + j )].im = x[( i + ( j * dim2 ) )].im; // Qx move64(); } } @@ -6454,56 +6475,56 @@ static void fft_lenN( case 5: FOR( i = 0; i < dim2; i++ ) { - fft_len5( &xx[i_mult( i, dim1 )] ); + fft_len5( &xx[( i * dim1 )] ); } BREAK; case 8: FOR( i = 0; i < dim2; i++ ) { - fft_len8( &xx[i_mult( i, dim1 )] ); + fft_len8( &xx[( i * dim1 )] ); } BREAK; case 10: FOR( i = 0; i < dim2; i++ ) { - fft_len10( &xx[i_mult( i, dim1 )] ); + fft_len10( &xx[( i * dim1 )] ); } BREAK; case 15: FOR( i = 0; i < dim2; i++ ) { - fft_len15( &xx[i_mult( i, dim1 )] ); + fft_len15( &xx[( i * dim1 )] ); } BREAK; case 16: FOR( i = 0; i < dim2; i++ ) { - fft_len16( &xx[i_mult( i, dim1 )] ); + fft_len16( &xx[( i * dim1 )] ); } BREAK; case 20: FOR( i = 0; i < dim2; i++ ) { - fft_len20_fx( &xx[i_mult( i, dim1 )] ); + fft_len20_fx( &xx[( i * dim1 )] ); } BREAK; case 30: FOR( i = 0; i < dim2; i++ ) { - fft_len30( &xx[i_mult( i, dim1 )] ); + fft_len30( &xx[( i * dim1 )] ); } BREAK; case 32: FOR( i = 0; i < dim2; i++ ) { - fft_len32( &xx[i_mult( i, dim1 )] ); + fft_len32( &xx[( i * dim1 )] ); } BREAK; } @@ -6532,69 +6553,69 @@ static void fft_lenN( IF( i == 0 ) { { - y[1] = xx[add( i, i_mult( 1, dim1 ) )]; + y[1] = xx[( i + ( 1 * dim1 ) )]; move64(); }; { - y[2] = xx[add( i, i_mult( 2, dim1 ) )]; + y[2] = xx[( i + ( 2 * dim1 ) )]; move64(); }; { - y[3] = xx[add( i, i_mult( 3, dim1 ) )]; + y[3] = xx[( i + ( 3 * dim1 ) )]; move64(); }; { - y[4] = xx[add( i, i_mult( 4, dim1 ) )]; + y[4] = xx[( i + ( 4 * dim1 ) )]; move64(); }; { - y[5] = xx[add( i, i_mult( 5, dim1 ) )]; + y[5] = xx[( i + ( 5 * dim1 ) )]; move64(); }; { - y[6] = xx[add( i, i_mult( 6, dim1 ) )]; + y[6] = xx[( i + ( 6 * dim1 ) )]; move64(); }; { - y[7] = xx[add( i, i_mult( 7, dim1 ) )]; + y[7] = xx[( i + ( 7 * dim1 ) )]; move64(); }; } ELSE { { - y[1] = CL_mac_j( CL_scale( xx[add( i, i_mult( 1, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 1 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 1, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 1 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[1] = CL_mac_j( CL_scale( xx[( i + ( 1 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 1 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 1 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 1 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[2] = CL_mac_j( CL_scale( xx[add( i, i_mult( 2, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 2 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 2, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 2 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[2] = CL_mac_j( CL_scale( xx[( i + ( 2 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 2 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 2 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 2 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[3] = CL_mac_j( CL_scale( xx[add( i, i_mult( 3, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 3 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 3, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 3 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[3] = CL_mac_j( CL_scale( xx[( i + ( 3 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 3 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 3 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 3 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[4] = CL_mac_j( CL_scale( xx[add( i, i_mult( 4, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 4 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 4, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 4 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[4] = CL_mac_j( CL_scale( xx[( i + ( 4 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 4 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 4 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 4 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[5] = CL_mac_j( CL_scale( xx[add( i, i_mult( 5, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 5 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 5, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 5 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[5] = CL_mac_j( CL_scale( xx[( i + ( 5 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 5 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 5 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 5 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[6] = CL_mac_j( CL_scale( xx[add( i, i_mult( 6, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 6 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 6, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 6 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[6] = CL_mac_j( CL_scale( xx[( i + ( 6 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 6 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 6 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 6 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[7] = CL_mac_j( CL_scale( xx[add( i, i_mult( 7, dim1 ) )], W[sub( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 7 ), dim1 ), 1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 7, dim1 ) )], W[sub( add( add( i_mult( sc, i ), shl( i_mult( i_mult( sc, 7 ), dim1 ), 1 ) ), 1 ), Woff )] ) ); + y[7] = CL_mac_j( CL_scale( xx[( i + ( 7 * dim1 ) )], W[( ( ( sc * i ) + ( ( ( sc * 7 ) * dim1 ) << 1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 7 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( ( sc * 7 ) * dim1 ) << 1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; } @@ -6634,28 +6655,28 @@ static void fft_lenN( t[1] = CL_sub( t[3], t[7] ); move64(); - s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); + s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); // Qx move64(); - s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); + s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); // Qx move64(); s[7] = CL_conjugate( s[7] ); move64(); x[i] = CL_add( s[0], s[1] ); /*x[add(i + i_mult(0 , dim1)] = CL_add( s[0], s[1] )*/ move64(); - x[add( i, i_mult( 1, dim1 ) )] = CL_add( s[5], s[6] ); + x[( i + ( 1 * dim1 ) )] = CL_add( s[5], s[6] ); move64(); - x[add( i, i_mult( 2, dim1 ) )] = CL_sub( s[2], s[3] ); + x[( i + ( 2 * dim1 ) )] = CL_sub( s[2], s[3] ); move64(); - x[add( i, i_mult( 3, dim1 ) )] = CL_add( s[4], s[7] ); + x[( i + ( 3 * dim1 ) )] = CL_add( s[4], s[7] ); move64(); - x[add( i, i_mult( 4, dim1 ) )] = CL_sub( s[0], s[1] ); + x[( i + ( 4 * dim1 ) )] = CL_sub( s[0], s[1] ); move64(); - x[add( i, i_mult( 5, dim1 ) )] = CL_sub( s[5], s[6] ); + x[( i + ( 5 * dim1 ) )] = CL_sub( s[5], s[6] ); move64(); - x[add( i, i_mult( 6, dim1 ) )] = CL_add( s[2], s[3] ); + x[( i + ( 6 * dim1 ) )] = CL_add( s[2], s[3] ); move64(); - x[add( i, i_mult( 7, dim1 ) )] = CL_sub( s[4], s[7] ); + x[( i + ( 7 * dim1 ) )] = CL_sub( s[4], s[7] ); move64(); } } @@ -6670,69 +6691,69 @@ static void fft_lenN( IF( i == 0 ) { { - y[1] = xx[add( i, i_mult( 1, dim1 ) )]; + y[1] = xx[( i + ( 1 * dim1 ) )]; move64(); }; { - y[2] = xx[add( i, i_mult( 2, dim1 ) )]; + y[2] = xx[( i + ( 2 * dim1 ) )]; move64(); }; { - y[3] = xx[add( i, i_mult( 3, dim1 ) )]; + y[3] = xx[( i + ( 3 * dim1 ) )]; move64(); }; { - y[4] = xx[add( i, i_mult( 4, dim1 ) )]; + y[4] = xx[( i + ( 4 * dim1 ) )]; move64(); }; { - y[5] = xx[add( i, i_mult( 5, dim1 ) )]; + y[5] = xx[( i + ( 5 * dim1 ) )]; move64(); }; { - y[6] = xx[add( i, i_mult( 6, dim1 ) )]; + y[6] = xx[( i + ( 6 * dim1 ) )]; move64(); }; { - y[7] = xx[add( i, i_mult( 7, dim1 ) )]; + y[7] = xx[( i + ( 7 * dim1 ) )]; move64(); }; } ELSE { { - y[1] = CL_mac_j( CL_scale( xx[add( i, i_mult( 1, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 1 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 1, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 1 ), dim1 ) ), 1 ), Woff )] ) ); + y[1] = CL_mac_j( CL_scale( xx[( i + ( 1 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 1 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 1 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 1 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[2] = CL_mac_j( CL_scale( xx[add( i, i_mult( 2, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 2 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 2, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 2 ), dim1 ) ), 1 ), Woff )] ) ); + y[2] = CL_mac_j( CL_scale( xx[( i + ( 2 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 2 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 2 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 2 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[3] = CL_mac_j( CL_scale( xx[add( i, i_mult( 3, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 3 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 3, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 3 ), dim1 ) ), 1 ), Woff )] ) ); + y[3] = CL_mac_j( CL_scale( xx[( i + ( 3 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 3 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 3 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 3 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[4] = CL_mac_j( CL_scale( xx[add( i, i_mult( 4, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 4 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 4, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 4 ), dim1 ) ), 1 ), Woff )] ) ); + y[4] = CL_mac_j( CL_scale( xx[( i + ( 4 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 4 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 4 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 4 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[5] = CL_mac_j( CL_scale( xx[add( i, i_mult( 5, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 5 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 5, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 5 ), dim1 ) ), 1 ), Woff )] ) ); + y[5] = CL_mac_j( CL_scale( xx[( i + ( 5 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 5 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 5 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 5 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[6] = CL_mac_j( CL_scale( xx[add( i, i_mult( 6, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 6 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 6, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 6 ), dim1 ) ), 1 ), Woff )] ) ); + y[6] = CL_mac_j( CL_scale( xx[( i + ( 6 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 6 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 6 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 6 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; { - y[7] = CL_mac_j( CL_scale( xx[add( i, i_mult( 7, dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, 7 ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( 7, dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, 7 ), dim1 ) ), 1 ), Woff )] ) ); + y[7] = CL_mac_j( CL_scale( xx[( i + ( 7 * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * 7 ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( 7 * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * 7 ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); }; } @@ -6772,28 +6793,28 @@ static void fft_lenN( t[1] = CL_sub( t[3], t[7] ); move64(); - s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); + s[6] = CL_scale( CL_add( CL_conjugate( t[0] ), t[1] ), FFT_C81 ); // Qx move64(); - s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); + s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); // Qx move64(); s[7] = CL_conjugate( s[7] ); move64(); x[i] = CL_add( s[0], s[1] ); /*x[i + 0 * dim1] = CL_add( s[0], s[1] )*/ move64(); - x[add( i, i_mult( 1, dim1 ) )] = CL_add( s[5], s[6] ); + x[( i + ( 1 * dim1 ) )] = CL_add( s[5], s[6] ); move64(); - x[add( i, i_mult( 2, dim1 ) )] = CL_sub( s[2], s[3] ); + x[( i + ( 2 * dim1 ) )] = CL_sub( s[2], s[3] ); move64(); - x[add( i, i_mult( 3, dim1 ) )] = CL_add( s[4], s[7] ); + x[( i + ( 3 * dim1 ) )] = CL_add( s[4], s[7] ); move64(); - x[add( i, i_mult( 4, dim1 ) )] = CL_sub( s[0], s[1] ); + x[( i + ( 4 * dim1 ) )] = CL_sub( s[0], s[1] ); move64(); - x[add( i, i_mult( 5, dim1 ) )] = CL_sub( s[5], s[6] ); + x[( i + ( 5 * dim1 ) )] = CL_sub( s[5], s[6] ); move64(); - x[add( i, i_mult( 6, dim1 ) )] = CL_add( s[2], s[3] ); + x[( i + ( 6 * dim1 ) )] = CL_add( s[2], s[3] ); move64(); - x[add( i, i_mult( 7, dim1 ) )] = CL_sub( s[4], s[7] ); + x[( i + ( 7 * dim1 ) )] = CL_sub( s[4], s[7] ); move64(); } } @@ -6806,14 +6827,14 @@ static void fft_lenN( FOR( j = 0; j < dim2; j++ ) { { - y[j] = xx[0 + i_mult( j, dim1 )]; /*y[j] = xx[0 + j * dim1];*/ + y[j] = xx[0 + ( j * dim1 )]; /*y[j] = xx[0 + j * dim1];*/ move64(); }; } fft_len10( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[0 + i_mult( j, dim1 )] = y[j]; + x[0 + ( j * dim1 )] = y[j]; move64(); } @@ -6827,15 +6848,15 @@ static void fft_lenN( FOR( j = 1; j < dim2; j++ ) { { - y[( j + 0 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, j ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, j ), dim1 ) ), 1 ), Woff )] ) ); + y[( j + 0 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * j ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * j ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } } fft_len10( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[add( i, i_mult( j, dim1 ) )] = y[j]; + x[( i + ( j * dim1 ) )] = y[j]; move64(); } } @@ -6848,7 +6869,7 @@ static void fft_lenN( FOR( j = 0; j < dim2; j++ ) { { - y[j] = xx[0 + i_mult( j, dim1 )]; + y[j] = xx[0 + ( j * dim1 )]; move64(); }; } @@ -6856,7 +6877,7 @@ static void fft_lenN( fft_len16( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[0 + i_mult( j, dim1 )] = y[j]; + x[0 + ( j * dim1 )] = y[j]; move64(); } @@ -6870,15 +6891,15 @@ static void fft_lenN( FOR( j = 1; j < dim2; j++ ) { { - y[( j + 0 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( i_mult( sc, j ), dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( i_mult( sc, j ), dim1 ) ), 1 ), Woff )] ) ); + y[( j + 0 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( sc * i ) + ( ( sc * j ) * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( ( sc * i ) + ( ( sc * j ) * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } } fft_len16( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[add( i, i_mult( j, dim1 ) )] = y[j]; + x[( i + ( j * dim1 ) )] = y[j]; move64(); } } @@ -6891,39 +6912,39 @@ static void fft_lenN( FOR( j = 0; j < dim2; j++ ) { { - y[j] = xx[0 + i_mult( j, dim1 )]; + y[j] = xx[0 + ( j * dim1 )]; move64(); }; } fft_len20_fx( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[0 + i_mult( j, dim1 )] = y[j]; + x[0 + ( j * dim1 )] = y[j]; move64(); } FOR( i = 1; i < dim1; i++ ) { { - y[( 0 + 0 )] = xx[add( i, ( 0 + 0 ) * dim1 )]; + y[( 0 + 0 )] = xx[( i + ( 0 + 0 ) * dim1 )]; move64(); } { - y[( 0 + 1 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( 0 + 1 ), dim1 ) )], W[sub( add( len, i_mult( sc, i ) ) + 0 * dim1, Woff )] ), - CL_scale( xx[add( i, i_mult( ( 0 + 1 ), dim1 ) )], W[sub( add( add( len, i_mult( sc, i ) ) + 0 * dim1, 1 ), Woff )] ) ); + y[( 0 + 1 )] = CL_mac_j( CL_scale( xx[( i + ( ( 0 + 1 ) * dim1 ) )], W[( ( len + ( sc * i ) ) + 0 * dim1 - Woff )] ), + CL_scale( xx[( i + ( ( 0 + 1 ) * dim1 ) )], W[( ( ( len + ( sc * i ) ) + 0 * dim1 + 1 ) - Woff )] ) ); // Qx move64(); } FOR( j = 2; j < dim2; j = j + 2 ) { { - y[( j + 0 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( j, dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( j, dim1 ) ), 1 ), Woff )] ) ); + y[( j + 0 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( sc * i ) + ( j * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( ( sc * i ) + ( j * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } { - y[( j + 1 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 1 ), dim1 ) )], W[sub( add( add( len, i_mult( sc, i ) ), i_mult( j, dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 1 ), dim1 ) )], W[sub( add( add( add( len, i_mult( sc, i ) ), i_mult( j, dim1 ) ), 1 ), Woff )] ) ); + y[( j + 1 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 1 ) * dim1 ) )], W[( ( ( len + ( sc * i ) ) + ( j * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 1 ) * dim1 ) )], W[( ( ( ( len + ( sc * i ) ) + ( j * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } } @@ -6961,28 +6982,28 @@ static void fft_lenN( move64(); } { - y[( 0 + 1 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( 0 + 1 ), dim1 ) )], W[sub( add( len, i_mult( sc, i ) ) + 0 * dim1, Woff )] ), - CL_scale( xx[add( i, i_mult( ( 0 + 1 ), dim1 ) )], W[sub( add( add( len, i_mult( sc, i ) ) + 0 * dim1, 1 ), Woff )] ) ); + y[( 0 + 1 )] = CL_mac_j( CL_scale( xx[( i + ( ( 0 + 1 ) * dim1 ) )], W[( ( len + ( sc * i ) ) + 0 * dim1 - Woff )] ), + CL_scale( xx[( i + ( ( 0 + 1 ) * dim1 ) )], W[( ( ( len + ( sc * i ) ) + 0 * dim1 + 1 ) - Woff )] ) ); // Qx move64(); } FOR( j = 2; j < dim2; j = j + 2 ) { { - y[( j + 0 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( i_mult( sc, i ), i_mult( j, dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 0 ), dim1 ) )], W[sub( add( add( i_mult( sc, i ), i_mult( j, dim1 ) ), 1 ), Woff )] ) ); + y[( j + 0 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( sc * i ) + ( j * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 0 ) * dim1 ) )], W[( ( ( ( sc * i ) + ( j * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } { - y[( j + 1 )] = CL_mac_j( CL_scale( xx[add( i, i_mult( ( j + 1 ), dim1 ) )], W[sub( add( add( len, i_mult( sc, i ) ), i_mult( j, dim1 ) ), Woff )] ), - CL_scale( xx[add( i, i_mult( ( j + 1 ), dim1 ) )], W[sub( add( add( add( len, i_mult( sc, i ) ), i_mult( j, dim1 ) ), 1 ), Woff )] ) ); + y[( j + 1 )] = CL_mac_j( CL_scale( xx[( i + ( ( j + 1 ) * dim1 ) )], W[( ( ( len + ( sc * i ) ) + ( j * dim1 ) ) - Woff )] ), + CL_scale( xx[( i + ( ( j + 1 ) * dim1 ) )], W[( ( ( ( len + ( sc * i ) ) + ( j * dim1 ) ) + 1 ) - Woff )] ) ); // Qx move64(); } } fft_len32( &y[0] ); FOR( j = 0; j < dim2; j++ ) { - x[add( i, i_mult( j, dim1 ) )] = y[j]; + x[( i + ( j * dim1 ) )] = y[j]; move64(); } } @@ -6999,8 +7020,8 @@ static void fft_lenN( *-----------------------------------------------------------------*/ void fft_fx( - Word32 *re, /* i/o: real part */ - Word32 *im, /* i/o: imag part */ + Word32 *re, /* i/o: real part Qx */ + Word32 *im, /* i/o: imag part Qx */ const Word16 length, /* i : length of fft */ const Word16 s /* i : sign */ ) @@ -7009,9 +7030,9 @@ void fft_fx( FOR( Word16 j = 0; j < length; j++ ) { - x[j].re = re[i_mult( s, j )]; + x[j].re = re[( s * j )]; move32(); - x[j].im = im[i_mult( s, j )]; + x[j].im = im[( s * j )]; move32(); } @@ -7074,9 +7095,9 @@ void fft_fx( FOR( Word16 j = 0; j < length; j++ ) { - re[i_mult( s, j )] = x[j].re; + re[( s * j )] = x[j].re; move32(); - im[i_mult( s, j )] = x[j].im; + im[( s * j )] = x[j].im; move32(); } @@ -7084,8 +7105,8 @@ void fft_fx( } void rfft_fx( - Word32 *x, /* i/o: values */ - const Word16 *w, /* i : window */ + Word32 *x, /* i/o: values Qx */ + const Word16 *w, /* i : window Q15 */ const Word16 length, /* i : length of fft */ const Word16 isign /* i : sign */ ) @@ -7099,55 +7120,55 @@ void rfft_fx( SWITCH( sizeOfFft2 ) { case 80: - s1 = 409; + s1 = 409; //(1/sizeOfFft2).Q15 move16(); s2 = -409; move16(); BREAK; case 128: - s1 = 256; + s1 = 256; //(1/sizeOfFft2).Q15 move16(); s2 = -256; move16(); BREAK; case 160: - s1 = 204; + s1 = 204; //(1/sizeOfFft2).Q15 move16(); s2 = -204; move16(); BREAK; case 240: - s1 = 136; + s1 = 136; //(1/sizeOfFft2).Q15 move16(); s2 = -136; move16(); BREAK; case 256: - s1 = 128; + s1 = 128; //(1/sizeOfFft2).Q15 move16(); s2 = -128; move16(); BREAK; case 320: - s1 = 102; + s1 = 102; //(1/sizeOfFft2).Q15 move16(); s2 = -102; move16(); BREAK; case 480: - s1 = 68; + s1 = 68; //(1/sizeOfFft2).Q15 move16(); s2 = -68; move16(); BREAK; case 640: - s1 = 51; + s1 = 51; //(1/sizeOfFft2).Q15 move16(); s2 = -51; move16(); BREAK; case 960: - s1 = 34; + s1 = 34; //(1/sizeOfFft2).Q15 move16(); s2 = -34; move16(); @@ -7167,29 +7188,29 @@ void rfft_fx( case -1: fft_fx( x, x + 1, sizeOfFft2, 2 ); - + // Qx tmp = L_add( x[0], x[1] ); - x[1] = L_sub( x[0], x[1] ); + x[1] = L_sub( x[0], x[1] ); // Qx move32(); x[0] = tmp; move32(); FOR( i = 1; i <= sizeOfFft4; i++ ) { - t1 = L_sub( x[2 * i], x[sub( length, shl( i, 1 ) )] ); - t2 = L_add( x[add( shl( i, 1 ), 1 )], x[add( sub( length, shl( i, 1 ) ), 1 )] ); - t3 = L_sub( Mpy_32_16_1( t1, w[i] ), Mpy_32_16_1( t2, w[i + sizeOfFft4] ) ); - t4 = L_add( Mpy_32_16_1( t1, w[i + sizeOfFft4] ), Mpy_32_16_1( t2, w[i] ) ); - t1 = L_add( x[2 * i], x[sub( length, shl( i, 1 ) )] ); - t2 = L_sub( x[add( shl( i, 1 ), 1 )], x[add( sub( length, shl( i, 1 ) ), 1 )] ); - - x[2 * i] = Mpy_32_16_1( L_sub( t1, t3 ), 16384 ); + t1 = L_sub( x[2 * i], x[( length - ( i << 1 ) )] ); // Qx + t2 = L_add( x[( ( i << 1 ) + 1 )], x[( ( length - ( i << 1 ) ) + 1 )] ); // Qx + t3 = L_sub( Mpy_32_16_1( t1, w[i] ), Mpy_32_16_1( t2, w[i + sizeOfFft4] ) ); // Qx + t4 = L_add( Mpy_32_16_1( t1, w[i + sizeOfFft4] ), Mpy_32_16_1( t2, w[i] ) ); // Qx + t1 = L_add( x[2 * i], x[( length - ( i << 1 ) )] ); + t2 = L_sub( x[( ( i << 1 ) + 1 )], x[( ( length - ( i << 1 ) ) + 1 )] ); + + x[2 * i] = Mpy_32_16_1( L_sub( t1, t3 ), 16384 /*0.5.Q15*/ ); move32(); - x[add( shl( i, 1 ), 1 )] = Mpy_32_16_1( L_sub( t2, t4 ), 16384 ); + x[( ( i << 1 ) + 1 )] = Mpy_32_16_1( L_sub( t2, t4 ), 16384 /*0.5.Q15*/ ); move32(); - x[sub( length, shl( i, 1 ) )] = Mpy_32_16_1( L_add( t1, t3 ), 16384 ); + x[( length - ( i << 1 ) )] = Mpy_32_16_1( L_add( t1, t3 ), 16384 /*0.5.Q15*/ ); move32(); - x[add( sub( length, shl( i, 1 ) ), 1 )] = Mpy_32_16_1( L_negate( L_add( t2, t4 ) ), 16384 ); + x[( ( length - ( i << 1 ) ) + 1 )] = Mpy_32_16_1( L_negate( L_add( t2, t4 ) ), 16384 /*0.5.Q15*/ ); move32(); } @@ -7197,28 +7218,28 @@ void rfft_fx( case +1: - tmp = Mpy_32_16_1( L_add( x[0], x[1] ), 16384 ); - x[1] = Mpy_32_16_1( L_sub( x[1], x[0] ), 16384 ); + tmp = Mpy_32_16_1( L_add( x[0], x[1] ), 16384 /*0.5.Q15*/ ); + x[1] = Mpy_32_16_1( L_sub( x[1], x[0] ), 16384 /*0.5.Q15*/ ); move32(); x[0] = tmp; move32(); FOR( i = 1; i <= sizeOfFft4; i++ ) { - t1 = L_sub( x[2 * i], x[sub( length, shl( i, 1 ) )] ); - t2 = L_add( x[add( shl( i, 1 ), 1 )], x[add( sub( length, shl( i, 1 ) ), 1 )] ); - t3 = L_add( Mpy_32_16_1( t1, w[i] ), Mpy_32_16_1( t2, w[add( i, sizeOfFft4 )] ) ); - t4 = L_sub( Mpy_32_16_1( t2, w[i] ), Mpy_32_16_1( t1, w[add( i, sizeOfFft4 )] ) ); - t1 = L_add( x[2 * i], x[sub( length, shl( i, 1 ) )] ); - t2 = L_sub( x[add( shl( i, 1 ), 1 )], x[add( sub( length, shl( i, 1 ) ), 1 )] ); - - x[2 * i] = Mpy_32_16_1( L_sub( t1, t3 ), 16384 ); + t1 = L_sub( x[2 * i], x[( length - ( i << 1 ) )] ); + t2 = L_add( x[( ( i << 1 ) + 1 )], x[( ( length - ( i << 1 ) ) + 1 )] ); + t3 = L_add( Mpy_32_16_1( t1, w[i] ), Mpy_32_16_1( t2, w[( i + sizeOfFft4 )] ) ); + t4 = L_sub( Mpy_32_16_1( t2, w[i] ), Mpy_32_16_1( t1, w[( i + sizeOfFft4 )] ) ); + t1 = L_add( x[2 * i], x[( length - ( i << 1 ) )] ); + t2 = L_sub( x[( ( i << 1 ) + 1 )], x[( ( length - ( i << 1 ) ) + 1 )] ); + + x[2 * i] = Mpy_32_16_1( L_sub( t1, t3 ), 16384 /*0.5.Q15*/ ); // Qx move32(); - x[add( shl( i, 1 ), 1 )] = Mpy_32_16_1( L_sub( t4, t2 ), 16384 ); + x[( ( i << 1 ) + 1 )] = Mpy_32_16_1( L_sub( t4, t2 ), 16384 /*0.5.Q15*/ ); // Qx move32(); - x[sub( length, shl( i, 1 ) )] = Mpy_32_16_1( L_add( t1, t3 ), 16384 ); + x[( length - ( i << 1 ) )] = Mpy_32_16_1( L_add( t1, t3 ), 16384 /*0.5.Q15*/ ); // Qx move32(); - x[add( sub( length, shl( i, 1 ) ), 1 )] = Mpy_32_16_1( L_add( t2, t4 ), 16384 ); + x[( ( length - ( i << 1 ) ) + 1 )] = Mpy_32_16_1( L_add( t2, t4 ), 16384 /*0.5.Q15*/ ); // Qx move32(); } @@ -7226,9 +7247,9 @@ void rfft_fx( FOR( i = 0; i < length; i += 2 ) { - x[i] = Mpy_32_16_1( x[i], s1 ); + x[i] = Mpy_32_16_1( x[i], s1 ); // Qx move32(); - x[i + 1] = Mpy_32_16_1( x[i + 1], s2 ); + x[i + 1] = Mpy_32_16_1( x[i + 1], s2 ); // Qx move32(); } diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index b09b41379..e2fce166c 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -15,9 +15,9 @@ #define FFT3_ONE_THIRD 21845 /* 1/3 in Q16 */ /* DCT related */ -#define KP559016994_16FX 1200479845 /* EDCT & EMDCT constants */ -#define KP951056516_16FX 2042378325 /* EDCT & EMDCT constants */ -#define KP587785252_16FX 1262259213 /* EDCT & EMDCT constants */ +#define KP559016994_16FX 1200479845 /* EDCT & EMDCT constants Q31*/ +#define KP951056516_16FX 2042378325 /* EDCT & EMDCT constants Q31*/ +#define KP587785252_16FX 1262259213 /* EDCT & EMDCT constants Q31*/ static void fft5_shift4_16fx( Word16 n1, Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void fft64_16fx( Word16 *x, Word16 *y, const Word16 *Idx ); @@ -45,8 +45,8 @@ static void cftmdl_fx( Word16 n, Word16 l, Word32 *a, const Word16 *w ); void DoRTFTn_fx( - Word32 *x, /* i/o : real part of input and output data */ - Word32 *y, /* i/o : imaginary part of input and output data */ + Word32 *x, /* i/o : real part of input and output data Q(x) */ + Word32 *y, /* i/o : imaginary part of input and output data Q(x) */ const Word16 n /* i : size of the FFT up to 1024 */ ) { @@ -145,7 +145,7 @@ static void bitrv2_SR_fx( m = 1; move16(); - WHILE( LT_16( shl( m, 3 ), l ) ) + WHILE( ( ( m << 3 ) < l ) ) { l = shr( l, 1 ); m = shl( m, 1 ); @@ -324,7 +324,7 @@ static void cftfsub_fx( cft1st_fx( n, a, w ); l = 8; move16(); - WHILE( ( shl( l, 2 ) < n ) ) + WHILE( ( ( l << 2 ) < n ) ) { cftmdl_fx( n, l, a, w ); l = shl( l, 2 ); @@ -695,7 +695,7 @@ static void cftmdl_fx( wk3i = extract_l( L_msu0( L_shr( L_mult( wk2r, wk1r ), 14 ), wk1i, 1 ) ); tmp = add( l, add( k, m ) ); - FOR( j = add( k, m ); j < tmp; j += 2 ) + FOR( j = k + m; j < tmp; j += 2 ) { j1 = add( j, l ); j2 = add( j1, l ); @@ -739,8 +739,8 @@ static void cftmdl_fx( static void cftbsub_fx( Word16 n, - Word32 *a, - const Word16 *w /* i : cos/sin table */ + Word32 *a, // Q(Qx+Q_edct) + const Word16 *w /* i : cos/sin table Q14 */ ) { Word16 j, j1, j2, j3, l; @@ -748,13 +748,13 @@ static void cftbsub_fx( l = 2; move16(); - IF( n > 8 ) + IF( GT_16( n, 8 ) ) { cft1st_fx( n, a, w ); l = 8; move16(); - WHILE( LT_16( shl( l, 2 ), n ) ) + WHILE( ( ( l << 2 ) < n ) ) { cftmdl_fx( n, l, a, w ); l = shl( l, 2 ); @@ -815,9 +815,9 @@ static void cftbsub_fx( static void rftfsub_fx( Word16 n, - Word32 *a, + Word32 *a, // Qx Word16 nc, - const Word16 *c ) + const Word16 *c /*Q14*/ ) { Word16 j, k, kk, ks, m, tmp; Word32 xr, xi, yr, yi; @@ -828,7 +828,7 @@ static void rftfsub_fx( tmp = shl( nc, 1 ); ks = 0; move16(); - WHILE( GE_16( tmp, m ) ) + WHILE( ( tmp >= m ) ) { ks = add( ks, 1 ); tmp = sub( tmp, m ); @@ -839,13 +839,13 @@ static void rftfsub_fx( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( 8192, c[sub( nc, kk )] ); - wki = c[kk]; + wkr = sub( 8192 /*0.5.Q14*/, c[( nc - kk )] ); // Q14 + wki = c[kk]; // Q14 move16(); - xr = L_sub( a[j], a[k] ); - xi = L_add( a[j + 1], a[k + 1] ); - yr = L_sub( Mult_32_16( L_shl( xr, 1 ), wkr ), Mult_32_16( L_shl( xi, 1 ), wki ) ); - yi = L_add( Mult_32_16( L_shl( xi, 1 ), wkr ), Mult_32_16( L_shl( xr, 1 ), wki ) ); + xr = L_sub( a[j], a[k] ); // Qx + xi = L_add( a[j + 1], a[k + 1] ); // Qx + yr = L_sub( Mult_32_16( L_shl( xr, 1 ), wkr ), Mult_32_16( L_shl( xi, 1 ), wki ) ); // Qx + yi = L_add( Mult_32_16( L_shl( xi, 1 ), wkr ), Mult_32_16( L_shl( xr, 1 ), wki ) ); // Qx a[j] = L_sub( a[j], yr ); move32(); a[j + 1] = L_sub( a[j + 1], yi ); @@ -860,9 +860,9 @@ static void rftfsub_fx( static void rftbsub_fx( Word16 n, - Word32 *a, + Word32 *a, // Qx Word16 nc, - const Word16 *c ) + const Word16 *c /*Q14*/ ) { Word16 j, k, kk, ks, m, tmp; Word32 xr, xi, yr, yi; @@ -874,7 +874,7 @@ static void rftbsub_fx( tmp = shl( nc, 1 ); ks = 0; move16(); - WHILE( GE_16( tmp, m ) ) + WHILE( ( tmp >= m ) ) { ks = add( ks, 1 ); tmp = sub( tmp, m ); @@ -885,13 +885,13 @@ static void rftbsub_fx( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( 8192, c[sub( nc, kk )] ); - wki = c[kk]; + wkr = sub( 8192 /*0.5.Q14*/, c[( nc - kk )] ); // Q14 + wki = c[kk]; // Q14 move16(); - xr = L_sub( a[j], a[k] ); - xi = L_add( a[j + 1], a[k + 1] ); - yr = L_add( Mult_32_16( L_shl( xr, 1 ), wkr ), Mult_32_16( L_shl( xi, 1 ), wki ) ); - yi = L_sub( Mult_32_16( L_shl( xi, 1 ), wkr ), Mult_32_16( L_shl( xr, 1 ), wki ) ); + xr = L_sub( a[j], a[k] ); // Qx + xi = L_add( a[j + 1], a[k + 1] ); // Qx + yr = L_add( Mult_32_16( L_shl( xr, 1 ), wkr ), Mult_32_16( L_shl( xi, 1 ), wki ) ); // Qx + yi = L_sub( Mult_32_16( L_shl( xi, 1 ), wkr ), Mult_32_16( L_shl( xr, 1 ), wki ) ); // Qx a[j] = L_sub( a[j], yr ); move32(); a[j + 1] = L_sub( yi, a[j + 1] ); @@ -908,9 +908,9 @@ static void rftbsub_fx( static void dctsub_fx( Word16 n, - Word32 *a, + Word32 *a, // Qx Word16 nc, - const Word16 *c ) + const Word16 *c /*Q14*/ ) { Word16 j, k, kk, ks, m, tmp; Word16 wkr, wki; @@ -922,7 +922,7 @@ static void dctsub_fx( move16(); ks = 0; move16(); - WHILE( GE_16( tmp, n ) ) + WHILE( ( tmp >= n ) ) { ks = add( ks, 1 ); tmp = sub( tmp, n ); @@ -933,15 +933,15 @@ static void dctsub_fx( { k = sub( n, j ); kk = add( kk, ks ); - wkr = sub( c[kk], c[sub( nc, kk )] ); - wki = add( c[kk], c[sub( nc, kk )] ); - xr = L_sub( Mult_32_16( L_shl( a[j], 1 ), wki ), Mult_32_16( L_shl( a[k], 1 ), wkr ) ); - a[j] = L_add( Mult_32_16( L_shl( a[j], 1 ), wkr ), Mult_32_16( L_shl( a[k], 1 ), wki ) ); + wkr = sub( c[kk], c[( nc - kk )] ); // Q14 + wki = add( c[kk], c[( nc - kk )] ); // Q14 + xr = L_sub( Mult_32_16( L_shl( a[j], 1 ), wki ), Mult_32_16( L_shl( a[k], 1 ), wkr ) ); // Qx + a[j] = L_add( Mult_32_16( L_shl( a[j], 1 ), wkr ), Mult_32_16( L_shl( a[k], 1 ), wki ) ); // Qx move32(); a[k] = xr; move32(); } - a[m] = Mult_32_16( L_shl( a[m], 1 ), c[0] ); + a[m] = Mult_32_16( L_shl( a[m], 1 ), c[0] ); // Qx move16(); } @@ -955,11 +955,11 @@ static void dctsub_fx( void edct2_fx( Word16 n, Word16 isgn, - Word16 *in, - Word32 *a, + Word16 *in, // Q(q) + Word32 *a, // Qx Word16 *q, const Word16 *ip, - const Word16 *w ) + const Word16 *w /*Q14*/ ) { Word16 j, nw, nc; Word32 xr; @@ -983,7 +983,7 @@ void edct2_fx( nc = ip[1]; move16(); - if ( n > nc ) + if ( GT_16( n, nc ) ) { nc = n; move16(); @@ -1005,13 +1005,13 @@ void edct2_fx( a[0] = L_add( a[0], xr ); move32(); - IF( n > 4 ) + IF( GT_16( n, 4 ) ) { rftbsub_fx( n, a, nc, w + nw ); bitrv2_SR_fx( n, ip + 2, a ); cftbsub_fx( n, a, w ); } - ELSE IF( n == 4 ) + ELSE IF( EQ_16( n, 4 ) ) { cftfsub_fx( n, a, w ); } @@ -1027,13 +1027,13 @@ void edct2_fx( IF( isgn >= 0 ) { - IF( n > 4 ) + IF( GT_16( n, 4 ) ) { bitrv2_SR_fx( n, ip + 2, a ); cftfsub_fx( n, a, w ); rftfsub_fx( n, a, nc, w + nw ); } - ELSE IF( n == 4 ) + ELSE IF( EQ_16( n, 4 ) ) { cftfsub_fx( n, a, w ); } @@ -1052,7 +1052,7 @@ void edct2_fx( FOR( j = 0; j < n; j++ ) { - a[j] = L_shr( a[j], 5 ); + a[j] = L_shr( a[j], 5 ); // a[j] / 32.0f move32(); } } @@ -1066,9 +1066,9 @@ void edct2_fx( static void fft5_shift4_16fx( Word16 n1, /* i : length of data */ - Word16 *zRe, /* i/o : real part of input and output data */ - Word16 *zIm, /* i/o : imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 *zRe, /* i/o : real part of input and output data Q(Qx+Q_edct) */ + Word16 *zIm, /* i/o : imaginary part of input and output data Q(Qx+Q_edct) */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; @@ -1087,9 +1087,9 @@ static void fft5_shift4_16fx( i4 = Idx[n1 * 4]; move16(); - T1 = zRe[i0]; + T1 = zRe[i0]; // Qx move16(); - To = zIm[i0]; + To = zIm[i0]; // Qx move16(); T2 = zRe[i1]; @@ -1116,8 +1116,8 @@ static void fft5_shift4_16fx( #endif /* T9 = KP559016994 * (T4 - T7); */ #ifdef BASOP_NOGLOB - L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); - T9 = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) + T9 = round_fx_sat( L_tmp ); // Qx Ts = sub_sat( T2, T3 ); #else L_tmp = Mult_32_16( KP559016994_16FX, sub( T4, T7 ) ); @@ -1148,8 +1148,8 @@ static void fft5_shift4_16fx( #ifdef BASOP_NOGLOB /* Tn = KP559016994 * (T4 - T7); */ - L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); - Tn = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) + Tn = round_fx_sat( L_tmp ); // Qx zRe[i0] = add_sat( T1, T8 ); move16(); zIm[i0] = add_sat( To, Tp ); @@ -1164,18 +1164,18 @@ static void fft5_shift4_16fx( move16(); /* T2 = KP951056516*Te + KP587785252*Th; */ - L_tmp = Mult_32_16( KP951056516_16FX, Te ); - L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Th ); + L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) + L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Th ); // Q(16 +x) #ifdef BASOP_NOGLOB - T2 = round_fx_sat( L_tmp ); + T2 = round_fx_sat( L_tmp ); // Qx #else T2 = round_fx( L_tmp ); #endif /*T3 = KP951056516*Th - KP587785252*Te; */ - L_tmp = Mult_32_16( KP951056516_16FX, Th ); - L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Te ); + L_tmp = Mult_32_16( KP951056516_16FX, Th ); // Q(16 +x) + L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Te ); // Q(16 +x) #ifdef BASOP_NOGLOB - T3 = round_fx_sat( L_tmp ); + T3 = round_fx_sat( L_tmp ); // Qx #else T3 = round_fx( L_tmp ); #endif @@ -1206,23 +1206,23 @@ static void fft5_shift4_16fx( #endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ - L_tmp = Mult_32_16( KP951056516_16FX, Ts ); - L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Tt ); + L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) + L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Tt ); // Q(16 +x) #ifdef BASOP_NOGLOB - T2 = round_fx_sat( L_tmp ); + T2 = round_fx_sat( L_tmp ); // Qx #else T2 = round_fx( L_tmp ); #endif /* T3 = KP951056516 * Tt - KP587785252 * Ts; */ - L_tmp = Mult_32_16( KP951056516_16FX, Tt ); - L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Ts ); + L_tmp = Mult_32_16( KP951056516_16FX, Tt ); // Q(16 +x) + L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Ts ); // Q(16 +x) #ifdef BASOP_NOGLOB - T3 = round_fx_sat( L_tmp ); + T3 = round_fx_sat( L_tmp ); // Qx #else T3 = round_fx( L_tmp ); #endif #ifdef BASOP_NOGLOB - T6 = sub_sat( To, shr( Tp, 2 ) ); + T6 = sub_sat( To, shr( Tp, 2 ) ); // To - (Tp / 4) T4 = add_sat( Tn, T6 ); T5 = sub_sat( T6, Tn ); zIm[i4] = sub_sat( T4, T2 ); @@ -1254,9 +1254,9 @@ static void fft5_shift4_16fx( * 5-point FFT called for 32 times *-----------------------------------------------------------------*/ static void fft5_32_16fx( - Word16 *zRe, /* i/o : real part of input and output data */ - Word16 *zIm, /* i/o : imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 *zRe, /* i/o : real part of input and output data Qx */ + Word16 *zIm, /* i/o : imaginary part of input and output data Qx */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7; @@ -1277,14 +1277,14 @@ static void fft5_32_16fx( i4 = Idx[128]; move16(); - T1 = zRe[i0]; + T1 = zRe[i0]; // Qx move16(); - To = zIm[i0]; + To = zIm[i0]; // Qx move16(); - T2 = zRe[i1]; + T2 = zRe[i1]; // Qx move16(); - T3 = zRe[i4]; + T3 = zRe[i4]; // Qx move16(); #ifdef BASOP_NOGLOB @@ -1308,8 +1308,8 @@ static void fft5_32_16fx( #endif #ifdef BASOP_NOGLOB /* T9 = KP559016994 * (T4 - T7); */ - L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); - T9 = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) + T9 = round_fx_sat( L_tmp ); // Qx Ts = sub_sat( T2, T3 ); T2 = zIm[i1]; @@ -1325,8 +1325,8 @@ static void fft5_32_16fx( Te = sub_sat( T2, T3 ); Tp = add_sat( T4, T7 ); Th = sub_sat( T5, T6 ); - L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); - Tn = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x) + Tn = round_fx_sat( L_tmp ); // Qx #else /* T9 = KP559016994 * (T4 - T7); */ L_tmp = Mult_32_16( KP559016994_16FX, sub( T4, T7 ) ); @@ -1365,14 +1365,14 @@ static void fft5_32_16fx( #ifdef BASOP_NOGLOB /*T2 = KP951056516*Te + KP587785252*Th; */ - L_tmp = Mult_32_16( KP951056516_16FX, Te ); - L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Th ); - T2 = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x) + L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Th ); // Q(16 +x) + T2 = round_fx_sat( L_tmp ); // Qx /*T3 = KP951056516*Th - KP587785252*Te; */ - L_tmp = Mult_32_16( KP951056516_16FX, Th ); - L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Te ); - T3 = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP951056516_16FX, Th ); // Q(16 +x) + L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Te ); // Q(16 +x) + T3 = round_fx_sat( L_tmp ); // Qx T6 = sub_sat( T1, shr( T8, 2 ) ); @@ -1414,16 +1414,16 @@ static void fft5_32_16fx( #endif /* T2 = KP951056516 * Ts + KP587785252 * Tt; */ - L_tmp = Mult_32_16( KP951056516_16FX, Ts ); - L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Tt ); - T2 = round_fx_sat( L_tmp ); + L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x) + L_tmp = Madd_32_16( L_tmp, KP587785252_16FX, Tt ); // Q(16 +x) + T2 = round_fx_sat( L_tmp ); // Qx /* T3 = KP951056516 * Tt - KP587785252 * Ts; */ - L_tmp = Mult_32_16( KP951056516_16FX, Tt ); - L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Ts ); + L_tmp = Mult_32_16( KP951056516_16FX, Tt ); // Q(16 +x) + L_tmp = Msub_32_16( L_tmp, KP587785252_16FX, Ts ); // Q(16 +x) #ifdef BASOP_NOGLOB - T3 = round_fx_sat( L_tmp ); + T3 = round_fx_sat( L_tmp ); // Qx T6 = sub_sat( To, shr( Tp, 2 ) ); T4 = add_sat( Tn, T6 ); @@ -1460,9 +1460,9 @@ static void fft5_32_16fx( * 64-point FFT *-----------------------------------------------------------------*/ static void fft64_16fx( - Word16 *x, /* i/o : real part of input and output data */ - Word16 *y, /* i/o : imaginary part of input and output data */ - const Word16 *Idx /* i : pointer of the address table */ + Word16 *x, /* i/o : real part of input and output data Q(Qx+Q_edct) */ + Word16 *y, /* i/o : imaginary part of input and output data Q(Qx+Q_edct) */ + const Word16 *Idx /* i : pointer of the address table Q0 */ ) { Word16 i, id, jd; @@ -1502,8 +1502,8 @@ static void fft64_16fx( * 32-point FFT called for 5 times *-----------------------------------------------------------------*/ static void fft32_5_16fx( - Word16 *x, /* i/o : real part of input and output data */ - Word16 *y, /* i/o : imaginary part of input and output data */ + Word16 *x, /* i/o : real part of input and output data Q(Qx+Q_edct) */ + Word16 *y, /* i/o : imaginary part of input and output data Q(Qx+Q_edct) */ const Word16 *Idx /* i : pointer of the address table */ ) { @@ -1543,8 +1543,8 @@ static void fft32_5_16fx( * a low complexity 2-dimensional DFT of 160 points *-----------------------------------------------------------------*/ void DoRTFT160_16fx( - Word16 x[], /* i/o : real part of input and output data */ - Word16 y[] /* i/o : imaginary part of input and output data */ + Word16 x[], /* i/o : real part of input and output data Q(Qx+Q_edct) */ + Word16 y[] /* i/o : imaginary part of input and output data Q(Qx+Q_edct) */ ) { Word16 j; @@ -1569,8 +1569,8 @@ void DoRTFT160_16fx( * a low complexity 2-dimensional DFT of 320 points *-----------------------------------------------------------------*/ void DoRTFT320_16fx( - Word16 *x, /* i/o : real part of input and output data */ - Word16 *y /* i/o : imaginary part of input and output data */ + Word16 *x, /* i/o : real part of input and output data Q(Qx+Q_edct) */ + Word16 *y /* i/o : imaginary part of input and output data Q(Qx+Q_edct) */ ) { Word16 j; @@ -1664,7 +1664,7 @@ static void bitrv2_SR_16fx( m = 1; move16(); - WHILE( LT_16( shl( m, 3 ), l ) ) + WHILE( ( ( m << 3 ) < l ) ) { l = shr( l, 1 ); m = shl( m, 1 ); @@ -1846,7 +1846,7 @@ static void cftfsub_16fx( cft1st_16fx( n, a, w ); l = 8; move16(); - WHILE( LT_16( shl( l, 2 ), n ) ) + WHILE( ( ( l << 2 ) < n ) ) { cftmdl_16fx( n, l, a, w ); l = shl( l, 2 ); @@ -2756,13 +2756,13 @@ static void cftmdl_16fx( return; } -void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) +void fft3_fx( const Word16 X[] /*Qx*/, Word16 Y[] /*Qx*/, const Word16 n ) { Word16 Z[PH_ECU_SPEC_SIZE]; Word16 *Z0, *Z1, *Z2; Word16 *z0, *z1, *z2; const Word16 *x; - const Word16 *t_sin = sincos_t_rad3_fx; + const Word16 *t_sin = sincos_t_rad3_fx; // Q15 Word16 m, mMinus1, step; Word16 i, l; Word16 c1_ind, s1_ind, c2_ind, s2_ind; @@ -2813,14 +2813,14 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) z1 = &Z1[0]; /* Z1 = &Z[ m]; */ Z2 = &Z1[m]; z2 = &Z2[0]; /* Z2 = &Z[2m]; */ - x = &X[0]; + x = &X[0]; // Qx FOR( i = 0; i < m; i++ ) { - *z0++ = *x++; /* Z0[i] = X[3i]; */ + *z0++ = *x++; /* Z0[i] = X[3i]; Qx */ move16(); - *z1++ = *x++; /* Z1[i] = X[3i+1]; */ + *z1++ = *x++; /* Z1[i] = X[3i+1]; Qx */ move16(); - *z2++ = *x++; /* Z2[i] = X[3i+2]; */ + *z2++ = *x++; /* Z2[i] = X[3i+2]; Qx */ move16(); } mBy2 = shr( m, 1 ); @@ -2831,15 +2831,15 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) /* Butterflies of order 3. */ /* pointer initialization */ mMinus1 = sub( m, 1 ); - RY = &Y[0]; - IY = &Y[n]; - IY--; /* Decrement the address counter.*/ - RZ0 = &Z0[0]; + RY = &Y[0]; // Qx + IY = &Y[n]; // Qx + IY--; /* Decrement the address counter.*/ + RZ0 = &Z0[0]; // Qx IZ0 = &Z0[mMinus1]; - RZ1 = &Z1[0]; - IZ1 = &Z1[mMinus1]; - RZ2 = &Z2[0]; - IZ2 = &Z2[mMinus1]; + RZ1 = &Z1[0]; // Qx + IZ1 = &Z1[mMinus1]; // Qx + RZ2 = &Z2[0]; // Qx + IZ2 = &Z2[mMinus1]; // Qx c1_step = negate( step ); s1_step = step; @@ -2854,10 +2854,10 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) move16(); /* special case: i = 0 */ - acc = L_mult( *RZ0++, 0x4000 ); - acc = L_mac( acc, *RZ1++, 0x4000 ); + acc = L_mult( *RZ0++, 0x4000 /*1.Q14*/ ); // Q15 + Qx + acc = L_mac( acc, *RZ1++, 0x4000 /*1.Q14*/ ); // Q15 + Qx #ifdef BASOP_NOGLOB - *RY++ = mac_r_sat( acc, *RZ2++, 0x4000 ); + *RY++ = mac_r_sat( acc, *RZ2++, 0x4000 /*1.Q14*/ ); // Qx #else *RY++ = mac_r( acc, *RZ2++, 0x4000 ); #endif @@ -2867,20 +2867,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = sub( shr( n, 3 ), 1 ); /* (3*m/8) - 1 = (n/8) - 1 */ FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0++, 15 ); /* Align with the following non-fractional mode so as to gain 1 more bit headroom. */ - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); /* bit growth = 1 (compensated by non-fractional mode MAC). */ + acc = L_shl( *RZ0++, 15 ); /* Align with the following non-fractional mode so as to gain 1 more bit headroom. Q15 + Qx*/ + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); /* bit growth = 1 (compensated by non-fractional mode MAC). Qx - 1*/ move16(); - acc = L_shl( *IZ0--, 15 ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2++, t_sin[s2_ind] ); - acc = L_mac0( acc, *IZ2--, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_shl( *IZ0--, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2++, t_sin[s2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2--, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = add( c1_ind, c1_step ); @@ -2893,20 +2893,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = shr( m, 3 ); /* (4*m/8) - (3*m/8) = m/8 */ FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0++, 15 ); - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0++, 15 ); // Q15 + Qx + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_shl( *IZ0--, 15 ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2++, t_sin[s2_ind] ); - acc = L_msu0( acc, *IZ2--, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_shl( *IZ0--, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2++, t_sin[s2_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ2--, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = add( c1_ind, c1_step ); @@ -2916,17 +2916,17 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) } /* special case: i = m/2 i.e. 1/3 */ - acc = L_shl( *RZ0--, 15 ); - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0--, 15 ); // Q15 + Qx + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); acc = 0; move32(); - acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - *IY-- = round_fx( acc ); + acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); IZ0++; IZ1++; @@ -2941,20 +2941,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = sub( shr( m, 2 ), 1 ); /* (6*m/8) - ((m/2)+1) = m/4 - 1 */ FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0--, 15 ); - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0--, 15 ); // Q15 + Qx + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0++, -32768 ); - acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ1++, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_mult0( *IZ0++, -32768 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ1++, t_sin[c1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = add( c1_ind, c1_step ); @@ -2968,20 +2968,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = shr( m, 2 ); FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0--, 15 ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0--, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0++, -32768 ); - acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ1++, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_mult0( *IZ0++, -32768 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1--, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ1++, t_sin[c1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = sub( c1_ind, c1_step ); @@ -2991,16 +2991,16 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) } /* special case: i = m, i.e 2/3 */ - acc = L_shl( *RZ0++, 15 ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0++, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); acc = L_deposit_l( 0 ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); - *IY-- = round_fx( acc ); + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); IZ0--; /* Just decrement the address counter */ IZ1--; @@ -3015,20 +3015,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = sub( shr( m, 3 ), 1 ); /* (9*m/8) - (m +1) = m/8 - 1 */ FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0++, 15 ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0++, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_shl( *IZ0--, 15 ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); - acc = L_msu0( acc, *IZ2--, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_shl( *IZ0--, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ2--, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = sub( c1_ind, c1_step ); @@ -3041,20 +3041,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) l = shr( n, 3 ); /* (12*m/8) - (9*m/8) = 3*m/8 = n/8 */ FOR( i = 0; i < l; i++ ) { - acc = L_shl( *RZ0++, 15 ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. */ - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY++ = round_fx( acc ); + acc = L_shl( *RZ0++, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); /* Non-fractional mode gains 1 more bit headroom. Q15 + Qx*/ + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Q15 + Qx + *RY++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_shl( *IZ0--, 15 ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); - acc = L_mac0( acc, *IZ2--, t_sin[c2_ind] ); - *IY-- = round_fx( acc ); + acc = L_shl( *IZ0--, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Q15 + Qx + acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2++, t_sin[s2_ind] ); // Q15 + Qx + acc = L_mac0( acc, *IZ2--, t_sin[c2_ind] ); // Q15 + Qx + *IY-- = round_fx( acc ); // Qx - 1 move16(); c1_ind = sub( c1_ind, c1_step ); @@ -3064,20 +3064,20 @@ void fft3_fx( const Word16 X[], Word16 Y[], const Word16 n ) } /* special case: i = 3*m/2 */ - acc = L_shl( *RZ0, 15 ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); - *RY = round_fx( acc ); + acc = L_shl( *RZ0, 15 ); // Q15 + Qx + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Q15 + Qx + acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); // Q15 + Qx + *RY = round_fx( acc ); // Qx - 1 move16(); return; } -void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) +void ifft3_fx( const Word16 Z[] /*Qx*/, Word16 X[] /*Qx*/, const Word16 n ) { Word16 Y[PH_ECU_SPEC_SIZE]; - const Word16 *t_sin = sincos_t_rad3_fx; + const Word16 *t_sin = sincos_t_rad3_fx; // Q15 Word16 m, mMinus1, step, step2; Word16 i, l; Word16 c0_ind, s0_ind, c1_ind, s1_ind, c2_ind, s2_ind; @@ -3124,19 +3124,19 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) nMinusMBy2 = shr( sub( n, m ), 1 ); mMinus1 = sub( m, 1 ); /* pointer initialization */ - RY0 = &Y[0]; - IY0 = &Y[m]; - RY1 = &RY0[m]; - IY1 = &RY1[mMinus1]; - RY2 = &RY1[m]; - IY2 = &RY2[mMinus1]; - - RZ00 = &Z[0]; /* The zero positions of the pointers */ - RZ10 = &RZ00[m]; - RZ20 = &RZ00[nMinusMBy2]; - IZ00 = &Z[n]; - IZ10 = &IZ00[-m]; - IZ20 = &IZ00[-nMinusMBy2]; + RY0 = &Y[0]; // Qx + IY0 = &Y[m]; // Qx + RY1 = &RY0[m]; // Qx + IY1 = &RY1[mMinus1]; // Qx + RY2 = &RY1[m]; // Qx + IY2 = &RY2[mMinus1]; // Qx + + RZ00 = &Z[0]; /* The zero positions of the pointers Qx*/ + RZ10 = &RZ00[m]; // Qx + RZ20 = &RZ00[nMinusMBy2]; // Qx + IZ00 = &Z[n]; // Qx + IZ10 = &IZ00[-m]; // Qx + IZ20 = &IZ00[-nMinusMBy2]; // Qx RZ0 = RZ00; /* Reset the pointers to zero positions. */ RZ1 = RZ10; @@ -3148,9 +3148,9 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) /* Inverse butterflies of order 3. */ /* Construction of Y0 */ - acc = L_mult( *RZ0++, 0x4000 ); - acc = L_mac( acc, *RZ1++, 0x4000 ); - *RY0++ = mac_r( acc, *RZ2--, 0x4000 ); + acc = L_mult( *RZ0++, 0x4000 /*1.Q14*/ ); // Qx + Q15 + acc = L_mac( acc, *RZ1++, 0x4000 /*1.Q14*/ ); // Qx + Q15 + *RY0++ = mac_r( acc, *RZ2--, 0x4000 /*1.Q14*/ ); // Qx move16(); IZ0--; IZ1--; @@ -3160,21 +3160,21 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = sub( shr( m, 1 ), 1 ); FOR( i = 0; i < l; i++ ) { - acc = L_mult( *RZ0++, 0x4000 ); - acc = L_mac( acc, *RZ1++, 0x4000 ); - *RY0++ = mac_r( acc, *RZ2--, 0x4000 ); + acc = L_mult( *RZ0++, 0x4000 /*1.Q14*/ ); // Qx + Q15 + acc = L_mac( acc, *RZ1++, 0x4000 /*1.Q14*/ ); // Qx + Q15 + *RY0++ = mac_r( acc, *RZ2--, 0x4000 /*1.Q14*/ ); // Qx move16(); - acc = L_mult( *IZ0--, 0x4000 ); - acc = L_mac( acc, *IZ1--, 0x4000 ); - *IY0-- = msu_r( acc, *IZ2++, 0x4000 ); + acc = L_mult( *IZ0--, 0x4000 /*1.Q14*/ ); // Qx + Q15 + acc = L_mac( acc, *IZ1--, 0x4000 /*1.Q14*/ ); // Qx + Q15 + *IY0-- = msu_r( acc, *IZ2++, 0x4000 /*1.Q14*/ ); // Qx move16(); } /* m/2 */ - acc = L_mult( *RZ0, 0x4000 ); - acc = L_mac( acc, *RZ1, 0x4000 ); - *RY0++ = mac_r( acc, *RZ2, 0x4000 ); + acc = L_mult( *RZ0, 0x4000 /*1.Q14*/ ); // Qx + Q15 + acc = L_mac( acc, *RZ1, 0x4000 /*1.Q14*/ ); // Qx + Q15 + *RY0++ = mac_r( acc, *RZ2, 0x4000 /*1.Q14*/ ); // Qx move16(); @@ -3192,13 +3192,13 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) IZ0 = IZ00; IZ1 = IZ10; IZ2 = IZ20; - acc = L_mult0( *RZ0++, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[c2_ind] ); + acc = L_mult0( *RZ0++, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[c2_ind] ); // Qx + Q15 IZ0--; - acc = L_msu0( acc, *IZ1--, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2++, t_sin[s2_ind] ); - *RY1++ = round_fx( acc ); + acc = L_msu0( acc, *IZ1--, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2++, t_sin[s2_ind] ); // Qx + Q15 + *RY1++ = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step ); @@ -3212,22 +3212,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = sub( shr( m, 2 ), 1 ); FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY1++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY1++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0--, t_sin[c0_ind] ); - acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_mac0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - *IY1-- = round_fx( acc ); + acc = L_mult0( *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY1-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step ); @@ -3242,22 +3242,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = shr( m, 2 ); /* m/2 - m/4 = m/4 */ FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY1++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY1++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0--, t_sin[c0_ind] ); - acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_msu0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_mac0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - *IY1-- = round_fx( acc ); + acc = L_mult0( *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY1-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step ); @@ -3269,13 +3269,13 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) } /* m/2 */ - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY1++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY1++ = round_fx( acc ); // Qx - 1 move16(); /* Construction of Y2 */ @@ -3293,13 +3293,13 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) IZ0 = IZ00; IZ1 = IZ10; IZ2 = IZ20; - acc = L_mult0( *RZ0++, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[c2_ind] ); + acc = L_mult0( *RZ0++, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[c2_ind] ); // Qx + Q15 IZ0--; - acc = L_mac0( acc, *IZ1--, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mac0( acc, *IZ1--, t_sin[s1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step2 ); @@ -3313,22 +3313,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = sub( shr( m, 3 ), 1 ); /* m/8 - 1. */ FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0--, t_sin[c0_ind] ); - acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); - *IY2-- = round_fx( acc ); + acc = L_mult0( *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY2-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step2 ); @@ -3343,22 +3343,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = shr( m, 3 ); /* m/4 - m/8 = m/8 */ FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0--, t_sin[c0_ind] ); - acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); - *IY2-- = round_fx( acc ); + acc = L_mult0( *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY2-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step2 ); @@ -3373,22 +3373,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = shr( m, 3 ); /* 3*m/8 - m/4 = m/8 */ FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ0, t_sin[c0_ind] ); - acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mult0( *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ0--, t_sin[c0_ind] ); - acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - *IY2-- = round_fx( acc ); + acc = L_mult0( *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY2-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = sub( c0_ind, step2 ); @@ -3403,22 +3403,22 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) l = shr( m, 3 ); /* m/2 - 3*m/8 = m/8 */ FOR( i = 0; i < l; i++ ) { - acc = L_mult0( *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mult0( *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); - acc = L_mult0( *IZ1--, t_sin[c1_ind] ); - acc = L_msu0( acc, *IZ0--, t_sin[c0_ind] ); - acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); - acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); - acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); - acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); - *IY2-- = round_fx( acc ); + acc = L_mult0( *IZ1--, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0--, t_sin[c0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ2++, t_sin[c2_ind] ); // Qx + Q15 + acc = L_mac0( acc, *RZ0++, t_sin[s0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ1++, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2--, t_sin[s2_ind] ); // Qx + Q15 + *IY2-- = round_fx( acc ); // Qx - 1 move16(); c0_ind = add( c0_ind, step2 ); @@ -3430,13 +3430,13 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) } /* m/2 */ - acc = L_mult0( *RZ1, t_sin[c1_ind] ); - acc = L_msu0( acc, *RZ0, t_sin[c0_ind] ); - acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); - acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); - acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); - acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); - *RY2++ = round_fx( acc ); + acc = L_mult0( *RZ1, t_sin[c1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ0, t_sin[c0_ind] ); // Qx + Q15 + acc = L_msu0( acc, *RZ2, t_sin[c2_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ0, t_sin[s0_ind] ); // Qx + Q15 + acc = L_mac0( acc, *IZ1, t_sin[s1_ind] ); // Qx + Q15 + acc = L_msu0( acc, *IZ2, t_sin[s2_ind] ); // Qx + Q15 + *RY2++ = round_fx( acc ); // Qx - 1 move16(); /* Compute the inverse FFT for all 3 blocks. */ @@ -3457,11 +3457,11 @@ void ifft3_fx( const Word16 Z[], Word16 X[], const Word16 n ) FOR( i = 0; i < m; i++ ) { #ifdef BASOP_NOGLOB - *pX++ = shl_sat( mult_r( *y0++, FFT3_ONE_THIRD ), 1 ); + *pX++ = shl_sat( mult_r( *y0++, FFT3_ONE_THIRD ), 1 ); // Qx move16(); - *pX++ = shl_sat( mult_r( *y1++, FFT3_ONE_THIRD ), 1 ); + *pX++ = shl_sat( mult_r( *y1++, FFT3_ONE_THIRD ), 1 ); // Qx move16(); - *pX++ = shl_sat( mult_r( *y2++, FFT3_ONE_THIRD ), 1 ); + *pX++ = shl_sat( mult_r( *y2++, FFT3_ONE_THIRD ), 1 ); // Qx move16(); #else *pX++ = shl( mult_r( *y0++, FFT3_ONE_THIRD ), 1 ); diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c index 390c0a47c..92831ce2b 100644 --- a/lib_com/ppp_fx.c +++ b/lib_com/ppp_fx.c @@ -57,7 +57,13 @@ /* NOTE: this function uses a 5 entry table frac_fx (Q4 unsigned) */ /*===================================================================*/ -void Interpol_delay_fx( Word16 *out_fx, Word16 last_fx, Word16 current_fx, Word16 SubNum, const Word16 *frac_fx ) +void Interpol_delay_fx( + Word16 *out_fx, /* Q4 */ + Word16 last_fx, /* Q0 */ + Word16 current_fx, /* Q0 */ + Word16 SubNum, /* Q0 */ + const Word16 *frac_fx /* Q4 */ +) { Word16 i, temp; Word32 L_add1, L_add2; @@ -81,17 +87,19 @@ void Interpol_delay_fx( Word16 *out_fx, Word16 last_fx, Word16 current_fx, Word1 *--------------------------------------------------------------------*/ void deemph_lpc_fx( - const Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame */ - const Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame */ + const Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame Q12 */ + const Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame Q12 */ Word16 *LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame in Q12 */ Word16 *LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame in Q12 */ - const Word16 deemph_old ) + const Word16 deemph_old /* Q0 */ +) { Word16 k, temp; Word16 b_fx[M + 2]; /* Q12 */ Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif b_fx[0] = 4096; move16(); /* 1 in Q12 */ @@ -123,7 +131,7 @@ void deemph_lpc_fx( move16(); /* 1 in Q12 */ FOR( k = 0; k < M; k++ ) { - b_fx[k + 1] = p_Aq_old_fx[k + 1]; + b_fx[k + 1] = p_Aq_old_fx[k + 1]; /* Q12 */ move16(); } b_fx[M + 1] = 0; diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 21bd9f541..935e6b33f 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -21,14 +21,14 @@ *-------------------------------------------------------------------*/ void pred_lt4( - const Word16 excI[], /* in : excitation buffer */ - Word16 excO[], /* out: excitation buffer */ - const Word16 T0, /* input : integer pitch lag */ - Word16 frac, /* input : fraction of lag */ - const Word16 L_subfr, /* input : subframe size */ - const Word16 *win, /* i : interpolation window */ - const Word16 nb_coef, /* i : nb of filter coef */ - const Word16 up_sample /* i : up_sample */ + const Word16 excI[], /* in : excitation buffer Q_exc*/ + Word16 excO[], /* out: excitation buffer Q_exc*/ + const Word16 T0, /* input : integer pitch lag Q0*/ + Word16 frac, /* input : fraction of lag Q0*/ + const Word16 L_subfr, /* input : subframe size Q0*/ + const Word16 *win, /* i : interpolation window Q14*/ + const Word16 nb_coef, /* i : nb of filter coef Q0*/ + const Word16 up_sample /* i : up_sample Q0*/ ) { Word16 i, j; @@ -36,6 +36,7 @@ void pred_lt4( const Word16 *x0, *x1, *x2, *c1, *c2; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif x0 = &excI[-T0]; @@ -44,16 +45,16 @@ void pred_lt4( IF( frac < 0 ) { - frac = add( frac, up_sample ); + frac = add( frac, up_sample ); /* Q0 */ x0--; } FOR( j = 0; j < L_subfr; j++ ) { - x1 = x0++; - x2 = x1 + 1; - c1 = ( &win[frac] ); - c2 = ( &win[up_sample - frac] ); + x1 = x0++; /* Q_exc */ + x2 = x1 + 1; /* Q_exc */ + c1 = ( &win[frac] ); /* Q14 */ + c2 = ( &win[up_sample - frac] ); /* Q14 */ { Word64 s64 = 0; @@ -61,24 +62,25 @@ void pred_lt4( FOR( i = 0; i < nb_coef; i++ ) { /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/ - s64 = W_mac0_16_16( s64, ( *x1-- ), ( *c1 ) ); - s64 = W_mac0_16_16( s64, ( *x2++ ), ( *c2 ) ); + s64 = W_mac0_16_16( s64, ( *x1-- ), ( *c1 ) ); /* Q_exc + Q14 */ + s64 = W_mac0_16_16( s64, ( *x2++ ), ( *c2 ) ); /* Q_exc + Q14 */ c1 += up_sample; c2 += up_sample; } - s = W_sat_l( s64 ); + s = W_sat_l( s64 ); /* Q_exc + Q14 */ } #if ( INTERP_EXP != -1 ) #ifdef BASOP_NOGLOB - s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); -#else /* BASOP_NOGLOB */ + s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */ +#else /* BASOP_NOGLOB */ s = L_shl( s, INTERP_EXP + 1 ); -#endif /* BASOP_NOGLOB */ +#endif /* BASOP_NOGLOB */ #endif #ifdef BASOP_NOGLOB - excO[j] = round_fx_o( s, &Overflow ); + excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ + move16(); #else /* BASOP_NOGLOB */ excO[j] = round_fx( s ); #endif @@ -113,12 +115,12 @@ void pred_lt4( /* NONE */ /*=======================================================================*/ void pred_lt4_tc_fx( - Word16 exc[], /* i/o: excitation buffer */ - const Word16 T0, /* i : integer pitch lag */ - Word16 frac, /* i: fraction of lag */ - const Word16 *win, /* i : interpolation window */ - const Word16 imp_pos, /* i : glottal impulse position */ - const Word16 i_subfr /* i : subframe index */ + Word16 exc[], /* i/o: excitation buffer Q0*/ + const Word16 T0, /* i : integer pitch lag Q0*/ + Word16 frac, /* i: fraction of lag Q0*/ + const Word16 *win, /* i : interpolation window Q14*/ + const Word16 imp_pos, /* i : glottal impulse position Q0*/ + const Word16 i_subfr /* i : subframe index Q0*/ ) { Word16 i, j, k, l; @@ -128,28 +130,29 @@ void pred_lt4_tc_fx( Word16 excI[2 * L_SUBFR]; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif - Copy( exc + sub( i_subfr, L_SUBFR ), excI, shl( L_SUBFR, 1 ) ); + Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */ test(); IF( LT_16( add( T0, sub( imp_pos, L_IMPULSE2 ) ), L_SUBFR ) && LT_16( T0, L_SUBFR ) ) { - set16_fx( &excI[sub( L_SUBFR, T0 )], 0, T0 ); + set16_fx( &excI[L_SUBFR - T0], 0, T0 ); set16_fx( excO, 0, L_SUBFR + 1 ); - x0 = excI + sub( L_SUBFR, L_INTERPOL2 - 1 ); + x0 = excI + ( L_SUBFR - ( L_INTERPOL2 - 1 ) ); IF( frac > 0 ) { - frac = sub( frac, UP_SAMP ); + frac = sub( frac, UP_SAMP ); /* Q0 */ x0--; } - l = add( UP_SAMP - 1, frac ); + l = add( UP_SAMP - 1, frac ); /* Q0 */ FOR( j = T0; j < L_SUBFR + 1; j++ ) { k = l; move16(); - L_sum = L_mult( x0[0], win[k] ); + L_sum = L_mult( x0[0], win[k] ); /* Q15 */ FOR( i = 1; i < 2 * L_INTERPOL2; i++ ) { /* @@ -158,11 +161,11 @@ void pred_lt4_tc_fx( * so that the values needed are contiguous. */ k += UP_SAMP; - L_sum = L_mac( L_sum, x0[i], win[k] ); /*Q1 */ + L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */ } #ifdef BASOP_NOGLOB - L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Q0h */ - excO[j] = round_fx_o( L_sum, &Overflow ); + L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */ + excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */ move16(); #else L_sum = L_shl( L_sum, 1 ); /*Q0h */ @@ -175,7 +178,7 @@ void pred_lt4_tc_fx( FOR( i = T0; i < L_SUBFR; i++ ) { #ifdef BASOP_NOGLOB - exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); + exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */ #else exc[i + i_subfr] = add( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); #endif diff --git a/lib_com/preemph.c b/lib_com/preemph.c index decc73f99..914ebe477 100644 --- a/lib_com/preemph.c +++ b/lib_com/preemph.c @@ -75,26 +75,26 @@ void preemph( *-------------------------------------------------------------*/ void preemph_ivas_fx( - Word32 *signal, /* i/o: signal */ - const Word16 mu, /* i : preemphasis factor */ - const Word16 L, /* i : vector size */ - Word32 *mem /* i/o: memory (x[-1]) */ + Word32 *signal, /* i/o: signal Qx*/ + const Word16 mu, /* i : preemphasis factor Q15*/ + const Word16 L, /* i : vector size Q0*/ + Word32 *mem /* i/o: memory (x[-1]) Qx*/ ) { Word16 i; Word32 temp; - temp = signal[L - 1]; + temp = signal[L - 1]; /* Qx */ move32(); FOR( i = L - 1; i > 0; i-- ) { - signal[i] = L_sub( signal[i], Mpy_32_16_1( signal[i - 1], mu ) ); + signal[i] = L_sub( signal[i], Mpy_32_16_1( signal[i - 1], mu ) ); /* Qx */ move32(); } - signal[0] = L_sub( signal[0], Mpy_32_16_1( *mem, mu ) ); + signal[0] = L_sub( signal[0], Mpy_32_16_1( *mem, mu ) ); /* Qx */ move32(); - *mem = temp; + *mem = temp; /* Qx */ move32(); return; diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index 13a0b5e42..ee0379fdb 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -20,26 +20,27 @@ void preemph_copy_fx( Word16 i, temp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif - temp = x[lg - 1]; + temp = x[lg - 1]; /* Qx */ move16(); - FOR( i = sub( lg, 1 ); i > 0; i-- ) + FOR( i = lg - 1; i > 0; i-- ) { #ifdef BASOP_NOGLOB - y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); + y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */ #else y[i] = msu_r( L_deposit_h( x[i] ), x[i - 1], mu ); #endif move16(); } #ifdef BASOP_NOGLOB - y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); + y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */ #else y[0] = msu_r( L_deposit_h( x[0] ), *mem, mu ); #endif move16(); - *mem = temp; + *mem = temp; /* Qx */ move16(); } @@ -59,7 +60,13 @@ void preemph_copy_fx( * Returns: * void */ -void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem ) +void E_UTIL_f_preemph2( + Word16 shift, /* Q0 */ + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem /* Qx */ +) { Word16 i, temp; Word32 L_tmp; @@ -67,16 +74,16 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor Flag Overflow = 0; move32(); #endif - temp = signal[lg - 1]; + temp = signal[lg - 1]; /* Qx */ move16(); - FOR( i = sub( lg, 1 ); i > 0; i-- ) + FOR( i = lg - 1; i > 0; i-- ) { - L_tmp = L_mult( signal[i], 16384 ); + L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */ #ifdef BASOP_NOGLOB - L_tmp = L_msu0_o( L_tmp, signal[i - 1], mu, &Overflow ); - L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); - signal[i] = round_fx_o( L_tmp, &Overflow ); + L_tmp = L_msu0_o( L_tmp, signal[i - 1], mu, &Overflow ); /* Qx + 15 */ + L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ + signal[i] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); #else L_tmp = L_msu0( L_tmp, signal[i - 1], mu ); @@ -85,11 +92,11 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor #endif } - L_tmp = L_mult( signal[0], 16384 ); + L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */ #ifdef BASOP_NOGLOB - L_tmp = L_msu0_o( L_tmp, *mem, mu, &Overflow ); - L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); - signal[0] = round_fx_o( L_tmp, &Overflow ); + L_tmp = L_msu0_o( L_tmp, *mem, mu, &Overflow ); /* Qx + 15 */ + L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */ + signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */ move16(); #else L_tmp = L_msu0( L_tmp, *mem, mu ); @@ -97,35 +104,41 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor signal[0] = round_fx( L_tmp ); #endif - *mem = temp; + *mem = temp; /* Qx */ move16(); return; } -Word16 E_UTIL_f_preemph3( Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem, Word16 bits ) +Word16 E_UTIL_f_preemph3( + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem, /* Qx */ + Word16 bits /* Q0 */ +) { Word16 i, QVal, mus, tmp_fixed, Q_new; Word32 L_tmp, L_maxloc; - QVal = shl( 1, sub( 15, bits ) ); - mus = shr( mu, bits ); + QVal = shl( 1, sub( 15, bits ) ); /* Q15 - bits */ + mus = shr( mu, bits ); /* Q15 - bits */ - L_tmp = L_mult( signal[0], QVal ); - L_tmp = L_msu( L_tmp, *mem, mus ); + L_tmp = L_mult( signal[0], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, *mem, mus ); /* Qx + Q16 - bits */ L_maxloc = L_abs( L_tmp ); FOR( i = 1; i < lg; i++ ) { - L_tmp = L_mult( signal[i], QVal ); - L_tmp = L_msu( L_tmp, signal[i - 1], mus ); + L_tmp = L_mult( signal[i], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, signal[i - 1], mus ); /* Qx + Q16 - bits */ L_tmp = L_abs( L_tmp ); L_maxloc = L_max( L_tmp, L_maxloc ); } - tmp_fixed = extract_h( L_maxloc ); + tmp_fixed = extract_h( L_maxloc ); /* Qx - bits */ Q_new = Q_MAX; move16(); @@ -136,22 +149,22 @@ Word16 E_UTIL_f_preemph3( Word16 *signal, const Word16 mu, const Word16 lg, Word Q_new = s_min( Q_new, Q_MAX ); } - tmp_fixed = signal[lg - 1]; + tmp_fixed = signal[lg - 1]; /* Qx */ move16(); - FOR( i = sub( lg, 1 ); i > 0; i-- ) + FOR( i = lg - 1; i > 0; i-- ) { - L_tmp = L_mult( signal[i], QVal ); - L_tmp = L_msu( L_tmp, signal[i - 1], mus ); - L_tmp = L_shl( L_tmp, Q_new ); - signal[i] = round_fx( L_tmp ); + L_tmp = L_mult( signal[i], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, signal[i - 1], mus ); /* Qx + Q16 - bits */ + L_tmp = L_shl( L_tmp, Q_new ); /* Qx + Q16 + Q_new - bits */ + signal[i] = round_fx( L_tmp ); /* Qx + Q_new - bits */ move16(); } - L_tmp = L_mult( signal[0], QVal ); - L_tmp = L_msu( L_tmp, *mem, mus ); - L_tmp = L_shl( L_tmp, Q_new ); - signal[0] = round_fx( L_tmp ); + L_tmp = L_mult( signal[0], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, *mem, mus ); /* Qx + Q16 - bits */ + L_tmp = L_shl( L_tmp, Q_new ); /* Qx + Q16 + Q_new - bits */ + signal[0] = round_fx( L_tmp ); /* Qx + Q_new - bits */ move16(); *mem = tmp_fixed; move16(); @@ -159,28 +172,34 @@ Word16 E_UTIL_f_preemph3( Word16 *signal, const Word16 mu, const Word16 lg, Word return Q_new; } -Word16 E_UTIL_f_preemph3_ivas_fx( Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem, Word16 bits ) +Word16 E_UTIL_f_preemph3_ivas_fx( + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem, /* Qx */ + Word16 bits /* Q0 */ +) { Word16 i, QVal, mus, tmp_fixed, Q_new; Word32 L_tmp, L_maxloc; - QVal = shl( 1, sub( 15, bits ) ); - mus = shr( mu, bits ); + QVal = shl( 1, sub( 15, bits ) ); /* Q15 - bits */ + mus = shr( mu, bits ); /* Q15 - bits */ - L_tmp = L_mult( signal[0], QVal ); - L_tmp = L_msu( L_tmp, *mem, mus ); + L_tmp = L_mult( signal[0], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, *mem, mus ); /* Qx + Q16 - bits */ L_maxloc = L_abs( L_tmp ); FOR( i = 1; i < lg; i++ ) { - L_tmp = L_mult( signal[i], QVal ); - L_tmp = L_msu( L_tmp, signal[i - 1], mus ); + L_tmp = L_mult( signal[i], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, signal[i - 1], mus ); /* Qx + Q16 - bits */ L_tmp = L_abs( L_tmp ); L_maxloc = L_max( L_tmp, L_maxloc ); } - tmp_fixed = extract_h( L_maxloc ); + tmp_fixed = extract_h( L_maxloc ); /* Qx - bits */ Q_new = Q_MAX; move16(); @@ -196,17 +215,17 @@ Word16 E_UTIL_f_preemph3_ivas_fx( Word16 *signal, const Word16 mu, const Word16 FOR( i = sub( lg, 1 ); i > 0; i-- ) { - L_tmp = L_mult( signal[i], QVal ); - L_tmp = L_msu( L_tmp, signal[i - 1], mus ); - L_tmp = L_shl( L_tmp, Q_new ); - signal[i] = round_fx( L_tmp ); + L_tmp = L_mult( signal[i], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, signal[i - 1], mus ); /* Qx + Q16 - bits */ + L_tmp = L_shl( L_tmp, Q_new ); /* Qx + Q16 + Q_new - bits */ + signal[i] = round_fx( L_tmp ); /* Qx + Q_new - bits */ move16(); } - L_tmp = L_mult( signal[0], QVal ); - L_tmp = L_msu( L_tmp, *mem, mus ); - L_tmp = L_shl( L_tmp, Q_new ); - signal[0] = round_fx( L_tmp ); + L_tmp = L_mult( signal[0], QVal ); /* Qx + Q16 - bits */ + L_tmp = L_msu( L_tmp, *mem, mus ); /* Qx + Q16 - bits */ + L_tmp = L_shl( L_tmp, Q_new ); /* Qx + Q_new + Q16 - bits */ + signal[0] = round_fx( L_tmp ); /* Qx + Q_new - bits */ move16(); *mem = tmp_fixed; move16(); diff --git a/lib_com/prot.h b/lib_com/prot.h index 803a0a757..93b3f3a90 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -856,10 +856,10 @@ void preemph( float *mem /* i/o: memory (x[-1]) */ ); void preemph_ivas_fx( - Word32 *signal, /* i/o: signal */ - const Word16 mu, /* i : preemphasis factor */ - const Word16 L, /* i : vector size */ - Word32 *mem /* i/o: memory (x[-1]) */ + Word32 *signal, /* i/o: signal Qx*/ + const Word16 mu, /* i : preemphasis factor Q15*/ + const Word16 L, /* i : vector size Q0*/ + Word32 *mem /* i/o: memory (x[-1]) Qx*/ ); void cb_shape( const int16_t preemphFlag, /* i : flag for pre-emphasis */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 07e2aa779..bfe439692 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -2220,18 +2220,20 @@ ppp_fx.c /========================================================================================================*/ void Interpol_delay_fx( - Word16 *out_fx, - Word16 last_fx, - Word16 current_fx, - Word16 SubNum, - const Word16 *frac_fx ); + Word16 *out_fx, /* Q4 */ + Word16 last_fx, /* Q0 */ + Word16 current_fx, /* Q0 */ + Word16 SubNum, /* Q0 */ + const Word16 *frac_fx /* Q4 */ +); void deemph_lpc_fx( - const Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame */ - const Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame */ + const Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame Q12 */ + const Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame Q12 */ Word16 *LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame in Q12 */ Word16 *LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame in Q12 */ - const Word16 deemph_old ); + const Word16 deemph_old /* Q0 */ +); /*========================================================================================================/ hq2_core_com_fx.c @@ -2607,10 +2609,28 @@ void preemph_copy_fx( Word16 *mem /* i/o: memory (x[-1]) Qx */ ); -void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem ); +void E_UTIL_f_preemph2( + Word16 shift, /* Q0 */ + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem /* Qx */ +); -Word16 E_UTIL_f_preemph3( Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem, Word16 bits ); -Word16 E_UTIL_f_preemph3_ivas_fx( Word16 *signal, const Word16 mu, const Word16 lg, Word16 *mem, Word16 bits ); +Word16 E_UTIL_f_preemph3( + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem, /* Qx */ + Word16 bits /* Q0 */ +); +Word16 E_UTIL_f_preemph3_ivas_fx( + Word16 *signal, /* Qx */ + const Word16 mu, /* Q15 */ + const Word16 lg, /* Q0 */ + Word16 *mem, /* Qx */ + Word16 bits /* Q0 */ +); // swb_bwe_com_fx.c Word16 WB_BWE_gain_pred_fx( Word16 *WB_fenv, /* o : WB frequency envelopes */ @@ -7171,24 +7191,24 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( // pred_lt4_fx.c void pred_lt4( - const Word16 excI[], /* in : excitation buffer */ - Word16 excO[], /* out: excitation buffer */ - const Word16 T0, /* i : integer pitch lag */ - Word16 frac, /* i : fraction of lag */ - const Word16 L_subfr, /* i : subframe size */ - const Word16 *win, /* i : interpolation window */ - const Word16 nb_coef, /* i : nb of filter coef */ - const Word16 up_sample /* i : up_sample */ + const Word16 excI[], /* in : excitation buffer Q_exc*/ + Word16 excO[], /* out: excitation buffer Q_exc*/ + const Word16 T0, /* input : integer pitch lag Q0*/ + Word16 frac, /* input : fraction of lag Q0*/ + const Word16 L_subfr, /* input : subframe size Q0*/ + const Word16 *win, /* i : interpolation window Q14*/ + const Word16 nb_coef, /* i : nb of filter coef Q0*/ + const Word16 up_sample /* i : up_sample Q0*/ ); void pred_lt4_tc_fx( - Word16 exc[], /* i/o: excitation buffer */ - const Word16 T0, /* i : integer pitch lag */ - Word16 frac, /* i: fraction of lag */ - const Word16 *win, /* i : interpolation window */ - const Word16 imp_pos, /* i : glottal impulse position */ - const Word16 i_subfr /* i : subframe index */ + Word16 exc[], /* i/o: excitation buffer Q0*/ + const Word16 T0, /* i : integer pitch lag Q0*/ + Word16 frac, /* i: fraction of lag Q0*/ + const Word16 *win, /* i : interpolation window Q14*/ + const Word16 imp_pos, /* i : glottal impulse position Q0*/ + const Word16 i_subfr /* i : subframe index Q0*/ ); // pvq_cored_dec diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 11a6fd49c..d3be66ae9 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -702,7 +702,8 @@ static void calc_poc_fx( } isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); - isd_rate = shl_r( isd_rate, isd_rate_e ); // Q15 + // Saturation to handle values close to 1.0f + isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); move16(); @@ -883,7 +884,8 @@ static void calc_poc_fx( ICCr = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, L_tmp2_e ) ); ICCr = Sqrt32( ICCr, &L_tmp_e ); - ICCr = L_shl_r( ICCr, L_tmp_e ); // Q31 + // Saturation to handle values close to 1.0f + ICCr = L_shl_sat( ICCr, L_tmp_e ); // Q31 // hPHA->iccr_s = STEREO_DMX_EVS_ICCR_FORGETTING * hPHA->iccr_s + ( 1.0f - STEREO_DMX_EVS_ICCR_FORGETTING ) * ICCr; hPHA->iccr_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ICCR_FORGETTING_Q31, hPHA->iccr_s_fx ), Mpy_32_32_r( MAX_32 - STEREO_DMX_EVS_ICCR_FORGETTING_Q31, ICCr ) ); @@ -967,7 +969,8 @@ static void calc_poc_fx( ild_cnt = 0; move16(); isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_l, freq_8k, &isd_rate_e ); - isd_rate = shl_r( isd_rate, isd_rate_e ); // Q15 + // Saturation to handle values close to 1.0f + isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 FOR( i = 1; i < nsbd; i++ ) { // rfft_pha_buf[i * 2] = (float) sqrt( ( 1.0f + Pr[i] ) / 2.0f ); -- GitLab