Functions for performing forward and inverse FFT of complex 16-bit and 32-bit input data.
Complex forward FFT function with auto-scaling.
- Details
- Computes the forward discreet Fourier transform (DFT) of 16-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. The output is monitored for overflow and scaled by a factor of two when an overflow risk is detected. The shift parameter contains the number of bit shifts that were applied to the output.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*4 bytes. For example, a 256 point real FFT must be aligned to a 1024 byte address in shared LEA memory.
- Pseudo code
y = fft(x) * 2^-shift
- Scaling
- Scaling is applied as needed to prevent saturation of the output. The scale factor that was applied to the output is returned in the shift parameter and can be used to calculate the result by applying the following function.
result = result * 2^shift
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
shift | Auto-scaling shift that was applied to the output. |
- Returns
- Status of the operation.
Complex forward FFT function with fixed scaling by two at each stage.
- Details
- Computes the forward discreet Fourier transform (DFT) of 16-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. The output is scaled by a factor of two for each stage of the DFT.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*4 bytes. For example, a 256 point real FFT must be aligned to a 1024 byte address in shared LEA memory.
- Pseudo code
y = fft(x) ./ N
- Scaling
- Each stage of the complex FFT scales the result by a factor of 0.5. The output format can either be interpreted as the same type with (1/N) scaling or a different fixed point data type. This can be helpful when using the IQmathLib to process the results of the FFT, such as computing the magnitude or phase angle of the complex result.
-
Length | Input Type | Result Type |
16 | _q15 | _q11 |
32 | _q15 | _q10 |
64 | _q15 | _q9 |
128 | _q15 | _q8 |
256 | _q15 | _q7 |
512 | _q15 | _q6 |
1024 | _q15 | _q5 |
2048 | _q15 | _q4 |
4096 | _q15 | _q3 |
- The following table lists the applied scaling factor and resulting data type when the input is a 16-bit integer.
-
Length | Input Type | Result Type |
16 | int16_t | (int16_t)(result / 16) |
32 | int16_t | (int16_t)(result / 32) |
64 | int16_t | (int16_t)(result / 64) |
128 | int16_t | (int16_t)(result / 128) |
256 | int16_t | (int16_t)(result / 256) |
512 | int16_t | (int16_t)(result / 512) |
1024 | int16_t | (int16_t)(result / 1024) |
2048 | int16_t | (int16_t)(result / 2048) |
4096 | int16_t | (int16_t)(result / 4096) |
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
- Returns
- Status of the operation.
Complex forward FFT function without scaling.
- Details
- Computes the forward discreet Fourier transform (DFT) of 32-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. The output is not scaled.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*8 bytes. For example, a 256 point real FFT must be aligned to a 2048 byte address in shared LEA memory.
- Pseudo code
y = fft(x)
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
- Returns
- Status of the operation.
Complex inverse FFT function with auto-scaling.
- Details
- Computes the inverse discreet Fourier transform (DFT) of 16-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. The output is monitored for overflow and scaled by a factor of two when an overflow risk is detected. Automatic scaling is performed such that this is the direct inverse of the forward FFT with auto scaling.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*4 bytes. For example, a 256 point real FFT must be aligned to a 1024 byte address in shared LEA memory.
- Pseudo code
y = (ifft(x) * 2^shift) ./ N
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
shift | Auto-scaling shift that was applied to the output. |
- Returns
- Status of the operation.
Complex inverse FFT function with fixed scaling by two at each stage.
- Details
- Computes the inverse discreet Fourier transform (DFT) of 16-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. Fixed scaling is performed such that this is the direct inverse of the forward FFT with fixed scaling.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*4 bytes. For example, a 256 point real FFT must be aligned to a 1024 byte address in shared LEA memory.
- Pseudo code
y = ifft(x)
- Scaling
- This function is the direct inverse of the forward complex FFT with fixed scaling. The following fixed point input types will all result in Q15 results.
-
Length | Input Type | Result Type |
16 | _q11 | _q15 |
32 | _q10 | _q15 |
64 | _q9 | _q15 |
128 | _q8 | _q15 |
256 | _q7 | _q15 |
512 | _q6 | _q15 |
1024 | _q5 | _q15 |
2048 | _q4 | _q15 |
4096 | _q3 | _q15 |
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
- Returns
- Status of the operation.
Complex inverse FFT function without scaling.
- Details
- Computes the inverse discreet Fourier transform (DFT) of 32-bit complex inputs. If the inputs are not already in bit reversed order the bit reversal parameter must be set. Fixed scaling is performed such that this is the direct inverse of the forward FFT without scaling.
- When using LEASC the twiddle table pointer can be set to NULL (zero) and the source data must be aligned to LENGTH*8 bytes. For example, a 256 point real FFT must be aligned to a 2048 byte address in shared LEA memory.
- Pseudo code
y = ifft(x) ./ N
- Parameters
-
params | Pointer to the complex FFT parameter structure. |
src | Pointer to the complex data array to perform the FFT on. |
- Returns
- Status of the operation.