CMSIS-DSP: RealFFT

| CMSIS-DSP Version 1.4.7 CMSIS DSP Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
RealFFT
Transform Functions

## Functions

void | arm_rfft_f32 (const arm_rfft_instance_f32 *S, float32_t *pSrc, float32_t *pDst)
| Processing function for the floating-point RFFT/RIFFT.
void | arm_rfft_fast_f32 (arm_rfft_fast_instance_f32 *S, float32_t *p, float32_t *pOut, uint8_t ifftFlag)
| Processing function for the floating-point real FFT.
arm_status | arm_rfft_fast_init_f32 (arm_rfft_fast_instance_f32 *S, uint16_t fftLen)
| Initialization function for the floating-point real FFT.
arm_status | arm_rfft_init_f32 (arm_rfft_instance_f32 *S, arm_cfft_radix4_instance_f32 *S_CFFT, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag)
| Initialization function for the floating-point RFFT/RIFFT.
arm_status | arm_rfft_init_q15 (arm_rfft_instance_q15 *S, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag)
| Initialization function for the Q15 RFFT/RIFFT.
arm_status | arm_rfft_init_q31 (arm_rfft_instance_q31 *S, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag)
| Initialization function for the Q31 RFFT/RIFFT.
void | arm_rfft_q15 (const arm_rfft_instance_q15 *S, q15_t *pSrc, q15_t *pDst)
| Processing function for the Q15 RFFT/RIFFT.
void | arm_rfft_q31 (const arm_rfft_instance_q31 *S, q31_t *pSrc, q31_t *pDst)
| Processing function for the Q31 RFFT/RIFFT.

## Variables

static const float32_t | realCoefA [8192]
static const float32_t | realCoefB [8192]
static const q15_t ALIGN4 | realCoefAQ15 [8192]
static const q15_t ALIGN4 | realCoefBQ15 [8192]
static const q31_t | realCoefAQ31 [8192]
static const q31_t | realCoefBQ31 [8192]

## Description

## Function Documentation

void arm_rfft_f32 | ( | const arm_rfft_instance_f32 * | S,
|  | float32_t * | pSrc,
|  | float32_t * | pDst
| ) |  |

Deprecated:
  Do not use this function. It has been superceded by arm_rfft_fast_f32 and will be removed in the future.

Parameters

  [in] | *S | points to an instance of the floating-point RFFT/RIFFT structure.
  [in] | *pSrc | points to the input buffer.
  [out] | *pDst | points to the output buffer.

Returns
  none.

References arm_bitreversal_f32(), arm_radix4_butterfly_f32(), arm_radix4_butterfly_inverse_f32(), arm_split_rfft_f32(), arm_split_rifft_f32(), arm_rfft_instance_f32::bitReverseFlagR, arm_cfft_radix4_instance_f32::bitRevFactor, arm_cfft_radix4_instance_f32::fftLen, arm_rfft_instance_f32::fftLenBy2, arm_rfft_instance_f32::ifftFlagR, arm_cfft_radix4_instance_f32::onebyfftLen, arm_cfft_radix4_instance_f32::pBitRevTable, arm_rfft_instance_f32::pCfft, arm_cfft_radix4_instance_f32::pTwiddle, arm_rfft_instance_f32::pTwiddleAReal, arm_rfft_instance_f32::pTwiddleBReal, arm_cfft_radix4_instance_f32::twidCoefModifier, and arm_rfft_instance_f32::twidCoefRModifier.

void arm_rfft_fast_f32 | ( | arm_rfft_fast_instance_f32 * | S,
|  | float32_t * | p,
|  | float32_t * | pOut,
|  | uint8_t | ifftFlag
| ) |  |

Parameters

  [in] | *S | points to an arm_rfft_fast_instance_f32 structure.
  [in] | *p | points to the input buffer.
  [in] | *pOut | points to the output buffer.
  [in] | ifftFlag | RFFT if flag is 0, RIFFT if flag is 1

Returns
  none.

References arm_cfft_f32(), arm_cfft_instance_f32::fftLen, arm_rfft_fast_instance_f32::fftLenRFFT, merge_rfft_f32(), arm_rfft_fast_instance_f32::Sint, and stage_rfft_f32().

