1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Library
3  * Title:        arm_cfft_radix2_q15.c
4  * Description:  Radix-2 Decimation in Frequency CFFT & CIFFT Fixed point processing function
5  *
6  * $Date:        23 April 2021
7  * $Revision:    V1.9.0
8  *
9  * Target Processor: Cortex-M and Cortex-A cores
10  * -------------------------------------------------------------------- */
11 /*
12  * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
13  *
14  * SPDX-License-Identifier: Apache-2.0
15  *
16  * Licensed under the Apache License, Version 2.0 (the License); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #include "dsp/transform_functions.h"
30 
31 void arm_radix2_butterfly_q15(
32         q15_t * pSrc,
33         uint32_t fftLen,
34   const q15_t * pCoef,
35         uint16_t twidCoefModifier);
36 
37 void arm_radix2_butterfly_inverse_q15(
38         q15_t * pSrc,
39         uint32_t fftLen,
40   const q15_t * pCoef,
41         uint16_t twidCoefModifier);
42 
43 void arm_bitreversal_q15(
44         q15_t * pSrc,
45         uint32_t fftLen,
46         uint16_t bitRevFactor,
47   const uint16_t * pBitRevTab);
48 
49 
50 /**
51   @addtogroup ComplexFFTDeprecated
52   @{
53  */
54 
55 /**
56   @brief         Processing function for the fixed-point CFFT/CIFFT.
57   @deprecated    Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed in the future.
58   @param[in]     S    points to an instance of the fixed-point CFFT/CIFFT structure
59   @param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
60  */
61 
arm_cfft_radix2_q15(const arm_cfft_radix2_instance_q15 * S,q15_t * pSrc)62 void arm_cfft_radix2_q15(
63   const arm_cfft_radix2_instance_q15 * S,
64         q15_t * pSrc)
65 {
66 
67   if (S->ifftFlag == 1U)
68   {
69     arm_radix2_butterfly_inverse_q15 (pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
70   }
71   else
72   {
73     arm_radix2_butterfly_q15 (pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
74   }
75 
76   arm_bitreversal_q15(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
77 }
78 
79 /**
80   @} end of ComplexFFTDeprecated group
81  */
82 
arm_radix2_butterfly_q15(q15_t * pSrc,uint32_t fftLen,const q15_t * pCoef,uint16_t twidCoefModifier)83 void arm_radix2_butterfly_q15(
84         q15_t * pSrc,
85         uint32_t fftLen,
86   const q15_t * pCoef,
87         uint16_t twidCoefModifier)
88 {
89 #if defined (ARM_MATH_DSP)
90 
91   uint32_t i, j, k, l;
92   uint32_t n1, n2, ia;
93   q15_t in;
94   q31_t T, S, R;
95   q31_t coeff, out1, out2;
96 
97   //N = fftLen;
98   n2 = fftLen;
99 
100   n1 = n2;
101   n2 = n2 >> 1;
102   ia = 0;
103 
104   // loop for groups
105   for (i = 0; i < n2; i++)
106   {
107     coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
108 
109     ia = ia + twidCoefModifier;
110 
111     l = i + n2;
112 
113     T = read_q15x2 (pSrc + (2 * i));
114     in = ((int16_t) (T & 0xFFFF)) >> 1;
115     T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
116 
117     S = read_q15x2 (pSrc + (2 * l));
118     in = ((int16_t) (S & 0xFFFF)) >> 1;
119     S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
120 
121     R = __QSUB16(T, S);
122 
123     write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
124 
125 #ifndef ARM_MATH_BIG_ENDIAN
126     out1 = __SMUAD(coeff, R) >> 16;
127     out2 = __SMUSDX(coeff, R);
128 #else
129     out1 = __SMUSDX(R, coeff) >> 16U;
130     out2 = __SMUAD(coeff, R);
131 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
132 
133     write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
134 
135     coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
136 
137     ia = ia + twidCoefModifier;
138 
139     /* loop for butterfly */
140     i++;
141     l++;
142 
143     T = read_q15x2 (pSrc + (2 * i));
144     in = ((int16_t) (T & 0xFFFF)) >> 1;
145     T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
146 
147     S = read_q15x2 (pSrc + (2 * l));
148     in = ((int16_t) (S & 0xFFFF)) >> 1;
149     S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
150 
151     R = __QSUB16(T, S);
152 
153     write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
154 
155 #ifndef ARM_MATH_BIG_ENDIAN
156     out1 = __SMUAD(coeff, R) >> 16;
157     out2 = __SMUSDX(coeff, R);
158 #else
159 
160     out1 = __SMUSDX(R, coeff) >> 16U;
161     out2 = __SMUAD(coeff, R);
162 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
163 
164     write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
165 
166   } /* groups loop end */
167 
168   twidCoefModifier = twidCoefModifier << 1U;
169 
170   /* loop for stage */
171   for (k = fftLen / 2; k > 2; k = k >> 1)
172   {
173     n1 = n2;
174     n2 = n2 >> 1;
175     ia = 0;
176 
177     /* loop for groups */
178     for (j = 0; j < n2; j++)
179     {
180       coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
181 
182       ia = ia + twidCoefModifier;
183 
184       /* loop for butterfly */
185       for (i = j; i < fftLen; i += n1)
186       {
187         l = i + n2;
188 
189         T = read_q15x2 (pSrc + (2 * i));
190 
191         S = read_q15x2 (pSrc + (2 * l));
192 
193         R = __QSUB16(T, S);
194 
195         write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
196 
197 #ifndef ARM_MATH_BIG_ENDIAN
198         out1 = __SMUAD(coeff, R) >> 16;
199         out2 = __SMUSDX(coeff, R);
200 #else
201         out1 = __SMUSDX(R, coeff) >> 16U;
202         out2 = __SMUAD(coeff, R);
203 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
204 
205         write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
206 
207         i += n1;
208 
209         l = i + n2;
210 
211         T = read_q15x2 (pSrc + (2 * i));
212 
213         S = read_q15x2 (pSrc + (2 * l));
214 
215         R = __QSUB16(T, S);
216 
217         write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
218 
219 #ifndef ARM_MATH_BIG_ENDIAN
220         out1 = __SMUAD(coeff, R) >> 16;
221         out2 = __SMUSDX(coeff, R);
222 #else
223         out1 = __SMUSDX(R, coeff) >> 16U;
224         out2 = __SMUAD(coeff, R);
225 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
226 
227         write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
228 
229       } /* butterfly loop end */
230 
231     } /* groups loop end */
232 
233     twidCoefModifier = twidCoefModifier << 1U;
234   } /* stages loop end */
235 
236   n1 = n2;
237   n2 = n2 >> 1;
238   ia = 0;
239 
240   coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
241 
242   ia = ia + twidCoefModifier;
243 
244   /* loop for butterfly */
245   for (i = 0; i < fftLen; i += n1)
246   {
247     l = i + n2;
248 
249     T = read_q15x2 (pSrc + (2 * i));
250 
251     S = read_q15x2 (pSrc + (2 * l));
252 
253     R = __QSUB16(T, S);
254 
255     write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
256 
257     write_q15x2 (pSrc + (2 * l), R);
258 
259     i += n1;
260     l = i + n2;
261 
262     T = read_q15x2 (pSrc + (2 * i));
263 
264     S = read_q15x2 (pSrc + (2 * l));
265 
266     R = __QSUB16(T, S);
267 
268     write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
269 
270     write_q15x2 (pSrc + (2 * l), R);
271 
272   } /* groups loop end */
273 
274 
275 #else /* #if defined (ARM_MATH_DSP) */
276 
277   uint32_t i, j, k, l;
278   uint32_t n1, n2, ia;
279   q15_t xt, yt, cosVal, sinVal;
280 
281 
282   // N = fftLen;
283   n2 = fftLen;
284 
285   n1 = n2;
286   n2 = n2 >> 1;
287   ia = 0;
288 
289   /* loop for groups */
290   for (j = 0; j < n2; j++)
291   {
292     cosVal = pCoef[(ia * 2)];
293     sinVal = pCoef[(ia * 2) + 1];
294     ia = ia + twidCoefModifier;
295 
296     /* loop for butterfly */
297     for (i = j; i < fftLen; i += n1)
298     {
299       l = i + n2;
300       xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
301       pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
302 
303       yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
304       pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) +
305                          (pSrc[2 * i + 1] >> 1U)  ) >> 1U;
306 
307       pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) +
308                      ((int16_t) (((q31_t) yt * sinVal) >> 16)));
309 
310       pSrc[2U * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) -
311                           ((int16_t) (((q31_t) xt * sinVal) >> 16)));
312 
313     } /* butterfly loop end */
314 
315   } /* groups loop end */
316 
317   twidCoefModifier = twidCoefModifier << 1U;
318 
319   /* loop for stage */
320   for (k = fftLen / 2; k > 2; k = k >> 1)
321   {
322     n1 = n2;
323     n2 = n2 >> 1;
324     ia = 0;
325 
326     /* loop for groups */
327     for (j = 0; j < n2; j++)
328     {
329       cosVal = pCoef[ia * 2];
330       sinVal = pCoef[(ia * 2) + 1];
331       ia = ia + twidCoefModifier;
332 
333       /* loop for butterfly */
334       for (i = j; i < fftLen; i += n1)
335       {
336         l = i + n2;
337         xt = pSrc[2 * i] - pSrc[2 * l];
338         pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
339 
340         yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
341         pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
342 
343         pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) +
344                        ((int16_t) (((q31_t) yt * sinVal) >> 16)));
345 
346         pSrc[2U * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) -
347                             ((int16_t) (((q31_t) xt * sinVal) >> 16)));
348 
349       } /* butterfly loop end */
350 
351     } /* groups loop end */
352 
353     twidCoefModifier = twidCoefModifier << 1U;
354   } /* stages loop end */
355 
356   n1 = n2;
357   n2 = n2 >> 1;
358   ia = 0;
359 
360   /* loop for groups */
361   for (j = 0; j < n2; j++)
362   {
363     cosVal = pCoef[ia * 2];
364     sinVal = pCoef[(ia * 2) + 1];
365 
366     ia = ia + twidCoefModifier;
367 
368     /* loop for butterfly */
369     for (i = j; i < fftLen; i += n1)
370     {
371       l = i + n2;
372       xt = pSrc[2 * i] - pSrc[2 * l];
373       pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
374 
375       yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
376       pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
377 
378       pSrc[2 * l] = xt;
379 
380       pSrc[2 * l + 1] = yt;
381 
382     } /* butterfly loop end */
383 
384   } /* groups loop end */
385 
386   twidCoefModifier = twidCoefModifier << 1U;
387 
388 #endif /* #if defined (ARM_MATH_DSP) */
389 
390 }
391 
392 
arm_radix2_butterfly_inverse_q15(q15_t * pSrc,uint32_t fftLen,const q15_t * pCoef,uint16_t twidCoefModifier)393 void arm_radix2_butterfly_inverse_q15(
394         q15_t * pSrc,
395         uint32_t fftLen,
396   const q15_t * pCoef,
397         uint16_t twidCoefModifier)
398 {
399 #if defined (ARM_MATH_DSP)
400 
401         uint32_t i, j, k, l;
402         uint32_t n1, n2, ia;
403         q15_t in;
404         q31_t T, S, R;
405         q31_t coeff, out1, out2;
406 
407   // N = fftLen;
408   n2 = fftLen;
409 
410   n1 = n2;
411   n2 = n2 >> 1;
412   ia = 0;
413 
414   /* loop for groups */
415   for (i = 0; i < n2; i++)
416   {
417     coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
418 
419     ia = ia + twidCoefModifier;
420 
421     l = i + n2;
422 
423     T = read_q15x2 (pSrc + (2 * i));
424     in = ((int16_t) (T & 0xFFFF)) >> 1;
425     T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
426 
427     S = read_q15x2 (pSrc + (2 * l));
428     in = ((int16_t) (S & 0xFFFF)) >> 1;
429     S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
430 
431     R = __QSUB16(T, S);
432 
433     write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
434 
435 #ifndef ARM_MATH_BIG_ENDIAN
436     out1 = __SMUSD(coeff, R) >> 16;
437     out2 = __SMUADX(coeff, R);
438 #else
439     out1 = __SMUADX(R, coeff) >> 16U;
440     out2 = __SMUSD(__QSUB(0, coeff), R);
441 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
442 
443     write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
444 
445     coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
446 
447     ia = ia + twidCoefModifier;
448 
449     /* loop for butterfly */
450     i++;
451     l++;
452 
453     T = read_q15x2 (pSrc + (2 * i));
454     in = ((int16_t) (T & 0xFFFF)) >> 1;
455     T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
456 
457     S = read_q15x2 (pSrc + (2 * l));
458     in = ((int16_t) (S & 0xFFFF)) >> 1;
459     S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
460 
461     R = __QSUB16(T, S);
462 
463     write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
464 
465 #ifndef ARM_MATH_BIG_ENDIAN
466     out1 = __SMUSD(coeff, R) >> 16;
467     out2 = __SMUADX(coeff, R);
468 #else
469     out1 = __SMUADX(R, coeff) >> 16U;
470     out2 = __SMUSD(__QSUB(0, coeff), R);
471 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
472 
473     write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
474 
475   } /* groups loop end */
476 
477   twidCoefModifier = twidCoefModifier << 1U;
478 
479   /* loop for stage */
480   for (k = fftLen / 2; k > 2; k = k >> 1)
481   {
482     n1 = n2;
483     n2 = n2 >> 1;
484     ia = 0;
485 
486     /* loop for groups */
487     for (j = 0; j < n2; j++)
488     {
489       coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
490 
491       ia = ia + twidCoefModifier;
492 
493       /* loop for butterfly */
494       for (i = j; i < fftLen; i += n1)
495       {
496         l = i + n2;
497 
498         T = read_q15x2 (pSrc + (2 * i));
499 
500         S = read_q15x2 (pSrc + (2 * l));
501 
502         R = __QSUB16(T, S);
503 
504         write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
505 
506 #ifndef ARM_MATH_BIG_ENDIAN
507         out1 = __SMUSD(coeff, R) >> 16;
508         out2 = __SMUADX(coeff, R);
509 #else
510         out1 = __SMUADX(R, coeff) >> 16U;
511         out2 = __SMUSD(__QSUB(0, coeff), R);
512 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
513 
514         write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
515 
516         i += n1;
517 
518         l = i + n2;
519 
520         T = read_q15x2 (pSrc + (2 * i));
521 
522         S = read_q15x2 (pSrc + (2 * l));
523 
524         R = __QSUB16(T, S);
525 
526         write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
527 
528 #ifndef ARM_MATH_BIG_ENDIAN
529         out1 = __SMUSD(coeff, R) >> 16;
530         out2 = __SMUADX(coeff, R);
531 #else
532         out1 = __SMUADX(R, coeff) >> 16U;
533         out2 = __SMUSD(__QSUB(0, coeff), R);
534 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
535 
536         write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
537 
538       } /* butterfly loop end */
539 
540     } /* groups loop end */
541 
542     twidCoefModifier = twidCoefModifier << 1U;
543   } /* stages loop end */
544 
545   n1 = n2;
546   n2 = n2 >> 1;
547   ia = 0;
548 
549   /* loop for groups */
550   for (j = 0; j < n2; j++)
551   {
552     coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
553 
554     ia = ia + twidCoefModifier;
555 
556     /* loop for butterfly */
557     for (i = j; i < fftLen; i += n1)
558     {
559       l = i + n2;
560 
561       T = read_q15x2 (pSrc + (2 * i));
562 
563       S = read_q15x2 (pSrc + (2 * l));
564 
565       R = __QSUB16(T, S);
566 
567       write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
568 
569       write_q15x2 (pSrc + (2 * l), R);
570 
571     } /* butterfly loop end */
572 
573   } /* groups loop end */
574 
575   twidCoefModifier = twidCoefModifier << 1U;
576 
577 #else /* #if defined (ARM_MATH_DSP) */
578 
579         uint32_t i, j, k, l;
580         uint32_t n1, n2, ia;
581         q15_t xt, yt, cosVal, sinVal;
582 
583   // N = fftLen;
584   n2 = fftLen;
585 
586   n1 = n2;
587   n2 = n2 >> 1;
588   ia = 0;
589 
590   /* loop for groups */
591   for (j = 0; j < n2; j++)
592   {
593     cosVal = pCoef[(ia * 2)];
594     sinVal = pCoef[(ia * 2) + 1];
595     ia = ia + twidCoefModifier;
596 
597     /* loop for butterfly */
598     for (i = j; i < fftLen; i += n1)
599     {
600       l = i + n2;
601       xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
602       pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
603 
604       yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
605       pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) +
606                          (pSrc[2 * i + 1] >> 1U)  ) >> 1U;
607 
608       pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) -
609                      ((int16_t) (((q31_t) yt * sinVal) >> 16)));
610 
611       pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) +
612                          ((int16_t) (((q31_t) xt * sinVal) >> 16)));
613 
614     } /* butterfly loop end */
615 
616   } /* groups loop end */
617 
618   twidCoefModifier = twidCoefModifier << 1U;
619 
620   /* loop for stage */
621   for (k = fftLen / 2; k > 2; k = k >> 1)
622   {
623     n1 = n2;
624     n2 = n2 >> 1;
625     ia = 0;
626 
627     /* loop for groups */
628     for (j = 0; j < n2; j++)
629     {
630       cosVal = pCoef[(ia * 2)];
631       sinVal = pCoef[(ia * 2) + 1];
632       ia = ia + twidCoefModifier;
633 
634       /* loop for butterfly */
635       for (i = j; i < fftLen; i += n1)
636       {
637         l = i + n2;
638         xt = pSrc[2 * i] - pSrc[2 * l];
639         pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
640 
641         yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
642         pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
643 
644         pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) -
645                        ((int16_t) (((q31_t) yt * sinVal) >> 16))  );
646 
647         pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) +
648                            ((int16_t) (((q31_t) xt * sinVal) >> 16))  );
649 
650       } /* butterfly loop end */
651 
652     } /* groups loop end */
653 
654     twidCoefModifier = twidCoefModifier << 1U;
655   } /* stages loop end */
656 
657   n1 = n2;
658   n2 = n2 >> 1;
659   ia = 0;
660 
661   cosVal = pCoef[(ia * 2)];
662   sinVal = pCoef[(ia * 2) + 1];
663 
664   ia = ia + twidCoefModifier;
665 
666   /* loop for butterfly */
667   for (i = 0; i < fftLen; i += n1)
668   {
669     l = i + n2;
670     xt = pSrc[2 * i] - pSrc[2 * l];
671     pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
672 
673     yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
674     pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
675 
676     pSrc[2 * l] = xt;
677 
678     pSrc[2 * l + 1] = yt;
679 
680   } /* groups loop end */
681 
682 
683 #endif /* #if defined (ARM_MATH_DSP) */
684 
685 }
686