1.4.2.32 DSP_TransformIFFT16 Function

Creates an Inverse Fast Fourier Transform (FFT) from a frequency domain input.

Description

void DSP_TransformIFFT16(int16c *dout, int16c *din, int16c *twiddles, int16c *scratch, int log2N);

Performs an complex Inverse 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. A very similar function to the FFT is executed for the inverse FFT. This requires twiddle factors set in advance with the same method as used in the FFT. Complex conjugate and scaling are handled within the algorithm. The output is scaled using binary shifting based on log2N. Since the algorithm reduces the output by a scale factor of log2N, the resolution is reduced proportionally to the number of data points.

Example

int ilog2N = 10; _// log2(64) = 6; log2(256) = 8; log2(1024) = 10;_

int ifftSamples = pow(2,ilog2N);

int16c *ifftDin;

int16c ifftDout[ifftSamples];

int16c iscratch[ifftSamples];

int16c ifftCoefs[ifftSamples];

int16c ifftTimeOut[ifftSamples];

_// set up twiddle factors, these are used for both FFT and iFFT_

int16c *ifftc;

ifftc = &ifftCoefs;

DSP_TransformFFT16_setup( ifftc, ilog2N); _// call to coef setup_

_// in this example, we take an FFT of an original time domain (sine wave)_

_// the output of the FFT is used as the input of the iFFT for comparison_

ifftDin = &fftin_800hz_verylong16;

DSP_TransformFFT16(ifftDout, ifftDin, ifftc, iscratch, ilog2N);

_// ifftDout = frequency domain output, complex number array_

DSP_TransformIFFT16(ifftTimeOut, ifftDout, ifftc, iscratch, ilog2N);

_// do something with the output, fftTimeOut, time domain_

C

void  DSP_TransformIFFT16 (int16c * dout , int16c * din , int16c * twiddles , int16c * scratch , int log2N );