Functions | Variables

# Real FFT Functions
[Transform Functions]

## Functions
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)
void | arm_rfft_f32 (const arm_rfft_instance_f32 *S, float32_t *pSrc, float32_t *pDst)
arm_status | arm_rfft_init_q31 (arm_rfft_instance_q31 *S, arm_cfft_radix4_instance_q31 *S_CFFT, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag)
void | arm_rfft_q31 (const arm_rfft_instance_q31 *S, q31_t *pSrc, q31_t *pDst)
arm_status | arm_rfft_init_q15 (arm_rfft_instance_q15 *S, arm_cfft_radix4_instance_q15 *S_CFFT, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag)
void | arm_rfft_q15 (const arm_rfft_instance_q15 *S, q15_t *pSrc, q15_t *pDst)
## Variables
static const float32_t | realCoefA [2048]
static const float32_t | realCoefB [2048]
const q31_t | realCoefAQ31 [1024]
const q31_t | realCoefBQ31 [1024]
static const q15_t | realCoefAQ15 [2048]
static const q15_t | realCoefBQ15 [2048]

## Detailed Description

  Complex FFT/IFFT typically assumes complex input and output. However many applications use real valued data in time domain. Real FFT/IFFT efficiently process real valued sequences with the advantage of requirement of low memory and with less complexity.

  This set of functions implements Real Fast Fourier Transforms(RFFT) and Real Inverse Fast Fourier Transform(RIFFT) for Q15, Q31, and floating-point data types.

Algorithm:

Real Fast Fourier Transform:

  Real FFT of N-point is calculated using CFFT of N/2-point and Split RFFT process as shown below figure.

  Real Fast Fourier Transform

  The RFFT functions operate on blocks of input and output data and each call to the function processes `fftLenR` samples through the transform. `pSrc` points to input array containing `fftLenR` values. `pDst` points to output array containing `2*fftLenR` values.
  Input for real FFT is in the order of

      {real[0], real[1], real[2], real[3], ..}

  Output for real FFT is complex and are in the order of

      {real(0), imag(0), real(1), imag(1), ...}

Real Inverse Fast Fourier Transform:

  Real IFFT of N-point is calculated using Split RIFFT process and CFFT of N/2-point as shown below figure.

  Real Inverse Fast Fourier Transform

  The RIFFT functions operate on blocks of input and output data and each call to the function processes `2*fftLenR` samples through the transform. `pSrc` points to input array containing `2*fftLenR` values. `pDst` points to output array containing `fftLenR` values.
  Input for real IFFT is complex and are in the order of

      {real(0), imag(0), real(1), imag(1), ...}

  Output for real IFFT is real and in the order of

      {real[0], real[1], real[2], real[3], ..}

Lengths supported by the transform:

  Real FFT/IFFT supports the lengths [128, 512, 2048], as it internally uses CFFT/CIFFT.

Instance Structure
  A separate instance structure must be defined for each Instance but the twiddle factors 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 tables.
  - Initializes CFFT data structure fields.

  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_rfft_instance_f32 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
      arm_rfft_instance_q31 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
      arm_rfft_instance_q15 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};

  where `fftLenReal` length of RFFT/RIFFT; `fftLenBy2` length of CFFT/CIFFT. `ifftFlagR` Flag for selection of RFFT or RIFFT(Set ifftFlagR to calculate RIFFT otherwise calculates RFFT); `bitReverseFlagR` Flag for selection of output order(Set bitReverseFlagR to output in normal order otherwise output in bit reversed order); `twidCoefRModifier` modifier for twiddle factor table which supports 128, 512, 2048 RFFT lengths with same table; `pTwiddleAReal`points to A array of twiddle coefficients; `pTwiddleBReal`points to B array of twiddle coefficients; `pCfft` points to the CFFT Instance structure. The CFFT structure also needs to be initialized, refer to arm_cfft_radix4_f32() for details regarding static initialization of cfft structure.

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

## Function Documentation

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.

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.

Definition at line 1638 of file arm_rfft_init_f32.c.

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

Processing function for the floating-point RFFT/RIFFT.

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.

Definition at line 150 of file arm_rfft_f32.c.

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

Initialization function for the Q31 RFFT/RIFFT.

Parameters:

  [in,out] | *S | points to an instance of the Q31 RFFT/RIFFT structure.
  [in,out] | *S_CFFT | points to an instance of the Q31 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.

Definition at line 617 of file arm_rfft_init_q31.c.

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

Processing function for the Q31 RFFT/RIFFT.

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

Definition at line 80 of file arm_rfft_q31.c.

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

Initialization function for the Q15 RFFT/RIFFT.

Parameters:

  [in,out] | *S | points to an instance of the Q15 RFFT/RIFFT structure.
  [in] | *S_CFFT | points to an instance of the Q15 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.

Definition at line 620 of file arm_rfft_init_q15.c.

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

Processing function for the Q15 RFFT/RIFFT.

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

Definition at line 80 of file arm_rfft_q15.c.

## Variable Documentation

const float32_t realCoefA[2048]`[static]`

  Generation of realCoefA array:

  n = 1024

      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));
        }

Definition at line 59 of file arm_rfft_init_f32.c.

const float32_t realCoefB[2048]`[static]`

  Generation of realCoefB array:

  n = 1024

      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));
        }

Definition at line 843 of file arm_rfft_init_f32.c.

const q31_t realCoefAQ31[1024]

  Generation floating point realCoefAQ31 array:

  n = 1024

      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))

Definition at line 60 of file arm_rfft_init_q31.c.

const q31_t realCoefBQ31[1024]

  Generation of realCoefBQ31 array:

  n = 512

      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))

Definition at line 336 of file arm_rfft_init_q31.c.

const q15_t realCoefAQ15[2048]`[static]`

  Generation floating point real_CoefA array:

  n = 1024

      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))

Definition at line 63 of file arm_rfft_init_q15.c.

const q15_t realCoefBQ15[2048]`[static]`

  Generation of real_CoefB array:

  n = 1024

      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))

Definition at line 339 of file arm_rfft_init_q15.c.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines