| CMSIS-DSP Verison 1.1.0 CMSIS DSP Software Library

- CMSIS
- CORE
- DSP
- RTOS API
- SVD

- Main Page
- Reference

Functions
Radix-2 Complex FFT Functions
Transform Functions

## Functions
void | arm_cfft_radix2_f32 (const arm_cfft_radix2_instance_f32 *S, float32_t *pSrc)
| Processing function for the floating-point Radix-2 CFFT/CIFFT.
arm_status | arm_cfft_radix2_init_f32 (arm_cfft_radix2_instance_f32 *S, uint16_t fftLen, uint8_t ifftFlag, uint8_t bitReverseFlag)
| Initialization function for the floating-point CFFT/CIFFT.
arm_status | arm_cfft_radix2_init_q15 (arm_cfft_radix2_instance_q15 *S, uint16_t fftLen, uint8_t ifftFlag, uint8_t bitReverseFlag)
| Initialization function for the Q15 CFFT/CIFFT.
arm_status | arm_cfft_radix2_init_q31 (arm_cfft_radix2_instance_q31 *S, uint16_t fftLen, uint8_t ifftFlag, uint8_t bitReverseFlag)
| Initialization function for the Q31 CFFT/CIFFT.
void | arm_cfft_radix2_q15 (const arm_cfft_radix2_instance_q15 *S, q15_t *pSrc)
| Processing function for the fixed-point CFFT/CIFFT.
void | arm_cfft_radix2_q31 (const arm_cfft_radix2_instance_q31 *S, q31_t *pSrc)
| Processing function for the fixed-point CFFT/CIFFT.

## Description

  Complex Fast Fourier Transform(CFFT) and Complex Inverse Fast Fourier Transform(CIFFT) is an efficient algorithm to compute Discrete Fourier Transform(DFT) and Inverse Discrete Fourier Transform(IDFT). Computational complexity of CFFT reduces drastically when compared to DFT.

  This set of functions implements CFFT/CIFFT for Q15, Q31, and floating-point data types. The functions operates on in-place buffer which uses same buffer for input and output. Complex input is stored in input buffer in an interleaved fashion.

  The functions operate on blocks of input and output data and each call to the function processes `2*fftLen` samples through the transform. `pSrc` points to In-place arrays containing `2*fftLen` values.

  The `pSrc` points to the array of in-place buffer of size `2*fftLen` and inputs and outputs are stored in an interleaved fashion as shown below.

       {real[0], imag[0], real[1], imag[1],..}

Lengths supported by the transform:

  Internally, the function utilize a radix-2 decimation in frequency(DIF) algorithm and the size of the FFT supported are of the lengths [16, 32, 64, 128, 256, 512, 1024, 2048, 4096].

Algorithm:

Complex Fast Fourier Transform:

  Input real and imaginary data:

       x(n) = xa + j * ya
       x(n+N/2 ) = xb + j * yb

  where N is length of FFT

  Output real and imaginary data:

       X(2r) = xa'+ j * ya'
       X(2r+1) = xb'+ j * yb'

  Twiddle factors for radix-2 FFT:

       Wn = cosVal + j * (- sinVal)

  Radix-2 Decimation-in Frequency Complex Fast Fourier Transform

  Output from Radix-2 CFFT Results in Digit reversal order. Interchange middle two branches of every butterfly results in Bit reversed output.

  Butterfly CFFT equations:

       xa' = xa + xb
       ya' = ya + yb
       xb' = (xa-xb)* cosVal + (ya-yb) * sinVal
       yb' = (ya-yb)* cosVal - (xa-xb) * sinVal

Complex Inverse Fast Fourier Transform:

  CIFFT uses same twiddle factor table as CFFT with modifications in the design equation as shown below.

  Modified Butterfly CIFFT equations:

       xa' = xa + xb
       ya' = ya + yb
       xb' = (xa-xb)* cosVal - (ya-yb) * sinVal
       yb' = (ya-yb)* cosVal + (xa-xb) * sinVal

Instance Structure
  A separate instance structure must be defined for each Instance but the twiddle factors and bit reversal tables can be reused. There are separate instance structure declarations for each of the 3 supported data types.

