LIBML  Version 3.2.4
LIBML DSP Software Library
Functions
Complex FFT Functions
Collaboration diagram for Complex FFT Functions:

Functions

tpt_status tpt_cfft_f32 (f32_t *aInPlace, size_t aLogN, bool aIfftFlag)
 Processing function for the floating-point complex FFT. More...
 
tpt_status tpt_cfft_f64 (f64_t *aInPlace, size_t aLogN, bool aIfftFlag)
 Processing function for the floating-point complex FFT. More...
 
tpt_status tpt_cfft_q15 (q15_t *aInPlace, size_t aLogN, bool aIfftFlag)
 Processing function for the Q15 complex FFT. More...
 
tpt_status tpt_cfft_q31 (q31_t *aInPlace, size_t aLogN, bool aIfftFlag)
 Processing function for the Q31 complex FFT. More...
 

Detailed Description

The Fast Fourier Transform (FFT) is an efficient algorithm for computing the Discrete Fourier Transform (DFT). The FFT can be orders of magnitude faster than the DFT, especially for long lengths. The algorithms described in this section operate on complex data. A separate set of functions is devoted to handling of real sequences.
The algorithms only support lengths of power of 2. Therefore, the actual fftLen is 2^aLogN.
The FFT functions operate in-place. That is, the array holding the input data will also be used to hold the corresponding result. The input data is complex and contains 2 * fftLen interleaved values as shown below.
{ real[0], imag[0], real[1], imag[1], ... } 
The FFT result will be contained in the same array and the frequency domain values will have the same interleaving.
Algorithm
1] forward transform
           N-1
    X[k] = sum { x[n] * W(N, kn) } for k = 0, 1, ..., N - 1
           n=0
  
2] inverse transform
                     N-1
    x[k] = (1 / N) * sum { X[n] * W(N, -kn) } for k = 0, 1, ..., N - 1
                     n=0
  
The complex FFT uses a mixed-radix algorithm. Multiple radix-4 stages are performed along with a single radix-2 stage, as needed. The algorithm supports lengths of [16, 32, 64, ..., 4096] and the corresponding aLogN value is [4, 5, 6, ..., 12].
The function uses the standard FFT definition and output values may grow by a factor of fftLen when computing the forward transform. The inverse transform includes a scale of 1 / fftLen as part of the calculation and this matches the textbook definition of the inverse FFT.

Function: Combined Radix4 Decimation in Frequency CFFT function

The Fast Fourier Transform (FFT) is an efficient algorithm for computing the Discrete Fourier Transform (DFT). The FFT can be orders of magnitude faster than the DFT, especially for long lengths. The algorithms described in this section operate on complex data. A separate set of functions is devoted to handling of real sequences.
The algorithms only support lengths of power of 2. Therefore, the actual fftLen is 2^aLogN.
The FFT functions operate in-place. That is, the array holding the input data will also be used to hold the corresponding result. The input data is complex and contains 2 * fftLen interleaved values as shown below.
{ real[0], imag[0], real[1], imag[1], ... } 
The FFT result will be contained in the same array and the frequency domain values will have the same interleaving.
Algorithm
1] forward transform
           N-1
    X[k] = sum { x[n] * W(N, kn) } for k = 0, 1, ..., N - 1
           n=0
  
2] inverse transform
                     N-1
    x[k] = (1 / N) * sum { X[n] * W(N, -kn) } for k = 0, 1, ..., N - 1
                     n=0
  
The complex FFT uses a mixed-radix algorithm. Multiple radix-4 stages are performed along with a single radix-2 stage, as needed. The algorithm supports lengths of [16, 32, 64, ..., 4096] and the corresponding aLogN value is [4, 5, 6, ..., 12].
The function uses the standard FFT definition and output values may grow by a factor of fftLen when computing the forward transform. The inverse transform includes a scale of 1 / fftLen as part of the calculation and this matches the textbook definition of the inverse FFT.

Function: Combined Radix4 Decimation in Frequency CFFT function

Function Documentation

◆ tpt_cfft_f32()

tpt_status tpt_cfft_f32 ( f32_t aInPlace,
size_t  aLogN,
bool  aIfftFlag 
)

Processing function for the floating-point complex FFT.

Parameters
[in,out]aInPlacepoints to the complex data buffer of size 2 * fftLen. Processing occurs in-place.
[in]aLogNThe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Parameters
[in,out]aInPlacepoints to the complex data buffer of size. 2 * fftLen. Processing occurs in-place.
[in]aLogNthe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status

