This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSPLIB DSP_fft16x16 function usage

Hi,

I  am trying to use DSP_fft16x16 function and bumping into an issue where the output from this FFT kernel does not match reference output when tried in Octave and I am not sure why. 

I generated the weight vector using gen_twiddle_fft16x16 function in the library and my inputs are in the range +8 to -8 stored in an signed char. My input and weight vector are double word aligned and are of type "short". Its a bit confusing in the corresponding DSPLIB documentation if the input needs to be scaled I tried scaling up by 4 bits and no scaling but the results dont match in either case. Not sure if I am breaking any other assumptions of this library function.

Here is my code below-

#define N 128

 

char block[N][N];

char out[N][N];

 

#pragma DATA_ALIGN(8)

short   inp_scale[N];

#pragma DATA_ALIGN(8)

short   inp_16[2*N];

#pragma DATA_ALIGN(8)

short   out_16[2*N];

#pragma DATA_ALIGN(8)

short   wt_16[2*N];

short fft_real[N][N];

short fft_imag[N][N];

 

 

Void TskFcnTwoDFft()

{

               gen_twiddle_fft16x16(wt_16,N);

 

               for(int row = 0; row < N; row++)

               {

                              for(int col = 0; col < N; col++)

                              {

                                             inp_16[2*col] = block[row][col];

                                             inp_16[2*col+1] = 0;

                              }

 

                              DSP_fft16x16(wt_16,N,inp_16,out_16);

                             

                              for (int col = 0; col < N; col++)

                              {

                                             fft_real[row][col] = out_16[2*col];

                                             fft_imag[row][col] = out_16[2*col+1];

                              }

               }

 

 

               for (int col = 0; col < N; col++)

               {

                              for (int row = 0; row < N; row++)

                              {

                                             inp_16[2*row] = fft_real[row][col]>>1;

                                             inp_16[2*row+1] = fft_imag[row][col]>>1;

                              }

 

                              DSP_fft16x16(wt_16,N,inp_16,out_16);

                             

                              for (int row = 0; row < N; row++)

                              {

                                             fft_real[row][col] = out_16[2*row];

                                             fft_imag[row][col] = out_16[2*row+1];

                              }

               }

}

  • Hello!

    I'd like to suggest try provided example first. Please find something like TI\dsplib_c66x_3_2_0_1\packages\ti\dsplib\src\DSP_fft16x16\c66\DSP_fft16x16_d.c. It could be different in your setup, important to find the file with *_d.c name. It is a driver, showing usage of the function. You'll find example, how to manage not only alignment, but padding as well. I believe traversing that example would give you much more, than we forum answer may.

  • Kal,

    What TI device are you working with? This question would be more appropriate in the specific device forum rather than the CCS forum.