Initialization Functions
  There is also an associated initialization function for each data type. The initialization function performs the following operations:
  - Sets the values of the internal structure fields.
  - Initializes twiddle factor table and bit reversal table pointers

  Use of the initialization function is optional. However, if the initialization function is used, then the instance structure cannot be placed into a const data section. To place an instance structure into a const data section, the instance structure must be manually initialized. Manually initialize the instance structure as follows:

      arm_cfft_radix2_instance_f32 S = {fftLen, ifftFlag, bitReverseFlag, pTwiddle, pBitRevTable, twidCoefModifier, bitRevFactor, onebyfftLen};
      arm_cfft_radix2_instance_q31 S = {fftLen, ifftFlag, bitReverseFlag, pTwiddle, pBitRevTable, twidCoefModifier, bitRevFactor};
      arm_cfft_radix2_instance_q15 S = {fftLen, ifftFlag, bitReverseFlag, pTwiddle, pBitRevTable, twidCoefModifier, bitRevFactor};

  where `fftLen` length of CFFT/CIFFT; `ifftFlag` Flag for selection of CFFT or CIFFT(Set ifftFlag to calculate CIFFT otherwise calculates CFFT); `bitReverseFlag` Flag for selection of output order(Set bitReverseFlag to output in normal order otherwise output in bit reversed order); `pTwiddle`points to array of twiddle coefficients; `pBitRevTable` points to the array of bit reversal table. `twidCoefModifier` modifier for twiddle factor table which supports all FFT lengths with same table; `pBitRevTable` modifier for bit reversal table which supports all FFT lengths with same table. `onebyfftLen` value of 1/fftLen to calculate CIFFT;

Fixed-Point Behavior
  Care must be taken when using the fixed-point versions of the CFFT/CIFFT function. Refer to the function specific documentation below for usage guidelines.

  Complex Fast Fourier Transform(CFFT) and Complex Inverse Fast Fourier Transform(CIFFT) is an efficient algorithm to compute Discrete Fourier Transform(DFT) and Inverse Discrete Fourier Transform(IDFT). Computational complexity of CFFT reduces drastically when compared to DFT.

## Function Documentation

void arm_cfft_radix2_f32 | ( | const arm_cfft_radix2_instance_f32 * | S,
|  | float32_t * | pSrc
| ) |  |

Processing function for the floating-point CFFT/CIFFT.

Parameters:

  [in] | *S | points to an instance of the floating-point Radix-2 CFFT/CIFFT structure.
  [in,out] | *pSrc | points to the complex data buffer of size `2*fftLen`. Processing occurs in-place.

Returns:
  none.

References arm_bitreversal_f32(), arm_radix2_butterfly_f32(), arm_radix2_butterfly_inverse_f32(), arm_cfft_radix2_instance_f32::bitReverseFlag, arm_cfft_radix2_instance_f32::bitRevFactor, arm_cfft_radix2_instance_f32::fftLen, arm_cfft_radix2_instance_f32::ifftFlag, arm_cfft_radix2_instance_f32::onebyfftLen, arm_cfft_radix2_instance_f32::pBitRevTable, arm_cfft_radix2_instance_f32::pTwiddle, and arm_cfft_radix2_instance_f32::twidCoefModifier.

arm_status arm_cfft_radix2_init_f32 | ( | arm_cfft_radix2_instance_f32 * | S,
|  | uint16_t | fftLen,
|  | uint8_t | ifftFlag,
|  | uint8_t | bitReverseFlag
| ) |  |

Parameters:

  [in,out] | *S | points to an instance of the floating-point CFFT/CIFFT structure.
  [in] | fftLen | length of the FFT.
  [in] | ifftFlag | flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  [in] | bitReverseFlag | flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.

Returns:
  The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if `fftLen` is not a supported value.

Description:

  The parameter `ifftFlag` controls whether a forward or inverse transform is computed. Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated

  The parameter `bitReverseFlag` controls whether output is in normal order or bit reversed order. Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.

  The parameter `fftLen` Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.

  This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.

References ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, armBitRevTable, arm_cfft_radix2_instance_f32::bitReverseFlag, arm_cfft_radix2_instance_f32::bitRevFactor, arm_cfft_radix2_instance_f32::fftLen, ifftFlag, arm_cfft_radix2_instance_f32::ifftFlag, arm_cfft_radix2_instance_f32::onebyfftLen, arm_cfft_radix2_instance_f32::pBitRevTable, arm_cfft_radix2_instance_f32::pTwiddle, status, arm_cfft_radix2_instance_f32::twidCoefModifier, and twiddleCoef.

arm_status arm_cfft_radix2_init_q15 | ( | arm_cfft_radix2_instance_q15 * | S,
|  | uint16_t | fftLen,
|  | uint8_t | ifftFlag,
|  | uint8_t | bitReverseFlag
| ) |  |

