The FFT module implements a set of functions that can be used to compute the FFT of a set of complex data points, or the inverse.
The include file “fft.h” defines a set of arrays that are to be used with the FFT functions, called sine_8[], sine_16[], ..., sine_8192[]. Depending on the number of points, pick the appropriate array and pass it to fftForward and fftInverse as required.
This function twiddles the arrays around prior to computing an FFT.
A calling sequence for a forward FFT involves fftTwiddle() followed by fftForward(), and for an inverse FFT it involves fftTwiddle() followed by fftInverse(). In some cases twiddling can be avoided, for example when computing a convolution.
Parameters: |
|
---|
This function computes a forward FFT.
The complex input array is supplied as two arrays of integers, with numbers represented as fixed-point values. The number of points must be a power of 2, and the array of sine values should contain a quarter sine-wave. Use one of sine_N provided in sine.h. The function does not perform a bit-twiddle - if required then fftTwiddle() should be called beforehand.
Parameters: |
|
---|
This function computes an inverse FFT.
The complex input array is supplied as two arrays of integers, with numbers represented as fixed-point values. The number of points must be a power of 2, and the array of sine values should contain a quarter sine-wave. Use one of sine_N provided in sine.h. The function does not perform a bit-twiddle - if required then fftTwiddle() should be called beforehand.
Parameters: |
|
---|
This function computes the FFT of two real sequences in one go.
It uses a nifty trick () that enables one to use a single complex FFT to compute two real FFTs simultaneously. The real inputs should be in the first two real arrays, the output is in the real and imaginary arrays (the output of a real FFT is still a complex number).
Parameters: |
|
---|
This function computes the inverse FFT on two sets of complex data that are known to result in real numbers only in one go.
It uses a nifty trick () that enables one to use a single complex inverse FFT to compute two real inverse FFTs simultaneously. The outputs are in the two real arrays, the imaginary arrays are unchanged.
Parameters: |
|
---|
Below is an example calling sequence:
#include "fft.h"
int main(void) {
int re[8], im[8];
for(int i = 0; i < 8; i++) {
// Fill re and im.
}
fftTwiddle(re, im, 8);
fftForward(re, im, 8, sine_8);
// Modify re and im, which are in the frequency domain
fftTwiddle(re, im, 8);
fftInverse(re, im, 8, sine_8);
// and back to the time domain
}