arm_status arm_rfft_fast_init_f32 | ( | arm_rfft_fast_instance_f32 * | S,
|  | uint16_t | fftLen
| ) |  |

Parameters

  [in,out] | *S | points to an arm_rfft_fast_instance_f32 structure.
  [in] | fftLen | length of the Real Sequence.

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 `fftLen` Specifies length of RFFT/CIFFT process. Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096.

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

References ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, armBitRevIndexTable1024, ARMBITREVINDEXTABLE1024_TABLE_LENGTH, armBitRevIndexTable128, armBitRevIndexTable16, armBitRevIndexTable2048, ARMBITREVINDEXTABLE2048_TABLE_LENGTH, armBitRevIndexTable256, armBitRevIndexTable32, armBitRevIndexTable512, armBitRevIndexTable64, ARMBITREVINDEXTABLE_128_TABLE_LENGTH, ARMBITREVINDEXTABLE_256_TABLE_LENGTH, ARMBITREVINDEXTABLE_512_TABLE_LENGTH, ARMBITREVINDEXTABLE__16_TABLE_LENGTH, ARMBITREVINDEXTABLE__32_TABLE_LENGTH, ARMBITREVINDEXTABLE__64_TABLE_LENGTH, arm_cfft_instance_f32::bitRevLength, arm_cfft_instance_f32::fftLen, arm_rfft_fast_instance_f32::fftLenRFFT, arm_cfft_instance_f32::pBitRevTable, arm_cfft_instance_f32::pTwiddle, arm_rfft_fast_instance_f32::pTwiddleRFFT, arm_rfft_fast_instance_f32::Sint, status, twiddleCoef_1024, twiddleCoef_128, twiddleCoef_16, twiddleCoef_2048, twiddleCoef_256, twiddleCoef_32, twiddleCoef_512, twiddleCoef_64, twiddleCoef_rfft_1024, twiddleCoef_rfft_128, twiddleCoef_rfft_2048, twiddleCoef_rfft_256, twiddleCoef_rfft_32, twiddleCoef_rfft_4096, twiddleCoef_rfft_512, and twiddleCoef_rfft_64.

arm_status arm_rfft_init_f32 | ( | arm_rfft_instance_f32 * | S,
|  | arm_cfft_radix4_instance_f32 * | S_CFFT,
|  | uint32_t | fftLenReal,
|  | uint32_t | ifftFlagR,
|  | uint32_t | bitReverseFlag
| ) |  |

Deprecated:
  Do not use this function. It has been superceded by arm_rfft_fast_init_f32 and will be removed in the future.

Parameters

  [in,out] | *S | points to an instance of the floating-point RFFT/RIFFT structure.
  [in,out] | *S_CFFT | points to an instance of the floating-point CFFT/CIFFT structure.
  [in] | fftLenReal | length of the FFT.
  [in] | ifftFlagR | flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=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 `fftLenReal` is not a supported value.

Description:

  The parameter `fftLenReal` Specifies length of RFFT/RIFFT Process. Supported FFT Lengths are 128, 512, 2048.

  The parameter `ifftFlagR` controls whether a forward or inverse transform is computed. Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT 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.

  This function also initializes Twiddle factor table.

References arm_cfft_radix4_init_f32(), ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, arm_rfft_instance_f32::bitReverseFlagR, arm_rfft_instance_f32::fftLenBy2, arm_rfft_instance_f32::fftLenReal, arm_rfft_instance_f32::ifftFlagR, arm_rfft_instance_f32::pCfft, arm_rfft_instance_f32::pTwiddleAReal, arm_rfft_instance_f32::pTwiddleBReal, realCoefA, realCoefB, status, and arm_rfft_instance_f32::twidCoefRModifier.

Referenced by arm_dct4_init_f32().

arm_status arm_rfft_init_q15 | ( | arm_rfft_instance_q15 * | S,
|  | uint32_t | fftLenReal,
|  | uint32_t | ifftFlagR,
|  | uint32_t | bitReverseFlag
| ) |  |

