00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "arm_math.h"
00034
00118
00119
00120
00121
00122 void arm_split_rfft_f32(
00123 float32_t * pSrc,
00124 uint32_t fftLen,
00125 float32_t * pATable,
00126 float32_t * pBTable,
00127 float32_t * pDst,
00128 uint32_t modifier);
00129 void arm_split_rifft_f32(
00130 float32_t * pSrc,
00131 uint32_t fftLen,
00132 float32_t * pATable,
00133 float32_t * pBTable,
00134 float32_t * pDst,
00135 uint32_t modifier);
00136
00150 void arm_rfft_f32(
00151 const arm_rfft_instance_f32 * S,
00152 float32_t * pSrc,
00153 float32_t * pDst)
00154 {
00155 const arm_cfft_radix4_instance_f32 *S_CFFT = S->pCfft;
00156
00157
00158
00159 if(S->ifftFlagR == 1u)
00160 {
00161
00162 arm_split_rifft_f32(pSrc, S->fftLenBy2, S->pTwiddleAReal,
00163 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
00164
00165
00166
00167 arm_radix4_butterfly_inverse_f32(pDst, S_CFFT->fftLen,
00168 S_CFFT->pTwiddle,
00169 S_CFFT->twidCoefModifier,
00170 S_CFFT->onebyfftLen);
00171
00172
00173 if(S->bitReverseFlagR == 1u)
00174 {
00175 arm_bitreversal_f32(pDst, S_CFFT->fftLen,
00176 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
00177 }
00178 }
00179 else
00180 {
00181
00182
00183
00184
00185 arm_radix4_butterfly_f32(pSrc, S_CFFT->fftLen,
00186 S_CFFT->pTwiddle, S_CFFT->twidCoefModifier);
00187
00188
00189 if(S->bitReverseFlagR == 1u)
00190 {
00191 arm_bitreversal_f32(pSrc, S_CFFT->fftLen,
00192 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
00193 }
00194
00195
00196
00197 arm_split_rfft_f32(pSrc, S->fftLenBy2, S->pTwiddleAReal,
00198 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
00199 }
00200
00201 }
00202
00218 void arm_split_rfft_f32(
00219 float32_t * pSrc,
00220 uint32_t fftLen,
00221 float32_t * pATable,
00222 float32_t * pBTable,
00223 float32_t * pDst,
00224 uint32_t modifier)
00225 {
00226 uint32_t i;
00227 float32_t outR, outI;
00228 float32_t *pCoefA, *pCoefB;
00229 float32_t CoefA1, CoefA2, CoefB1;
00230 float32_t *pDst1 = &pDst[2], *pDst2 = &pDst[(4u * fftLen) - 1u];
00231 float32_t *pSrc1 = &pSrc[2], *pSrc2 = &pSrc[(2u * fftLen) - 1u];
00232
00233
00234 pSrc[2u * fftLen] = pSrc[0];
00235 pSrc[(2u * fftLen) + 1u] = pSrc[1];
00236
00237
00238 pCoefA = &pATable[modifier * 2u];
00239 pCoefB = &pBTable[modifier * 2u];
00240
00241 i = fftLen - 1u;
00242
00243 while(i > 0u)
00244 {
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 CoefA1 = *pCoefA++;
00257
00258 CoefA2 = *pCoefA;
00259
00260
00261 outR = *pSrc1 * CoefA1;
00262
00263 outI = *pSrc1++ * CoefA2;
00264
00265
00266 outR -= (*pSrc1 + *pSrc2) * CoefA2;
00267
00268 outI += *pSrc1++ * CoefA1;
00269
00270 CoefB1 = *pCoefB;
00271
00272
00273 outI -= *pSrc2-- * CoefB1;
00274
00275 outI -= *pSrc2 * CoefA2;
00276
00277
00278 outR += *pSrc2-- * CoefB1;
00279
00280
00281 *pDst1++ = outR;
00282 *pDst1++ = outI;
00283
00284
00285 *pDst2-- = -outI;
00286 *pDst2-- = outR;
00287
00288
00289 pCoefB = pCoefB + (modifier * 2u);
00290 pCoefA = pCoefA + ((modifier * 2u) - 1u);
00291
00292 i--;
00293
00294 }
00295
00296 pDst[2u * fftLen] = pSrc[0] - pSrc[1];
00297 pDst[(2u * fftLen) + 1u] = 0.0f;
00298
00299 pDst[0] = pSrc[0] + pSrc[1];
00300 pDst[1] = 0.0f;
00301
00302 }
00303
00304
00316 void arm_split_rifft_f32(
00317 float32_t * pSrc,
00318 uint32_t fftLen,
00319 float32_t * pATable,
00320 float32_t * pBTable,
00321 float32_t * pDst,
00322 uint32_t modifier)
00323 {
00324 float32_t outR, outI;
00325 float32_t *pCoefA, *pCoefB;
00326 float32_t CoefA1, CoefA2, CoefB1;
00327 float32_t *pSrc1 = &pSrc[0], *pSrc2 = &pSrc[(2u * fftLen) + 1u];
00328
00329 pCoefA = &pATable[0];
00330 pCoefB = &pBTable[0];
00331
00332 while(fftLen > 0u)
00333 {
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 CoefA1 = *pCoefA++;
00346 CoefA2 = *pCoefA;
00347
00348
00349 outR = *pSrc1 * CoefA1;
00350
00351
00352 outI = -(*pSrc1++) * CoefA2;
00353
00354
00355 outR += (*pSrc1 + *pSrc2) * CoefA2;
00356
00357
00358 outI += (*pSrc1++) * CoefA1;
00359
00360 CoefB1 = *pCoefB;
00361
00362
00363 outI -= *pSrc2-- * CoefB1;
00364
00365
00366 outR += *pSrc2 * CoefB1;
00367
00368
00369 outI += *pSrc2-- * CoefA2;
00370
00371
00372 *pDst++ = outR;
00373 *pDst++ = outI;
00374
00375
00376 pCoefB = pCoefB + (modifier * 2u);
00377 pCoefA = pCoefA + ((modifier * 2u) - 1u);
00378
00379
00380 fftLen--;
00381 }
00382
00383 }