CMSIS DSP library

Dependents:   KL25Z_FFT_Demo Hat_Board_v5_1 KL25Z_FFT_Demo_tony KL25Z_FFT_Demo_tony ... more

Fork of mbed-dsp by mbed official

Committer:
mbed_official
Date:
Fri Nov 08 13:45:10 2013 +0000
Revision:
3:7a284390b0ce
Parent:
2:da51fb522205
Synchronized with git revision e69956aba2f68a2a26ac26b051f8d349deaa1ce8

Who changed what in which revision?

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