Parameters

  [in,out] | *S | points to an instance of the Q15 RFFT/RIFFT structure.
  [in] | fftLenReal | length of the FFT.
  [in] | ifftFlagR | flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=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 `fftLenReal` is not a supported value.

Description:

  The parameter `fftLenReal` Specifies length of RFFT/RIFFT Process. Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

  The parameter `ifftFlagR` controls whether a forward or inverse transform is computed. Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT 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.

  This function also initializes Twiddle factor table.

References arm_cfft_sR_q15_len1024, arm_cfft_sR_q15_len128, arm_cfft_sR_q15_len16, arm_cfft_sR_q15_len2048, arm_cfft_sR_q15_len256, arm_cfft_sR_q15_len32, arm_cfft_sR_q15_len4096, arm_cfft_sR_q15_len512, arm_cfft_sR_q15_len64, ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, arm_rfft_instance_q15::bitReverseFlagR, arm_rfft_instance_q15::fftLenReal, arm_rfft_instance_q15::ifftFlagR, arm_rfft_instance_q15::pCfft, arm_rfft_instance_q15::pTwiddleAReal, arm_rfft_instance_q15::pTwiddleBReal, realCoefAQ15, realCoefBQ15, status, and arm_rfft_instance_q15::twidCoefRModifier.

Referenced by arm_dct4_init_q15().

arm_status arm_rfft_init_q31 | ( | arm_rfft_instance_q31 * | S,
|  | uint32_t | fftLenReal,
|  | uint32_t | ifftFlagR,
|  | uint32_t | bitReverseFlag
| ) |  |

Parameters

  [in,out] | *S | points to an instance of the Q31 RFFT/RIFFT structure.
  [in] | fftLenReal | length of the FFT.
  [in] | ifftFlagR | flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=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 `fftLenReal` is not a supported value.

Description:

  The parameter `fftLenReal` Specifies length of RFFT/RIFFT Process. Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

  The parameter `ifftFlagR` controls whether a forward or inverse transform is computed. Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT 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.

7
  This function also initializes Twiddle factor table.

References arm_cfft_sR_q31_len1024, arm_cfft_sR_q31_len128, arm_cfft_sR_q31_len16, arm_cfft_sR_q31_len2048, arm_cfft_sR_q31_len256, arm_cfft_sR_q31_len32, arm_cfft_sR_q31_len4096, arm_cfft_sR_q31_len512, arm_cfft_sR_q31_len64, ARM_MATH_ARGUMENT_ERROR, ARM_MATH_SUCCESS, arm_rfft_instance_q31::bitReverseFlagR, arm_rfft_instance_q31::fftLenReal, arm_rfft_instance_q31::ifftFlagR, arm_rfft_instance_q31::pCfft, arm_rfft_instance_q31::pTwiddleAReal, arm_rfft_instance_q31::pTwiddleBReal, realCoefAQ31, realCoefBQ31, status, and arm_rfft_instance_q31::twidCoefRModifier.

Referenced by arm_dct4_init_q31().

void arm_rfft_q15 | ( | const arm_rfft_instance_q15 * | S,
|  | q15_t * | pSrc,
|  | q15_t * | pDst
| ) |  |

Parameters

  [in] | *S | points to an instance of the Q15 RFFT/RIFFT structure.
  [in] | *pSrc | points to the input buffer.
  [out] | *pDst | points to the output buffer.

Returns
  none.

Input an output formats:

  Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different RFFT sizes. The input and output formats for different RFFT sizes and number of bits to upscale are mentioned in the tables below for RFFT and RIFFT:

  Input and Output Formats for Q15 RFFT

  Input and Output Formats for Q15 RIFFT

References arm_cfft_q15(), arm_split_rfft_q15(), arm_split_rifft_q15(), arm_rfft_instance_q15::bitReverseFlagR, arm_rfft_instance_q15::fftLenReal, arm_rfft_instance_q15::ifftFlagR, arm_rfft_instance_q15::pCfft, arm_rfft_instance_q15::pTwiddleAReal, arm_rfft_instance_q15::pTwiddleBReal, and arm_rfft_instance_q15::twidCoefRModifier.

