31.7.3 mips_fft32

Description

Computes the complex Fast Fourier Transform (FFT) of the input sequence din. The number of samples to be processed is specified by the parameter log2N: N = 2log2N. The fftc array holds complex coefficients needed by the FFT algorithm. The scratch hold intermediate data; its contents are destroyed on each call to mips_fft32().

Mathematically,

o u t p u t n = 1 2 log 2 N k = 0 N 1   d i n n × e j 2 π k n N

Include

dsplib_dsp.h

Prototype

void
mips_fft32
(
       int32c *dout,
       int32c *din,
       int32c *fftc,
       int132 *scratch,
       int log2N
);

Argument

dout: Output array with 32-bit complex fixed-point elements in Q31 format.

din: Input array with 32-bit complex fixed-point elements in Q31 format.

fftc: Input array with 32-bit complex fixed-point twiddle factors in Q31 format.

scratch: Intermediate results array holding 32-bit complex fixed-point data.

log2N: Logarithm base 2 of the number of samples: N = 2log2N.

Return Value

None.

Remarks

  • The pointers dout, din, fftc, and scratch must be aligned on 4-byte boundaries.
  • log2N must be larger than or equal to 3.

Notes

The scratch array must be large enough to hold N 32-bit complex data samples having 32-bit real part and 32-bit imaginary part.

Copying fftc to RAM prior to calling this function can be used to improve performance.

Example

#include “fftc.h” // pre-computed coefficients
int log2N = 6; // log2(64) = 6
int N = 1 << log2N; // N = 2^6 = 64
int32c din[N];
int32c dout[N];
int32c scratch[N];
#define fftc fft32c64 // from fftc.h, for N = 64
while (true)
{
  // load complex input data into din
  ...
  mips_fft32(dout, din, fftc, scratch, log2N);
  // do something with dout
  ...
}