Post Go back to editing

SHARC ADSP-2156x FFT and IFFT problem


    I have a problem about FFT and IFFT,

I have get audio data from I2S buffer(as below real_inputBuffer_L) to push rfft:

float real_inputBuffer_L[BUFF_SIZE/2];

float rfft_real_output_L[BUFF_SIZE/2];
float rfft_imag_output_L[BUFF_SIZE/2];

float irfft_real_output_L[BUFF_SIZE/2];
float irfft_imag_output_L[BUFF_SIZE/2];

result = rfft512(real_inputBuffer_L, rfft_real_output_L, rfft_imag_output_L);

Then I push rfft_real_output_L and rfft_imag_output_L to ifft:

result = ifft512(rfft_real_input_L, rfft_imag_input_L, irfft_real_output_L, irfft_imag_output_L);

question 1, the irfft_real_output_L power be magnify 512, is it correct?

I mean if irfft_real_output_L /512 , will almost equal real_inputBuffer_L( like as below plot photo)

red dot color is real_inputBuffer_L, green color is irfft_real_output_L /512

question 2, as I know sin wave --> FFT should be get one point frequency. how could I see the result to verify convert is success?

I have watch the rfft_real_output_L and rfft_imag_output_L data, but data seem do not display.

question 3, above FFT and IFFT is it correct? or I need more configure setting for FFT/IFFT.

  • Hi,

    Please find the details here.

    #1>> Rfft is used for Real radix-2 FFT function and IFFT is used for inverse complex radix-2 FFT function.
    The input to ifftN are two floating-point arrays of N points. The array real_input contains the real components of the inverse FFT input and the array imag_input contains the imaginary components.

    The time-domain signal generated by the ifftN functions is stored in the arrays real_output and imag_output. The array real_output contains the real component of the complex output signal, and the array imag_output contains the imaginary component. The output is scaled by N, the number of points in the inverse FFT. The functions return a pointer to the real_output array.

    #2>> The main objective of ifftN is to retrieve the original input signal after performing FFT on the input signal followed by applying IFFT.i.e to recover the complete input signal after the "FFT" function
    Can you please have a look into attached image files with sine input and matlab generated real inputs, which might help you.
    Also, you can view the respective data (rfft_real_output_L and rfft_imag_output_L) in the memory browser window.

    #3>> From your code snippet, we could understand that you are using header file "Trans.h", and also these library functions have not been optimized for SHARC SIMD processors. Applications that run on SHARC SIMD processors should use the FFT functions that are defined in the header file filter.h.
    The ifftN library functions that are defined in the header file filter.h should be able to generate in-place FFTs, they have been optimized to take advantage of the SIMD capabilities of the SHARC processors. These FFT functions require complex arguments to ensure that the real and imaginary parts are interleaved in memory and are thus accessible in a single cycle, using the wider data bus of the processor.

    Apart from this, there is a CCES DSP library provides a number of filters, declared in the filter.h headers. The sources for these functions are available in the CCES installation.

    We would suggest you to refer DSP runtime library reference to know more about FFT and IFFT filter. You can navigate as below.
    CCES installation \Analog Devices\CrossCore Embedded Studio 2.9.x\SHARC\lib\src\libdsp_src

    rfftN(in rfft.asm, rfftn_SIMD.asm and rfftn_nonSIMD.asm)
    ifftN(in ifft.asm, ifftn_simd.asm and ifftn_nonSIMD.asm)

    Please refer the file to know about the FFT and IFFTN which is available in the below help path:

    CrossCore® Embedded Studio 2.x.x > SHARC® Development Tools Documentation > C/C++ Library Manual for SHARC® Processors > DSP Run-Time Library > DSP Run-Time Library Reference


  • Hi,

      sorry for reply late,

    thanks for your information, I had change to <filter.h> and apply in code.

    yes, the IFFT output almost equal input signal without divide by N.

    could you know how to do that in the first step?

  • Hi,

    Could you please explain your query in detail. This would be helpful for us to assist you further.

    Best Regards,

  • thanks for your help, I have not no more question now. ^_^