1.4.2.30 DSP_TransformFFT32 Function
Creates an Fast Fourier Transform (FFT) from a time domain input.
Description
void DSP_TransformFFT32(int32c *dout, int32c *din, int32c *twiddles, int32c *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 (Q31) 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_TransformFFT32_setup
Parameters
dout pointer to complex output array (int32c)
din pointer to complex input array (int32c)
twiddles pointer to an complex array of FFT factors (int32c)
scratch pointer to a complex scratch pad buffer (int32c)
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; int32c *fftDin; int32c fftDout[fftSamples]; int32c scratch[fftSamples]; int32c fftCoefs[fftSamples]; int32c *fftc; fftc = &fftCoefs; DSP_TransformFFT32_setup(fftc, log2N); _// call setup function_ while (1) { fftDin = &fftin_5Khz_long_window32; _// get 256 point complex data_ DSP_TransformFFT32(fftDout, fftDin, fftc, scratch, log2N); _// do something with the output, fftDout_ };
C
void DSP_TransformFFT32 (int32c * dout , int32c * din , int32c * twiddles , int32c * scratch , int log2N );