Parameters:

  [in,out] | *S | points to an instance of the Q15 CFFT/CIFFT structure.
  [in] | fftLen | length of the FFT.
  [in] | ifftFlag | flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  [in] | bitReverseFlag | flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.

Returns:
  The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if `fftLen` is not a supported value.

Description:

  The parameter `ifftFlag` controls whether a forward or inverse transform is computed. Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated

  The parameter `bitReverseFlag` controls whether output is in normal order or bit reversed order. Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.

  The parameter `fftLen` Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.

  This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.

References ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, armBitRevTable, arm_cfft_radix2_instance_q15::bitReverseFlag, arm_cfft_radix2_instance_q15::bitRevFactor, arm_cfft_radix2_instance_q15::fftLen, ifftFlag, arm_cfft_radix2_instance_q15::ifftFlag, arm_cfft_radix2_instance_q15::pBitRevTable, arm_cfft_radix2_instance_q15::pTwiddle, status, arm_cfft_radix2_instance_q15::twidCoefModifier, and twiddleCoefQ15.

arm_status arm_cfft_radix2_init_q31 | ( | arm_cfft_radix2_instance_q31 * | S,
|  | uint16_t | fftLen,
|  | uint8_t | ifftFlag,
|  | uint8_t | bitReverseFlag
| ) |  |

Initialization function for the Radix-2 Q31 CFFT/CIFFT.

Parameters:

  [in,out] | *S | points to an instance of the Q31 CFFT/CIFFT structure.
  [in] | fftLen | length of the FFT.
  [in] | ifftFlag | flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  [in] | bitReverseFlag | flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.

Returns:
  The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if `fftLen` is not a supported value.

Description:

  The parameter `ifftFlag` controls whether a forward or inverse transform is computed. Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated

  The parameter `bitReverseFlag` controls whether output is in normal order or bit reversed order. Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.

  The parameter `fftLen` Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.

  This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.

References ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, armBitRevTable, arm_cfft_radix2_instance_q31::bitReverseFlag, arm_cfft_radix2_instance_q31::bitRevFactor, arm_cfft_radix2_instance_q31::fftLen, ifftFlag, arm_cfft_radix2_instance_q31::ifftFlag, arm_cfft_radix2_instance_q31::pBitRevTable, arm_cfft_radix2_instance_q31::pTwiddle, status, arm_cfft_radix2_instance_q31::twidCoefModifier, and twiddleCoefQ31.

void arm_cfft_radix2_q15 | ( | const arm_cfft_radix2_instance_q15 * | S,
|  | q15_t * | pSrc
| ) |  |

Processing function for the Q15 CFFT/CIFFT.

Parameters:

  [in] | *S | points to an instance of the fixed-point CFFT/CIFFT structure.
  [in,out] | *pSrc | points to the complex data buffer of size `2*fftLen`. Processing occurs in-place.

Returns:
  none.

References arm_bitreversal_q15(), arm_radix2_butterfly_inverse_q15(), arm_radix2_butterfly_q15(), arm_cfft_radix2_instance_q15::bitRevFactor, arm_cfft_radix2_instance_q15::fftLen, arm_cfft_radix2_instance_q15::ifftFlag, arm_cfft_radix2_instance_q15::pBitRevTable, arm_cfft_radix2_instance_q15::pTwiddle, and arm_cfft_radix2_instance_q15::twidCoefModifier.

void arm_cfft_radix2_q31 | ( | const arm_cfft_radix2_instance_q31 * | S,
|  | q31_t * | pSrc
| ) |  |

Processing function for the Radix-2 Q31 CFFT/CIFFT.

Parameters:

  [in] | *S | points to an instance of the fixed-point CFFT/CIFFT structure.
  [in,out] | *pSrc | points to the complex data buffer of size `2*fftLen`. Processing occurs in-place.

Returns:
  none.

References arm_bitreversal_q31(), arm_radix2_butterfly_inverse_q31(), arm_radix2_butterfly_q31(), arm_cfft_radix2_instance_q31::bitRevFactor, arm_cfft_radix2_instance_q31::fftLen, arm_cfft_radix2_instance_q31::ifftFlag, arm_cfft_radix2_instance_q31::pBitRevTable, arm_cfft_radix2_instance_q31::pTwiddle, and arm_cfft_radix2_instance_q31::twidCoefModifier.