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 #include "arm_math.h"
00026
00027
00028
00029
00030
00031 void arm_split_rfft_q15(
00032 q15_t * pSrc,
00033 uint32_t fftLen,
00034 q15_t * pATable,
00035 q15_t * pBTable,
00036 q15_t * pDst,
00037 uint32_t modifier);
00038
00039 void arm_split_rifft_q15(
00040 q15_t * pSrc,
00041 uint32_t fftLen,
00042 q15_t * pATable,
00043 q15_t * pBTable,
00044 q15_t * pDst,
00045 uint32_t modifier);
00046
00070 void arm_rfft_q15(
00071 const arm_rfft_instance_q15 * S,
00072 q15_t * pSrc,
00073 q15_t * pDst)
00074 {
00075 const arm_cfft_radix4_instance_q15 *S_CFFT = S->pCfft;
00076
00077
00078 if(S->ifftFlagR == 1u)
00079 {
00080
00081 arm_split_rifft_q15(pSrc, S->fftLenBy2, S->pTwiddleAReal,
00082 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
00083
00084
00085 arm_radix4_butterfly_inverse_q15(pDst, S_CFFT->fftLen,
00086 S_CFFT->pTwiddle,
00087 S_CFFT->twidCoefModifier);
00088
00089
00090 if(S->bitReverseFlagR == 1u)
00091 {
00092 arm_bitreversal_q15(pDst, S_CFFT->fftLen,
00093 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
00094 }
00095 }
00096 else
00097 {
00098
00099
00100
00101 arm_radix4_butterfly_q15(pSrc, S_CFFT->fftLen,
00102 S_CFFT->pTwiddle, S_CFFT->twidCoefModifier);
00103
00104
00105 if(S->bitReverseFlagR == 1u)
00106 {
00107 arm_bitreversal_q15(pSrc, S_CFFT->fftLen,
00108 S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
00109 }
00110
00111 arm_split_rfft_q15(pSrc, S->fftLenBy2, S->pTwiddleAReal,
00112 S->pTwiddleBReal, pDst, S->twidCoefRModifier);
00113 }
00114
00115 }
00116
00133 void arm_split_rfft_q15(
00134 q15_t * pSrc,
00135 uint32_t fftLen,
00136 q15_t * pATable,
00137 q15_t * pBTable,
00138 q15_t * pDst,
00139 uint32_t modifier)
00140 {
00141 uint32_t i;
00142 q31_t outR, outI;
00143 q15_t *pCoefA, *pCoefB;
00144 q15_t *pSrc1, *pSrc2;
00145 q31_t in1, in2, coeffA, coeffB;
00146
00147 pCoefA = &pATable[modifier * 2u];
00148 pCoefB = &pBTable[modifier * 2u];
00149
00150 pSrc1 = &pSrc[2];
00151 pSrc2 = &pSrc[(2u * fftLen) - 2u];
00152
00153 i = 1u;
00154
00155 while(i < fftLen)
00156 {
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 in1 = *__SIMD32(pSrc1)++;
00167 in2 = *__SIMD32(pSrc2)--;
00168 coeffA = *__SIMD32(pCoefA);
00169 coeffB = *__SIMD32(pCoefB);
00170
00171 #ifndef ARM_MATH_BIG_ENDIAN
00172
00173
00174 outR = __SMUSD(in1, coeffA);
00175
00176 #else
00177
00178
00179 outR = -(__SMUSD(in1, coeffA));
00180
00181 #endif
00182
00183
00184
00185 outR = __SMLAD(in2, coeffB, outR) >> 15u;
00186
00187
00188
00189
00190 #ifndef ARM_MATH_BIG_ENDIAN
00191
00192 outI = __SMUSDX(in2, coeffB);
00193
00194 #else
00195
00196 outI = __SMUSDX(coeffB, in2);
00197
00198 #endif
00199
00200
00201 outI = __SMLADX(in1, coeffA, outI);
00202
00203
00204 pDst[2u * i] = (q15_t) outR;
00205 pDst[(2u * i) + 1u] = outI >> 15u;
00206
00207
00208 pDst[(4u * fftLen) - (2u * i)] = (q15_t) outR;
00209 pDst[((4u * fftLen) - (2u * i)) + 1u] = -(outI >> 15u);
00210
00211
00212 pCoefB = pCoefB + (2u * modifier);
00213 pCoefA = pCoefA + (2u * modifier);
00214
00215 i++;
00216
00217 }
00218
00219 pDst[2u * fftLen] = pSrc[0] - pSrc[1];
00220 pDst[(2u * fftLen) + 1u] = 0;
00221
00222 pDst[0] = pSrc[0] + pSrc[1];
00223 pDst[1] = 0;
00224
00225 }
00226
00227
00240 void arm_split_rifft_q15(
00241 q15_t * pSrc,
00242 uint32_t fftLen,
00243 q15_t * pATable,
00244 q15_t * pBTable,
00245 q15_t * pDst,
00246 uint32_t modifier)
00247 {
00248 uint32_t i;
00249 q31_t outR, outI;
00250 q15_t *pCoefA, *pCoefB;
00251 q15_t *pSrc1, *pSrc2;
00252 q15_t *pDst1 = &pDst[0];
00253 q31_t in1, in2, coeffA, coeffB;
00254
00255 pCoefA = &pATable[0];
00256 pCoefB = &pBTable[0];
00257
00258 pSrc1 = &pSrc[0];
00259 pSrc2 = &pSrc[2u * fftLen];
00260
00261 i = fftLen;
00262
00263 while(i > 0u)
00264 {
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 in2 = *__SIMD32(pSrc2)--;
00278 in1 = *__SIMD32(pSrc1)++;
00279 coeffB = *__SIMD32(pCoefB);
00280 coeffA = *__SIMD32(pCoefA);
00281
00282
00283 #ifndef ARM_MATH_BIG_ENDIAN
00284
00285
00286
00287 outR = __SMUSD(in2, coeffB);
00288
00289 #else
00290
00291
00292
00293 outR = -(__SMUSD(in2, coeffB));
00294
00295 #endif
00296
00297
00298
00299 outR = __SMLAD(in1, coeffA, outR) >> 15u;
00300
00301
00302
00303
00304 outI = __SMUADX(in2, coeffB);
00305
00306
00307
00308 #ifndef ARM_MATH_BIG_ENDIAN
00309
00310 outI = __SMLSDX(coeffA, in1, -outI);
00311
00312 #else
00313
00314 outI = __SMLSDX(in1, coeffA, -outI);
00315
00316 #endif
00317
00318
00319 #ifndef ARM_MATH_BIG_ENDIAN
00320
00321 *__SIMD32(pDst1)++ = __PKHBT(outR, (outI >> 15u), 16);
00322
00323 #else
00324
00325 *__SIMD32(pDst1)++ = __PKHBT((outI >> 15u), outR, 16);
00326
00327 #endif
00328
00329
00330 pCoefB = pCoefB + (2u * modifier);
00331 pCoefA = pCoefA + (2u * modifier);
00332
00333 i--;
00334
00335 }
00336
00337 }