void arm_rfft_q31 | ( | const arm_rfft_instance_q31 * | S,
|  | q31_t * | pSrc,
|  | q31_t * | pDst
| ) |  |

Parameters

  [in] | *S | points to an instance of the Q31 RFFT/RIFFT structure.
  [in] | *pSrc | points to the input buffer.
  [out] | *pDst | points to the output buffer.

Returns
  none.

Input an output formats:

  Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process. Hence the output format is different for different RFFT sizes. The input and output formats for different RFFT sizes and number of bits to upscale are mentioned in the tables below for RFFT and RIFFT:

  Input and Output Formats for Q31 RFFT

  Input and Output Formats for Q31 RIFFT

References arm_cfft_q31(), arm_split_rfft_q31(), arm_split_rifft_q31(), arm_rfft_instance_q31::bitReverseFlagR, arm_rfft_instance_q31::fftLenReal, arm_rfft_instance_q31::ifftFlagR, arm_rfft_instance_q31::pCfft, arm_rfft_instance_q31::pTwiddleAReal, arm_rfft_instance_q31::pTwiddleBReal, and arm_rfft_instance_q31::twidCoefRModifier.

Referenced by arm_dct4_q31().

## Variable Documentation

const float32_t realCoefA[8192]

static

  Generation of realCoefA array:

  n = 4096

      for (i = 0; i < n; i++)
       {
         pATable[2 * i] = 0.5 * (1.0 - sin (2 * PI / (double) (2 * n) * (double) i));
         pATable[2 * i + 1] = 0.5 * (-1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
       }

Referenced by arm_rfft_init_f32().

const q15_t ALIGN4 realCoefAQ15[8192]

static

  Generation fixed-point realCoefAQ15 array in Q15 format:

  n = 4096

      for (i = 0; i < n; i++)
       {
         pATable[2 * i] = 0.5 * (1.0 - sin (2 * PI / (double) (2 * n) * (double) i));
         pATable[2 * i + 1] = 0.5 * (-1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
       }

  Convert to fixed point Q15 format round(pATable[i] * pow(2, 15))

Referenced by arm_rfft_init_q15().

const q31_t realCoefAQ31[8192]

static

  Generation fixed-point realCoefAQ31 array in Q31 format:

  n = 4096

      for (i = 0; i < n; i++)
      {
         pATable[2 * i] = 0.5 * (1.0 - sin (2 * PI / (double) (2 * n) * (double) i));
         pATable[2 * i + 1] = 0.5 * (-1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
      }

  Convert to fixed point Q31 format round(pATable[i] * pow(2, 31))

Referenced by arm_rfft_init_q31().

const float32_t realCoefB[8192]

static

  Generation of realCoefB array:

  n = 4096

      for (i = 0; i < n; i++)
      {
         pBTable[2 * i] = 0.5 * (1.0 + sin (2 * PI / (double) (2 * n) * (double) i));
         pBTable[2 * i + 1] = 0.5 * (1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
       }

Referenced by arm_rfft_init_f32().

const q15_t ALIGN4 realCoefBQ15[8192]

static

  Generation of real_CoefB array:

  n = 4096

      for (i = 0; i < n; i++)
       {
         pBTable[2 * i] = 0.5 * (1.0 + sin (2 * PI / (double) (2 * n) * (double) i));
         pBTable[2 * i + 1] = 0.5 * (1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
       }

  Convert to fixed point Q15 format round(pBTable[i] * pow(2, 15))

Referenced by arm_rfft_init_q15().

const q31_t realCoefBQ31[8192]

static

  Generation of realCoefBQ31 array:

  n = 4096

      for (i = 0; i < n; i++)
      {
         pBTable[2 * i] = 0.5 * (1.0 + sin (2 * PI / (double) (2 * n) * (double) i));
         pBTable[2 * i + 1] = 0.5 * (1.0 * cos (2 * PI / (double) (2 * n) * (double) i));
      }

  Convert to fixed point Q31 format round(pBTable[i] * pow(2, 31))

Referenced by arm_rfft_init_q31().