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