V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Committer:
emh203
Date:
Mon Jul 28 15:03:15 2014 +0000
Revision:
0:3d9c67d97d6f
1st working commit.   Had to remove arm_bitreversal2.s     arm_cfft_f32.c and arm_rfft_fast_f32.c.    The .s will not assemble.      For now I removed these functions so we could at least have a library for the other functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:3d9c67d97d6f 1 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 3 *
emh203 0:3d9c67d97d6f 4 * $Date: 12. March 2014
emh203 0:3d9c67d97d6f 5 * $Revision: V1.4.3
emh203 0:3d9c67d97d6f 6 *
emh203 0:3d9c67d97d6f 7 * Project: CMSIS DSP Library
emh203 0:3d9c67d97d6f 8 * Title: arm_rfft_q31.c
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: RFFT & RIFFT Q31 process function
emh203 0:3d9c67d97d6f 11 *
emh203 0:3d9c67d97d6f 12 *
emh203 0:3d9c67d97d6f 13 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emh203 0:3d9c67d97d6f 14 *
emh203 0:3d9c67d97d6f 15 * Redistribution and use in source and binary forms, with or without
emh203 0:3d9c67d97d6f 16 * modification, are permitted provided that the following conditions
emh203 0:3d9c67d97d6f 17 * are met:
emh203 0:3d9c67d97d6f 18 * - Redistributions of source code must retain the above copyright
emh203 0:3d9c67d97d6f 19 * notice, this list of conditions and the following disclaimer.
emh203 0:3d9c67d97d6f 20 * - Redistributions in binary form must reproduce the above copyright
emh203 0:3d9c67d97d6f 21 * notice, this list of conditions and the following disclaimer in
emh203 0:3d9c67d97d6f 22 * the documentation and/or other materials provided with the
emh203 0:3d9c67d97d6f 23 * distribution.
emh203 0:3d9c67d97d6f 24 * - Neither the name of ARM LIMITED nor the names of its contributors
emh203 0:3d9c67d97d6f 25 * may be used to endorse or promote products derived from this
emh203 0:3d9c67d97d6f 26 * software without specific prior written permission.
emh203 0:3d9c67d97d6f 27 *
emh203 0:3d9c67d97d6f 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
emh203 0:3d9c67d97d6f 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
emh203 0:3d9c67d97d6f 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
emh203 0:3d9c67d97d6f 31 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
emh203 0:3d9c67d97d6f 32 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
emh203 0:3d9c67d97d6f 33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
emh203 0:3d9c67d97d6f 34 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
emh203 0:3d9c67d97d6f 35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emh203 0:3d9c67d97d6f 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
emh203 0:3d9c67d97d6f 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
emh203 0:3d9c67d97d6f 38 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emh203 0:3d9c67d97d6f 39 * POSSIBILITY OF SUCH DAMAGE.
emh203 0:3d9c67d97d6f 40 * -------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 41
emh203 0:3d9c67d97d6f 42 #include "arm_math.h"
emh203 0:3d9c67d97d6f 43
emh203 0:3d9c67d97d6f 44 void arm_radix4_butterfly_inverse_q31(
emh203 0:3d9c67d97d6f 45 q31_t * pSrc,
emh203 0:3d9c67d97d6f 46 uint32_t fftLen,
emh203 0:3d9c67d97d6f 47 q31_t * pCoef,
emh203 0:3d9c67d97d6f 48 uint32_t twidCoefModifier);
emh203 0:3d9c67d97d6f 49
emh203 0:3d9c67d97d6f 50 void arm_radix4_butterfly_q31(
emh203 0:3d9c67d97d6f 51 q31_t * pSrc,
emh203 0:3d9c67d97d6f 52 uint32_t fftLen,
emh203 0:3d9c67d97d6f 53 q31_t * pCoef,
emh203 0:3d9c67d97d6f 54 uint32_t twidCoefModifier);
emh203 0:3d9c67d97d6f 55
emh203 0:3d9c67d97d6f 56 void arm_bitreversal_q31(
emh203 0:3d9c67d97d6f 57 q31_t * pSrc,
emh203 0:3d9c67d97d6f 58 uint32_t fftLen,
emh203 0:3d9c67d97d6f 59 uint16_t bitRevFactor,
emh203 0:3d9c67d97d6f 60 uint16_t * pBitRevTab);
emh203 0:3d9c67d97d6f 61
emh203 0:3d9c67d97d6f 62 /*--------------------------------------------------------------------
emh203 0:3d9c67d97d6f 63 * Internal functions prototypes
emh203 0:3d9c67d97d6f 64 --------------------------------------------------------------------*/
emh203 0:3d9c67d97d6f 65
emh203 0:3d9c67d97d6f 66 void arm_split_rfft_q31(
emh203 0:3d9c67d97d6f 67 q31_t * pSrc,
emh203 0:3d9c67d97d6f 68 uint32_t fftLen,
emh203 0:3d9c67d97d6f 69 q31_t * pATable,
emh203 0:3d9c67d97d6f 70 q31_t * pBTable,
emh203 0:3d9c67d97d6f 71 q31_t * pDst,
emh203 0:3d9c67d97d6f 72 uint32_t modifier);
emh203 0:3d9c67d97d6f 73
emh203 0:3d9c67d97d6f 74 void arm_split_rifft_q31(
emh203 0:3d9c67d97d6f 75 q31_t * pSrc,
emh203 0:3d9c67d97d6f 76 uint32_t fftLen,
emh203 0:3d9c67d97d6f 77 q31_t * pATable,
emh203 0:3d9c67d97d6f 78 q31_t * pBTable,
emh203 0:3d9c67d97d6f 79 q31_t * pDst,
emh203 0:3d9c67d97d6f 80 uint32_t modifier);
emh203 0:3d9c67d97d6f 81
emh203 0:3d9c67d97d6f 82 /**
emh203 0:3d9c67d97d6f 83 * @addtogroup RealFFT
emh203 0:3d9c67d97d6f 84 * @{
emh203 0:3d9c67d97d6f 85 */
emh203 0:3d9c67d97d6f 86
emh203 0:3d9c67d97d6f 87 /**
emh203 0:3d9c67d97d6f 88 * @brief Processing function for the Q31 RFFT/RIFFT.
emh203 0:3d9c67d97d6f 89 * @param[in] *S points to an instance of the Q31 RFFT/RIFFT structure.
emh203 0:3d9c67d97d6f 90 * @param[in] *pSrc points to the input buffer.
emh203 0:3d9c67d97d6f 91 * @param[out] *pDst points to the output buffer.
emh203 0:3d9c67d97d6f 92 * @return none.
emh203 0:3d9c67d97d6f 93 *
emh203 0:3d9c67d97d6f 94 * \par Input an output formats:
emh203 0:3d9c67d97d6f 95 * \par
emh203 0:3d9c67d97d6f 96 * Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process.
emh203 0:3d9c67d97d6f 97 * Hence the output format is different for different RFFT sizes.
emh203 0:3d9c67d97d6f 98 * 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:
emh203 0:3d9c67d97d6f 99 * \par
emh203 0:3d9c67d97d6f 100 * \image html RFFTQ31.gif "Input and Output Formats for Q31 RFFT"
emh203 0:3d9c67d97d6f 101 *
emh203 0:3d9c67d97d6f 102 * \par
emh203 0:3d9c67d97d6f 103 * \image html RIFFTQ31.gif "Input and Output Formats for Q31 RIFFT"
emh203 0:3d9c67d97d6f 104 */
emh203 0:3d9c67d97d6f 105
emh203 0:3d9c67d97d6f 106 void arm_rfft_q31(
emh203 0:3d9c67d97d6f 107 const arm_rfft_instance_q31 * S,
emh203 0:3d9c67d97d6f 108 q31_t * pSrc,
emh203 0:3d9c67d97d6f 109 q31_t * pDst)
emh203 0:3d9c67d97d6f 110 {
emh203 0:3d9c67d97d6f 111 const arm_cfft_radix4_instance_q31 *S_CFFT = S->pCfft;
emh203 0:3d9c67d97d6f 112 uint32_t i;
emh203 0:3d9c67d97d6f 113
emh203 0:3d9c67d97d6f 114 /* Calculation of RIFFT of input */
emh203 0:3d9c67d97d6f 115 if(S->ifftFlagR == 1u)
emh203 0:3d9c67d97d6f 116 {
emh203 0:3d9c67d97d6f 117 /* Real IFFT core process */
emh203 0:3d9c67d97d6f 118 arm_split_rifft_q31(pSrc, S->fftLenBy2, S->pTwiddleAReal,
emh203 0:3d9c67d97d6f 119 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
emh203 0:3d9c67d97d6f 120
emh203 0:3d9c67d97d6f 121 /* Complex readix-4 IFFT process */
emh203 0:3d9c67d97d6f 122 arm_radix4_butterfly_inverse_q31(pDst, S_CFFT->fftLen,
emh203 0:3d9c67d97d6f 123 S_CFFT->pTwiddle,
emh203 0:3d9c67d97d6f 124 S_CFFT->twidCoefModifier);
emh203 0:3d9c67d97d6f 125 /* Bit reversal process */
emh203 0:3d9c67d97d6f 126 if(S->bitReverseFlagR == 1u)
emh203 0:3d9c67d97d6f 127 {
emh203 0:3d9c67d97d6f 128 arm_bitreversal_q31(pDst, S_CFFT->fftLen,
emh203 0:3d9c67d97d6f 129 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
emh203 0:3d9c67d97d6f 130 }
emh203 0:3d9c67d97d6f 131
emh203 0:3d9c67d97d6f 132 for(i=0;i<S->fftLenReal;i++)
emh203 0:3d9c67d97d6f 133 {
emh203 0:3d9c67d97d6f 134 pDst[i] = pDst[i] << 1;
emh203 0:3d9c67d97d6f 135 }
emh203 0:3d9c67d97d6f 136 }
emh203 0:3d9c67d97d6f 137 else
emh203 0:3d9c67d97d6f 138 {
emh203 0:3d9c67d97d6f 139 /* Calculation of RFFT of input */
emh203 0:3d9c67d97d6f 140
emh203 0:3d9c67d97d6f 141 /* Complex readix-4 FFT process */
emh203 0:3d9c67d97d6f 142 arm_radix4_butterfly_q31(pSrc, S_CFFT->fftLen,
emh203 0:3d9c67d97d6f 143 S_CFFT->pTwiddle, S_CFFT->twidCoefModifier);
emh203 0:3d9c67d97d6f 144
emh203 0:3d9c67d97d6f 145 /* Bit reversal process */
emh203 0:3d9c67d97d6f 146 if(S->bitReverseFlagR == 1u)
emh203 0:3d9c67d97d6f 147 {
emh203 0:3d9c67d97d6f 148 arm_bitreversal_q31(pSrc, S_CFFT->fftLen,
emh203 0:3d9c67d97d6f 149 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
emh203 0:3d9c67d97d6f 150 }
emh203 0:3d9c67d97d6f 151
emh203 0:3d9c67d97d6f 152 /* Real FFT core process */
emh203 0:3d9c67d97d6f 153 arm_split_rfft_q31(pSrc, S->fftLenBy2, S->pTwiddleAReal,
emh203 0:3d9c67d97d6f 154 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
emh203 0:3d9c67d97d6f 155 }
emh203 0:3d9c67d97d6f 156
emh203 0:3d9c67d97d6f 157 }
emh203 0:3d9c67d97d6f 158
emh203 0:3d9c67d97d6f 159
emh203 0:3d9c67d97d6f 160 /**
emh203 0:3d9c67d97d6f 161 * @} end of RealFFT group
emh203 0:3d9c67d97d6f 162 */
emh203 0:3d9c67d97d6f 163
emh203 0:3d9c67d97d6f 164 /**
emh203 0:3d9c67d97d6f 165 * @brief Core Real FFT process
emh203 0:3d9c67d97d6f 166 * @param[in] *pSrc points to the input buffer.
emh203 0:3d9c67d97d6f 167 * @param[in] fftLen length of FFT.
emh203 0:3d9c67d97d6f 168 * @param[in] *pATable points to the twiddle Coef A buffer.
emh203 0:3d9c67d97d6f 169 * @param[in] *pBTable points to the twiddle Coef B buffer.
emh203 0:3d9c67d97d6f 170 * @param[out] *pDst points to the output buffer.
emh203 0:3d9c67d97d6f 171 * @param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
emh203 0:3d9c67d97d6f 172 * @return none.
emh203 0:3d9c67d97d6f 173 */
emh203 0:3d9c67d97d6f 174
emh203 0:3d9c67d97d6f 175 void arm_split_rfft_q31(
emh203 0:3d9c67d97d6f 176 q31_t * pSrc,
emh203 0:3d9c67d97d6f 177 uint32_t fftLen,
emh203 0:3d9c67d97d6f 178 q31_t * pATable,
emh203 0:3d9c67d97d6f 179 q31_t * pBTable,
emh203 0:3d9c67d97d6f 180 q31_t * pDst,
emh203 0:3d9c67d97d6f 181 uint32_t modifier)
emh203 0:3d9c67d97d6f 182 {
emh203 0:3d9c67d97d6f 183 uint32_t i; /* Loop Counter */
emh203 0:3d9c67d97d6f 184 q31_t outR, outI; /* Temporary variables for output */
emh203 0:3d9c67d97d6f 185 q31_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
emh203 0:3d9c67d97d6f 186 q31_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
emh203 0:3d9c67d97d6f 187 q31_t *pOut1 = &pDst[2], *pOut2 = &pDst[(4u * fftLen) - 1u];
emh203 0:3d9c67d97d6f 188 q31_t *pIn1 = &pSrc[2], *pIn2 = &pSrc[(2u * fftLen) - 1u];
emh203 0:3d9c67d97d6f 189
emh203 0:3d9c67d97d6f 190 /* Init coefficient pointers */
emh203 0:3d9c67d97d6f 191 pCoefA = &pATable[modifier * 2u];
emh203 0:3d9c67d97d6f 192 pCoefB = &pBTable[modifier * 2u];
emh203 0:3d9c67d97d6f 193
emh203 0:3d9c67d97d6f 194 i = fftLen - 1u;
emh203 0:3d9c67d97d6f 195
emh203 0:3d9c67d97d6f 196 while(i > 0u)
emh203 0:3d9c67d97d6f 197 {
emh203 0:3d9c67d97d6f 198 /*
emh203 0:3d9c67d97d6f 199 outR = (pSrc[2 * i] * pATable[2 * i] - pSrc[2 * i + 1] * pATable[2 * i + 1]
emh203 0:3d9c67d97d6f 200 + pSrc[2 * n - 2 * i] * pBTable[2 * i] +
emh203 0:3d9c67d97d6f 201 pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
emh203 0:3d9c67d97d6f 202 */
emh203 0:3d9c67d97d6f 203
emh203 0:3d9c67d97d6f 204 /* outI = (pIn[2 * i + 1] * pATable[2 * i] + pIn[2 * i] * pATable[2 * i + 1] +
emh203 0:3d9c67d97d6f 205 pIn[2 * n - 2 * i] * pBTable[2 * i + 1] -
emh203 0:3d9c67d97d6f 206 pIn[2 * n - 2 * i + 1] * pBTable[2 * i]); */
emh203 0:3d9c67d97d6f 207
emh203 0:3d9c67d97d6f 208 CoefA1 = *pCoefA++;
emh203 0:3d9c67d97d6f 209 CoefA2 = *pCoefA;
emh203 0:3d9c67d97d6f 210
emh203 0:3d9c67d97d6f 211 /* outR = (pSrc[2 * i] * pATable[2 * i] */
emh203 0:3d9c67d97d6f 212 outR = ((int32_t) (((q63_t) * pIn1 * CoefA1) >> 32));
emh203 0:3d9c67d97d6f 213
emh203 0:3d9c67d97d6f 214 /* outI = pIn[2 * i] * pATable[2 * i + 1] */
emh203 0:3d9c67d97d6f 215 outI = ((int32_t) (((q63_t) * pIn1++ * CoefA2) >> 32));
emh203 0:3d9c67d97d6f 216
emh203 0:3d9c67d97d6f 217 /* - pSrc[2 * i + 1] * pATable[2 * i + 1] */
emh203 0:3d9c67d97d6f 218 outR =
emh203 0:3d9c67d97d6f 219 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn1 * (-CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 220
emh203 0:3d9c67d97d6f 221 /* (pIn[2 * i + 1] * pATable[2 * i] */
emh203 0:3d9c67d97d6f 222 outI =
emh203 0:3d9c67d97d6f 223 (q31_t) ((((q63_t) outI << 32) + ((q63_t) * pIn1++ * (CoefA1))) >> 32);
emh203 0:3d9c67d97d6f 224
emh203 0:3d9c67d97d6f 225 /* pSrc[2 * n - 2 * i] * pBTable[2 * i] */
emh203 0:3d9c67d97d6f 226 outR =
emh203 0:3d9c67d97d6f 227 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn2 * (-CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 228 CoefB1 = *pCoefB;
emh203 0:3d9c67d97d6f 229
emh203 0:3d9c67d97d6f 230 /* pIn[2 * n - 2 * i] * pBTable[2 * i + 1] */
emh203 0:3d9c67d97d6f 231 outI =
emh203 0:3d9c67d97d6f 232 (q31_t) ((((q63_t) outI << 32) + ((q63_t) * pIn2-- * (-CoefB1))) >> 32);
emh203 0:3d9c67d97d6f 233
emh203 0:3d9c67d97d6f 234 /* pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1] */
emh203 0:3d9c67d97d6f 235 outR =
emh203 0:3d9c67d97d6f 236 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn2 * (CoefB1))) >> 32);
emh203 0:3d9c67d97d6f 237
emh203 0:3d9c67d97d6f 238 /* pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
emh203 0:3d9c67d97d6f 239 outI =
emh203 0:3d9c67d97d6f 240 (q31_t) ((((q63_t) outI << 32) + ((q63_t) * pIn2-- * (-CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 241
emh203 0:3d9c67d97d6f 242 /* write output */
emh203 0:3d9c67d97d6f 243 *pOut1++ = outR;
emh203 0:3d9c67d97d6f 244 *pOut1++ = outI;
emh203 0:3d9c67d97d6f 245
emh203 0:3d9c67d97d6f 246 /* write complex conjugate output */
emh203 0:3d9c67d97d6f 247 *pOut2-- = -outI;
emh203 0:3d9c67d97d6f 248 *pOut2-- = outR;
emh203 0:3d9c67d97d6f 249
emh203 0:3d9c67d97d6f 250 /* update coefficient pointer */
emh203 0:3d9c67d97d6f 251 pCoefB = pCoefB + (modifier * 2u);
emh203 0:3d9c67d97d6f 252 pCoefA = pCoefA + ((modifier * 2u) - 1u);
emh203 0:3d9c67d97d6f 253
emh203 0:3d9c67d97d6f 254 i--;
emh203 0:3d9c67d97d6f 255
emh203 0:3d9c67d97d6f 256 }
emh203 0:3d9c67d97d6f 257
emh203 0:3d9c67d97d6f 258 pDst[2u * fftLen] = (pSrc[0] - pSrc[1]) >> 1;
emh203 0:3d9c67d97d6f 259 pDst[(2u * fftLen) + 1u] = 0;
emh203 0:3d9c67d97d6f 260
emh203 0:3d9c67d97d6f 261 pDst[0] = (pSrc[0] + pSrc[1]) >> 1;
emh203 0:3d9c67d97d6f 262 pDst[1] = 0;
emh203 0:3d9c67d97d6f 263
emh203 0:3d9c67d97d6f 264 }
emh203 0:3d9c67d97d6f 265
emh203 0:3d9c67d97d6f 266
emh203 0:3d9c67d97d6f 267 /**
emh203 0:3d9c67d97d6f 268 * @brief Core Real IFFT process
emh203 0:3d9c67d97d6f 269 * @param[in] *pSrc points to the input buffer.
emh203 0:3d9c67d97d6f 270 * @param[in] fftLen length of FFT.
emh203 0:3d9c67d97d6f 271 * @param[in] *pATable points to the twiddle Coef A buffer.
emh203 0:3d9c67d97d6f 272 * @param[in] *pBTable points to the twiddle Coef B buffer.
emh203 0:3d9c67d97d6f 273 * @param[out] *pDst points to the output buffer.
emh203 0:3d9c67d97d6f 274 * @param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
emh203 0:3d9c67d97d6f 275 * @return none.
emh203 0:3d9c67d97d6f 276 */
emh203 0:3d9c67d97d6f 277
emh203 0:3d9c67d97d6f 278 void arm_split_rifft_q31(
emh203 0:3d9c67d97d6f 279 q31_t * pSrc,
emh203 0:3d9c67d97d6f 280 uint32_t fftLen,
emh203 0:3d9c67d97d6f 281 q31_t * pATable,
emh203 0:3d9c67d97d6f 282 q31_t * pBTable,
emh203 0:3d9c67d97d6f 283 q31_t * pDst,
emh203 0:3d9c67d97d6f 284 uint32_t modifier)
emh203 0:3d9c67d97d6f 285 {
emh203 0:3d9c67d97d6f 286 q31_t outR, outI; /* Temporary variables for output */
emh203 0:3d9c67d97d6f 287 q31_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
emh203 0:3d9c67d97d6f 288 q31_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
emh203 0:3d9c67d97d6f 289 q31_t *pIn1 = &pSrc[0], *pIn2 = &pSrc[(2u * fftLen) + 1u];
emh203 0:3d9c67d97d6f 290
emh203 0:3d9c67d97d6f 291 pCoefA = &pATable[0];
emh203 0:3d9c67d97d6f 292 pCoefB = &pBTable[0];
emh203 0:3d9c67d97d6f 293
emh203 0:3d9c67d97d6f 294 while(fftLen > 0u)
emh203 0:3d9c67d97d6f 295 {
emh203 0:3d9c67d97d6f 296 /*
emh203 0:3d9c67d97d6f 297 outR = (pIn[2 * i] * pATable[2 * i] + pIn[2 * i + 1] * pATable[2 * i + 1] +
emh203 0:3d9c67d97d6f 298 pIn[2 * n - 2 * i] * pBTable[2 * i] -
emh203 0:3d9c67d97d6f 299 pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
emh203 0:3d9c67d97d6f 300
emh203 0:3d9c67d97d6f 301 outI = (pIn[2 * i + 1] * pATable[2 * i] - pIn[2 * i] * pATable[2 * i + 1] -
emh203 0:3d9c67d97d6f 302 pIn[2 * n - 2 * i] * pBTable[2 * i + 1] -
emh203 0:3d9c67d97d6f 303 pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
emh203 0:3d9c67d97d6f 304
emh203 0:3d9c67d97d6f 305 */
emh203 0:3d9c67d97d6f 306 CoefA1 = *pCoefA++;
emh203 0:3d9c67d97d6f 307 CoefA2 = *pCoefA;
emh203 0:3d9c67d97d6f 308
emh203 0:3d9c67d97d6f 309 /* outR = (pIn[2 * i] * pATable[2 * i] */
emh203 0:3d9c67d97d6f 310 outR = ((int32_t) (((q63_t) * pIn1 * CoefA1) >> 32));
emh203 0:3d9c67d97d6f 311
emh203 0:3d9c67d97d6f 312 /* - pIn[2 * i] * pATable[2 * i + 1] */
emh203 0:3d9c67d97d6f 313 outI = -((int32_t) (((q63_t) * pIn1++ * CoefA2) >> 32));
emh203 0:3d9c67d97d6f 314
emh203 0:3d9c67d97d6f 315 /* pIn[2 * i + 1] * pATable[2 * i + 1] */
emh203 0:3d9c67d97d6f 316 outR =
emh203 0:3d9c67d97d6f 317 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn1 * (CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 318
emh203 0:3d9c67d97d6f 319 /* pIn[2 * i + 1] * pATable[2 * i] */
emh203 0:3d9c67d97d6f 320 outI =
emh203 0:3d9c67d97d6f 321 (q31_t) ((((q63_t) outI << 32) + ((q63_t) * pIn1++ * (CoefA1))) >> 32);
emh203 0:3d9c67d97d6f 322
emh203 0:3d9c67d97d6f 323 /* pIn[2 * n - 2 * i] * pBTable[2 * i] */
emh203 0:3d9c67d97d6f 324 outR =
emh203 0:3d9c67d97d6f 325 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn2 * (CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 326
emh203 0:3d9c67d97d6f 327 CoefB1 = *pCoefB;
emh203 0:3d9c67d97d6f 328
emh203 0:3d9c67d97d6f 329 /* pIn[2 * n - 2 * i] * pBTable[2 * i + 1] */
emh203 0:3d9c67d97d6f 330 outI =
emh203 0:3d9c67d97d6f 331 (q31_t) ((((q63_t) outI << 32) - ((q63_t) * pIn2-- * (CoefB1))) >> 32);
emh203 0:3d9c67d97d6f 332
emh203 0:3d9c67d97d6f 333 /* pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1] */
emh203 0:3d9c67d97d6f 334 outR =
emh203 0:3d9c67d97d6f 335 (q31_t) ((((q63_t) outR << 32) + ((q63_t) * pIn2 * (CoefB1))) >> 32);
emh203 0:3d9c67d97d6f 336
emh203 0:3d9c67d97d6f 337 /* pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
emh203 0:3d9c67d97d6f 338 outI =
emh203 0:3d9c67d97d6f 339 (q31_t) ((((q63_t) outI << 32) + ((q63_t) * pIn2-- * (CoefA2))) >> 32);
emh203 0:3d9c67d97d6f 340
emh203 0:3d9c67d97d6f 341 /* write output */
emh203 0:3d9c67d97d6f 342 *pDst++ = outR;
emh203 0:3d9c67d97d6f 343 *pDst++ = outI;
emh203 0:3d9c67d97d6f 344
emh203 0:3d9c67d97d6f 345 /* update coefficient pointer */
emh203 0:3d9c67d97d6f 346 pCoefB = pCoefB + (modifier * 2u);
emh203 0:3d9c67d97d6f 347 pCoefA = pCoefA + ((modifier * 2u) - 1u);
emh203 0:3d9c67d97d6f 348
emh203 0:3d9c67d97d6f 349 /* Decrement loop count */
emh203 0:3d9c67d97d6f 350 fftLen--;
emh203 0:3d9c67d97d6f 351
emh203 0:3d9c67d97d6f 352 }
emh203 0:3d9c67d97d6f 353
emh203 0:3d9c67d97d6f 354
emh203 0:3d9c67d97d6f 355 }