Hi,
Customer calculates the 2048-point FFT according to the Greater Than 1024-point FFT code provided in the manual, the result of the FFT combination of odd-even sequences is wrong.
He uses the following CPLX_Mul code, the multiplication and shifting of two int16 numbers will cause the sign bit to be shifted to the right.
Int32 CPLX_Mul(Int32 op1, Int32 op2) { Int16 op1_r, op1_i, op2_r, op2_i; Int32 op1_op2_r, op1_op2_i; Int16 op1_op2_r16, op1_op2_i16; Int32 cplx_prod; // Mask data for real and imag data = (real:imag) op1_r = op1 >> 16; op1_i = op1 & 0x0000FFFF; op2_r = op2 >> 16; op2_i = op2 & 0x0000FFFF; op1_op2_i = (Int32)op1_r*op2_i + (Int32)op1_i*op2_r; op1_op2_r = (Int32)op1_r*op2_r - (Int32)op1_i*op2_i; op1_op2_i16 = (Int16)(op1_op2_i >> 15); op1_op2_r16 = (Int16)(op1_op2_r >> 15); cplx_prod = (((Int32)op1_op2_r16 & 0x0000FFFF)<< 16); cplx_prod = cplx_prod | ((Int32)op1_op2_i16 & 0x0000FFFF); return cplx_prod; } Int32 CPLX_Add(Int32 op1, Int32 op2 , Uint16 scale_flag) { Int16 op1_r, op1_i, op2_r, op2_i; Int32 op1_op2_r, op1_op2_i; Int16 op1_op2_r16, op1_op2_i16; Int32 cplx_prod; // Mask data for real and imag data = (real:imag) op1_r = op1 >> 16; op1_i = op1 & 0x0000FFFF; op2_r = op2 >> 16; op2_i = op2 & 0x0000FFFF; // Yr = 1/2 * (op1_r + op2_r), Yi = 1/2 *(op1_i + op2_i) op1_op2_i = (Int32)op1_i +(Int32)op2_i; op1_op2_r = (Int32)op1_r +(Int32)op2_r; op1_op2_i16 = (Int16)(op1_op2_i >> 1); op1_op2_r16 = (Int16)(op1_op2_r >> 1); cplx_prod = (((Int32)op1_op2_r & 0x0000FFFF)<< 16); cplx_prod = cplx_prod | ((Int32)op1_op2_i & 0x0000FFFF); return cplx_prod; } Int32 CPLX_Subtract(Int32 op1, Int32 op2 , Uint16 scale_flag) { Int16 op1_r, op1_i, op2_r, op2_i; Int32 op1_op2_r, op1_op2_i; Int16 op1_op2_r16, op1_op2_i16; Int32 cplx_prod; // Mask data for real and imag data = (real:imag) op1_r = op1 >> 16; op1_i = op1 & 0x0000FFFF; op2_r = op2 >> 16; op2_i = op2 & 0x0000FFFF; // Yr = 1/2 * (op1_r - op2_r), Yi = 1/2 *(op1_i - op2_i) op1_op2_i = (Int32)op1_i - (Int32)op2_i; op1_op2_r = (Int32)op1_r - (Int32)op2_r; op1_op2_i16 = (Int16)(op1_op2_i >> 1); op1_op2_r16 = (Int16)(op1_op2_r >> 1); cplx_prod = (((Int32)op1_op2_r & 0x0000FFFF)<< 16); cplx_prod = cplx_prod | ((Int32)op1_op2_i & 0x0000FFFF); return cplx_prod; }
Where can I find source code of
CPLX_Mul(twiddle[k], data_odd[k]).
CPLX_Add(data_even[k], twiddle_times_data_odd, SCALE_FLAG);
CPLX_Subtract(data_even[k], twiddle_times_data_odd, SCALE_FLAG)
www.ti.com.cn/.../spruh87h.pdf