31.7.1 mips_fft16
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_fft16().
Mathematically,
Include
dsplib_dsp.h
Prototype
void
mips_fft16
(
int16c *dout,
int16c *din,
int16c *fftc,
int16c *scratch,
int log2N
);
Argument
dout: Output array with 16-bit complex fixed-point elements in Q15 format.
din: Input array with 16-bit complex fixed-point elements in Q15 format.
fftc: Input array with 16-bit complex fixed-point twiddle factors in Q15 format.
scratch: Intermediate results array holding 16-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 16-bit complex data samples having 16-bit real part and 16-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
int16c din[N];
int16c dout[N];
int16c scratch[N];
#define fftc fft16c64 // from fftc.h, for N = 64
while (true)
{
// load complex input data into din
...
mips_fft16(dout, din, fftc, scratch, log2N);
// do something with dout
...
}