1.4.2.28 DSP_TransformFFT16 Function
Creates an Fast Fourier Transform (FFT) from a time domain input.
Description
void DSP_TransformFFT16(int16c *dout, int16c *din, int16c *twiddles, int16c *scratch, int log2N);
Performs an complex FFT on the input, din, and stores the complex result in dout. Performs 2^log2N point calculation, and the working buffer scratch as well as the input and output must be 2^log2N in length. Coefficient twiddle factors come from twiddles, and may be loaded with the use of DSP_TransformFFT16_setup. All values are 16 bit (Q15) fractional.
Preconditions
din, dout, twiddles and scratch must have N elements N is calculated as 2^(log2N) log2N must be >= 3 FFT factors must be calculated in advance, use DSP_TransformFFT16_setup
Parameters
dout pointer to complex output array (int16c)
din pointer to complex input array (int16c)
twiddles pointer to an complex array of factors (int16c)
scratch pointer to a complex scratch pad buffer (int16c)
log2N binary exponent of number of samples (int)
Returns
None.
Remarks
Scratch must be declared but need not be initialized. Din may be aided with a window function prior to calling the FFT, but is not required. Din is a complex number array, but may be loaded solely with real numbers if no phase information is available.
Example
int log2N = 8; _// log2(256) = 8_ int fftSamples = 256; int16c *fftDin; int16c fftDout[fftSamples]; int16c scratch[fftSamples]; int16c fftCoefs[fftSamples]; int16c *fftc; fftc = &fftCoefs; DSP_TransformFFT16_setup(fftc, log2N); _// call setup function_ while (1) { fftDin = &fftin_8Khz_long_window16; _// get 256 point complex data_ DSP_TransformFFT16(fftDout, fftDin, fftc, scratch, log2N); _// do something with the output, fftDout_ };
C
void DSP_TransformFFT16 (int16c * dout , int16c * din , int16c * twiddles , int16c * scratch , int log2N );