◆ tpt_cfft_f64()

tpt_status tpt_cfft_f64 ( f64_t aInPlace,
size_t  aLogN,
bool  aIfftFlag 
)

Processing function for the floating-point complex FFT.

Parameters
[in,out]aInPlacepoints to the complex data buffer of size 2 * fftLen. Processing occurs in-place.
[in]aLogNThe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Parameters
[in,out]aInPlacepoints to the complex data buffer of size. 2 * fftLen. Processing occurs in-place.
[in]aLogNthe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status

◆ tpt_cfft_q15()

tpt_status tpt_cfft_q15 ( q15_t aInPlace,
size_t  aLogN,
bool  aIfftFlag 
)

Processing function for the Q15 complex FFT.

Processing function for the Q31 complex FFT.

Parameters
[in,out]aInPlacepoints to the complex data buffer of size 2 * fftLen. Processing occurs in-place.
[in]aLogNThe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Input and output formats:
Internally input is downscaled for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different FFT sizes. The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
Input and Output Formats for Q15 CFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.15 5.11 4
5 32 1.15 6.10 5
6 64 1.15 7.9 6
7 128 1.15 8.8 7
8 256 1.15 9.7 8
9 512 1.15 10.6 9
10 1024 1.15 11.5 10
......
Input and Output Formats for Q15 CIFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.15 5.11 0
5 32 1.15 6.10 0
6 64 1.15 7.9 0
7 128 1.15 8.8 0
8 256 1.15 9.7 0
9 512 1.15 10.6 0
10 1024 1.15 11.5 0
......
Parameters
[in,out]aInPlacepoints to the complex data buffer of size. 2 * fftLen. Processing occurs
[in]aLogNthe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Input and output formats:
Internally input is downscaled for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different FFT sizes. The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
Input and Output Formats for Q31 CFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 4
5 32 1.31 6.26 5
6 64 1.31 7.25 6
7 128 1.31 8.24 7
8 256 1.31 9.23 8
9 512 1.31 10.22 9
10 1024 1.31 11.21 10
......
Input and Output Formats for Q31 CIFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 0
5 32 1.31 6.26 0
6 64 1.31 7.25 0
7 128 1.31 8.24 0
8 256 1.31 9.23 0
9 512 1.31 10.22 0
10 1024 1.31 11.21 0
......

◆ tpt_cfft_q31()

tpt_status tpt_cfft_q31 ( q31_t aInPlace,
size_t  aLogN,
bool  aIfftFlag 
)

Processing function for the Q31 complex FFT.

Parameters
[in,out]aInPlacepoints to the complex data buffer of size 2 * fftLen. Processing occurs in-place.
[in]aLogNThe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Input and output formats:
Internally input is downscaled for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different FFT sizes. The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
Input and Output Formats for Q31 CFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 4
5 32 1.31 6.26 5
6 64 1.31 7.25 6
7 128 1.31 8.24 7
8 256 1.31 9.23 8
9 512 1.31 10.22 9
10 1024 1.31 11.21 10
......
Input and Output Formats for Q31 CIFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 0
5 32 1.31 6.26 0
6 64 1.31 7.25 0
7 128 1.31 8.24 0
8 256 1.31 9.23 0
9 512 1.31 10.22 0
10 1024 1.31 11.21 0
......
Parameters
[in,out]aInPlacepoints to the complex data buffer of size. 2 * fftLen. Processing occurs
[in]aLogNthe fftLen is 2^aLogN.
[in]aIfftFlagflag that selects transform direction
  • value = false: forward transform
  • value = true : inverse transform
Returns
execution status
Input and output formats:
Internally input is downscaled for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different FFT sizes. The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
Input and Output Formats for Q31 CFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 4
5 32 1.31 6.26 5
6 64 1.31 7.25 6
7 128 1.31 8.24 7
8 256 1.31 9.23 8
9 512 1.31 10.22 9
10 1024 1.31 11.21 10
......
Input and Output Formats for Q31 CIFFT
aLogNCFFT SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 0
5 32 1.31 6.26 0
6 64 1.31 7.25 0
7 128 1.31 8.24 0
8 256 1.31 9.23 0
9 512 1.31 10.22 0
10 1024 1.31 11.21 0
......