Robert Lopez / CMSIS5
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_cfft_radix4_f32.c Source File

arm_cfft_radix4_f32.c

00001 /* ----------------------------------------------------------------------
00002  * Project:      CMSIS DSP Library
00003  * Title:        arm_cfft_radix4_f32.c
00004  * Description:  Radix-4 Decimation in Frequency CFFT & CIFFT Floating point processing function
00005  *
00006  * $Date:        27. January 2017
00007  * $Revision:    V.1.5.1
00008  *
00009  * Target Processor: Cortex-M cores
00010  * -------------------------------------------------------------------- */
00011 /*
00012  * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
00013  *
00014  * SPDX-License-Identifier: Apache-2.0
00015  *
00016  * Licensed under the Apache License, Version 2.0 (the License); you may
00017  * not use this file except in compliance with the License.
00018  * You may obtain a copy of the License at
00019  *
00020  * www.apache.org/licenses/LICENSE-2.0
00021  *
00022  * Unless required by applicable law or agreed to in writing, software
00023  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00024  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00025  * See the License for the specific language governing permissions and
00026  * limitations under the License.
00027  */
00028 
00029 #include "arm_math.h"
00030 
00031 extern void arm_bitreversal_f32(
00032 float32_t * pSrc,
00033 uint16_t fftSize,
00034 uint16_t bitRevFactor,
00035 uint16_t * pBitRevTab);
00036 
00037 void arm_radix4_butterfly_f32(
00038 float32_t * pSrc,
00039 uint16_t fftLen,
00040 float32_t * pCoef,
00041 uint16_t twidCoefModifier);
00042 
00043 void arm_radix4_butterfly_inverse_f32(
00044 float32_t * pSrc,
00045 uint16_t fftLen,
00046 float32_t * pCoef,
00047 uint16_t twidCoefModifier,
00048 float32_t onebyfftLen);
00049 
00050 
00051 /**
00052 * @ingroup groupTransforms
00053 */
00054 
00055 /**
00056 * @addtogroup ComplexFFT
00057 * @{
00058 */
00059 
00060 /**
00061 * @details
00062 * @brief Processing function for the floating-point Radix-4 CFFT/CIFFT.
00063 * @deprecated Do not use this function.  It has been superseded by \ref arm_cfft_f32 and will be removed
00064 * in the future.
00065 * @param[in]      *S    points to an instance of the floating-point Radix-4 CFFT/CIFFT structure.
00066 * @param[in, out] *pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place.
00067 * @return none.
00068 */
00069 
00070 void arm_cfft_radix4_f32(
00071   const arm_cfft_radix4_instance_f32 * S,
00072   float32_t * pSrc)
00073 {
00074    if (S->ifftFlag == 1U)
00075    {
00076       /*  Complex IFFT radix-4  */
00077       arm_radix4_butterfly_inverse_f32(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier, S->onebyfftLen);
00078    }
00079    else
00080    {
00081       /*  Complex FFT radix-4  */
00082       arm_radix4_butterfly_f32(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
00083    }
00084 
00085    if (S->bitReverseFlag == 1U)
00086    {
00087       /*  Bit Reversal */
00088       arm_bitreversal_f32(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
00089    }
00090 
00091 }
00092 
00093 /**
00094 * @} end of ComplexFFT group
00095 */
00096 
00097 /* ----------------------------------------------------------------------
00098  * Internal helper function used by the FFTs
00099  * ---------------------------------------------------------------------- */
00100 
00101 /*
00102 * @brief  Core function for the floating-point CFFT butterfly process.
00103 * @param[in, out] *pSrc            points to the in-place buffer of floating-point data type.
00104 * @param[in]      fftLen           length of the FFT.
00105 * @param[in]      *pCoef           points to the twiddle coefficient buffer.
00106 * @param[in]      twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
00107 * @return none.
00108 */
00109 
00110 void arm_radix4_butterfly_f32(
00111 float32_t * pSrc,
00112 uint16_t fftLen,
00113 float32_t * pCoef,
00114 uint16_t twidCoefModifier)
00115 {
00116 
00117    float32_t co1, co2, co3, si1, si2, si3;
00118    uint32_t ia1, ia2, ia3;
00119    uint32_t i0, i1, i2, i3;
00120    uint32_t n1, n2, j, k;
00121 
00122 #if defined (ARM_MATH_DSP)
00123 
00124    /* Run the below code for Cortex-M4 and Cortex-M3 */
00125 
00126    float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
00127    float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
00128    Ybminusd;
00129    float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
00130    float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
00131    float32_t *ptr1;
00132    float32_t p0,p1,p2,p3,p4,p5;
00133    float32_t a0,a1,a2,a3,a4,a5,a6,a7;
00134 
00135    /*  Initializations for the first stage */
00136    n2 = fftLen;
00137    n1 = n2;
00138 
00139    /* n2 = fftLen/4 */
00140    n2 >>= 2U;
00141    i0 = 0U;
00142    ia1 = 0U;
00143 
00144    j = n2;
00145 
00146    /*  Calculation of first stage */
00147    do
00148    {
00149       /*  index calculation for the input as, */
00150       /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
00151       i1 = i0 + n2;
00152       i2 = i1 + n2;
00153       i3 = i2 + n2;
00154 
00155       xaIn = pSrc[(2U * i0)];
00156       yaIn = pSrc[(2U * i0) + 1U];
00157 
00158       xbIn = pSrc[(2U * i1)];
00159       ybIn = pSrc[(2U * i1) + 1U];
00160 
00161       xcIn = pSrc[(2U * i2)];
00162       ycIn = pSrc[(2U * i2) + 1U];
00163 
00164       xdIn = pSrc[(2U * i3)];
00165       ydIn = pSrc[(2U * i3) + 1U];
00166 
00167       /* xa + xc */
00168       Xaplusc = xaIn + xcIn;
00169       /* xb + xd */
00170       Xbplusd = xbIn + xdIn;
00171       /* ya + yc */
00172       Yaplusc = yaIn + ycIn;
00173       /* yb + yd */
00174       Ybplusd = ybIn + ydIn;
00175 
00176       /*  index calculation for the coefficients */
00177       ia2 = ia1 + ia1;
00178       co2 = pCoef[ia2 * 2U];
00179       si2 = pCoef[(ia2 * 2U) + 1U];
00180 
00181       /* xa - xc */
00182       Xaminusc = xaIn - xcIn;
00183       /* xb - xd */
00184       Xbminusd = xbIn - xdIn;
00185       /* ya - yc */
00186       Yaminusc = yaIn - ycIn;
00187       /* yb - yd */
00188       Ybminusd = ybIn - ydIn;
00189 
00190       /* xa' = xa + xb + xc + xd */
00191       pSrc[(2U * i0)] = Xaplusc + Xbplusd;
00192       /* ya' = ya + yb + yc + yd */
00193       pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
00194 
00195       /* (xa - xc) + (yb - yd) */
00196       Xb12C_out = (Xaminusc + Ybminusd);
00197       /* (ya - yc) + (xb - xd) */
00198       Yb12C_out = (Yaminusc - Xbminusd);
00199       /* (xa + xc) - (xb + xd) */
00200       Xc12C_out = (Xaplusc - Xbplusd);
00201       /* (ya + yc) - (yb + yd) */
00202       Yc12C_out = (Yaplusc - Ybplusd);
00203       /* (xa - xc) - (yb - yd) */
00204       Xd12C_out = (Xaminusc - Ybminusd);
00205       /* (ya - yc) + (xb - xd) */
00206       Yd12C_out = (Xbminusd + Yaminusc);
00207 
00208       co1 = pCoef[ia1 * 2U];
00209       si1 = pCoef[(ia1 * 2U) + 1U];
00210 
00211       /*  index calculation for the coefficients */
00212       ia3 = ia2 + ia1;
00213       co3 = pCoef[ia3 * 2U];
00214       si3 = pCoef[(ia3 * 2U) + 1U];
00215 
00216       Xb12_out = Xb12C_out * co1;
00217       Yb12_out = Yb12C_out * co1;
00218       Xc12_out = Xc12C_out * co2;
00219       Yc12_out = Yc12C_out * co2;
00220       Xd12_out = Xd12C_out * co3;
00221       Yd12_out = Yd12C_out * co3;
00222 
00223       /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00224       //Xb12_out -= Yb12C_out * si1;
00225       p0 = Yb12C_out * si1;
00226       /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00227       //Yb12_out += Xb12C_out * si1;
00228       p1 = Xb12C_out * si1;
00229       /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00230       //Xc12_out -= Yc12C_out * si2;
00231       p2 = Yc12C_out * si2;
00232       /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00233       //Yc12_out += Xc12C_out * si2;
00234       p3 = Xc12C_out * si2;
00235       /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00236       //Xd12_out -= Yd12C_out * si3;
00237       p4 = Yd12C_out * si3;
00238       /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00239       //Yd12_out += Xd12C_out * si3;
00240       p5 = Xd12C_out * si3;
00241 
00242       Xb12_out += p0;
00243       Yb12_out -= p1;
00244       Xc12_out += p2;
00245       Yc12_out -= p3;
00246       Xd12_out += p4;
00247       Yd12_out -= p5;
00248 
00249       /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
00250       pSrc[2U * i1] = Xc12_out;
00251 
00252       /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
00253       pSrc[(2U * i1) + 1U] = Yc12_out;
00254 
00255       /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
00256       pSrc[2U * i2] = Xb12_out;
00257 
00258       /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
00259       pSrc[(2U * i2) + 1U] = Yb12_out;
00260 
00261       /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
00262       pSrc[2U * i3] = Xd12_out;
00263 
00264       /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
00265       pSrc[(2U * i3) + 1U] = Yd12_out;
00266 
00267       /*  Twiddle coefficients index modifier */
00268       ia1 += twidCoefModifier;
00269 
00270       /*  Updating input index */
00271       i0++;
00272 
00273    }
00274    while (--j);
00275 
00276    twidCoefModifier <<= 2U;
00277 
00278    /*  Calculation of second stage to excluding last stage */
00279    for (k = fftLen >> 2U; k > 4U; k >>= 2U)
00280    {
00281       /*  Initializations for the first stage */
00282       n1 = n2;
00283       n2 >>= 2U;
00284       ia1 = 0U;
00285 
00286       /*  Calculation of first stage */
00287       j = 0;
00288       do
00289       {
00290          /*  index calculation for the coefficients */
00291          ia2 = ia1 + ia1;
00292          ia3 = ia2 + ia1;
00293          co1 = pCoef[ia1 * 2U];
00294          si1 = pCoef[(ia1 * 2U) + 1U];
00295          co2 = pCoef[ia2 * 2U];
00296          si2 = pCoef[(ia2 * 2U) + 1U];
00297          co3 = pCoef[ia3 * 2U];
00298          si3 = pCoef[(ia3 * 2U) + 1U];
00299 
00300          /*  Twiddle coefficients index modifier */
00301          ia1 += twidCoefModifier;
00302 
00303          i0 = j;
00304          do
00305          {
00306             /*  index calculation for the input as, */
00307             /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
00308             i1 = i0 + n2;
00309             i2 = i1 + n2;
00310             i3 = i2 + n2;
00311 
00312             xaIn = pSrc[(2U * i0)];
00313             yaIn = pSrc[(2U * i0) + 1U];
00314 
00315             xbIn = pSrc[(2U * i1)];
00316             ybIn = pSrc[(2U * i1) + 1U];
00317 
00318             xcIn = pSrc[(2U * i2)];
00319             ycIn = pSrc[(2U * i2) + 1U];
00320 
00321             xdIn = pSrc[(2U * i3)];
00322             ydIn = pSrc[(2U * i3) + 1U];
00323 
00324             /* xa - xc */
00325             Xaminusc = xaIn - xcIn;
00326             /* (xb - xd) */
00327             Xbminusd = xbIn - xdIn;
00328             /* ya - yc */
00329             Yaminusc = yaIn - ycIn;
00330             /* (yb - yd) */
00331             Ybminusd = ybIn - ydIn;
00332 
00333             /* xa + xc */
00334             Xaplusc = xaIn + xcIn;
00335             /* xb + xd */
00336             Xbplusd = xbIn + xdIn;
00337             /* ya + yc */
00338             Yaplusc = yaIn + ycIn;
00339             /* yb + yd */
00340             Ybplusd = ybIn + ydIn;
00341 
00342             /* (xa - xc) + (yb - yd) */
00343             Xb12C_out = (Xaminusc + Ybminusd);
00344             /* (ya - yc) -  (xb - xd) */
00345             Yb12C_out = (Yaminusc - Xbminusd);
00346             /* xa + xc -(xb + xd) */
00347             Xc12C_out = (Xaplusc - Xbplusd);
00348             /* (ya + yc) - (yb + yd) */
00349             Yc12C_out = (Yaplusc - Ybplusd);
00350             /* (xa - xc) - (yb - yd) */
00351             Xd12C_out = (Xaminusc - Ybminusd);
00352             /* (ya - yc) +  (xb - xd) */
00353             Yd12C_out = (Xbminusd + Yaminusc);
00354 
00355             pSrc[(2U * i0)] = Xaplusc + Xbplusd;
00356             pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
00357 
00358             Xb12_out = Xb12C_out * co1;
00359             Yb12_out = Yb12C_out * co1;
00360             Xc12_out = Xc12C_out * co2;
00361             Yc12_out = Yc12C_out * co2;
00362             Xd12_out = Xd12C_out * co3;
00363             Yd12_out = Yd12C_out * co3;
00364 
00365             /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00366             //Xb12_out -= Yb12C_out * si1;
00367             p0 = Yb12C_out * si1;
00368             /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00369             //Yb12_out += Xb12C_out * si1;
00370             p1 = Xb12C_out * si1;
00371             /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00372             //Xc12_out -= Yc12C_out * si2;
00373             p2 = Yc12C_out * si2;
00374             /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00375             //Yc12_out += Xc12C_out * si2;
00376             p3 = Xc12C_out * si2;
00377             /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00378             //Xd12_out -= Yd12C_out * si3;
00379             p4 = Yd12C_out * si3;
00380             /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00381             //Yd12_out += Xd12C_out * si3;
00382             p5 = Xd12C_out * si3;
00383 
00384             Xb12_out += p0;
00385             Yb12_out -= p1;
00386             Xc12_out += p2;
00387             Yc12_out -= p3;
00388             Xd12_out += p4;
00389             Yd12_out -= p5;
00390 
00391             /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
00392             pSrc[2U * i1] = Xc12_out;
00393 
00394             /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
00395             pSrc[(2U * i1) + 1U] = Yc12_out;
00396 
00397             /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
00398             pSrc[2U * i2] = Xb12_out;
00399 
00400             /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
00401             pSrc[(2U * i2) + 1U] = Yb12_out;
00402 
00403             /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
00404             pSrc[2U * i3] = Xd12_out;
00405 
00406             /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
00407             pSrc[(2U * i3) + 1U] = Yd12_out;
00408 
00409             i0 += n1;
00410          } while (i0 < fftLen);
00411          j++;
00412       } while (j <= (n2 - 1U));
00413       twidCoefModifier <<= 2U;
00414    }
00415 
00416    j = fftLen >> 2;
00417    ptr1 = &pSrc[0];
00418 
00419    /*  Calculations of last stage */
00420    do
00421    {
00422       xaIn = ptr1[0];
00423       yaIn = ptr1[1];
00424       xbIn = ptr1[2];
00425       ybIn = ptr1[3];
00426       xcIn = ptr1[4];
00427       ycIn = ptr1[5];
00428       xdIn = ptr1[6];
00429       ydIn = ptr1[7];
00430 
00431       /* xa + xc */
00432       Xaplusc = xaIn + xcIn;
00433 
00434       /* xa - xc */
00435       Xaminusc = xaIn - xcIn;
00436 
00437       /* ya + yc */
00438       Yaplusc = yaIn + ycIn;
00439 
00440       /* ya - yc */
00441       Yaminusc = yaIn - ycIn;
00442 
00443       /* xb + xd */
00444       Xbplusd = xbIn + xdIn;
00445 
00446       /* yb + yd */
00447       Ybplusd = ybIn + ydIn;
00448 
00449       /* (xb-xd) */
00450       Xbminusd = xbIn - xdIn;
00451 
00452       /* (yb-yd) */
00453       Ybminusd = ybIn - ydIn;
00454 
00455       /* xa' = xa + xb + xc + xd */
00456       a0 = (Xaplusc + Xbplusd);
00457       /* ya' = ya + yb + yc + yd */
00458       a1 = (Yaplusc + Ybplusd);
00459       /* xc' = (xa-xb+xc-xd) */
00460       a2 = (Xaplusc - Xbplusd);
00461       /* yc' = (ya-yb+yc-yd) */
00462       a3 = (Yaplusc - Ybplusd);
00463       /* xb' = (xa+yb-xc-yd) */
00464       a4 = (Xaminusc + Ybminusd);
00465       /* yb' = (ya-xb-yc+xd) */
00466       a5 = (Yaminusc - Xbminusd);
00467       /* xd' = (xa-yb-xc+yd)) */
00468       a6 = (Xaminusc - Ybminusd);
00469       /* yd' = (ya+xb-yc-xd) */
00470       a7 = (Xbminusd + Yaminusc);
00471 
00472       ptr1[0] = a0;
00473       ptr1[1] = a1;
00474       ptr1[2] = a2;
00475       ptr1[3] = a3;
00476       ptr1[4] = a4;
00477       ptr1[5] = a5;
00478       ptr1[6] = a6;
00479       ptr1[7] = a7;
00480 
00481       /* increment pointer by 8 */
00482       ptr1 += 8U;
00483    } while (--j);
00484 
00485 #else
00486 
00487    float32_t t1, t2, r1, r2, s1, s2;
00488 
00489    /* Run the below code for Cortex-M0 */
00490 
00491    /*  Initializations for the fft calculation */
00492    n2 = fftLen;
00493    n1 = n2;
00494    for (k = fftLen; k > 1U; k >>= 2U)
00495    {
00496       /*  Initializations for the fft calculation */
00497       n1 = n2;
00498       n2 >>= 2U;
00499       ia1 = 0U;
00500 
00501       /*  FFT Calculation */
00502       j = 0;
00503       do
00504       {
00505          /*  index calculation for the coefficients */
00506          ia2 = ia1 + ia1;
00507          ia3 = ia2 + ia1;
00508          co1 = pCoef[ia1 * 2U];
00509          si1 = pCoef[(ia1 * 2U) + 1U];
00510          co2 = pCoef[ia2 * 2U];
00511          si2 = pCoef[(ia2 * 2U) + 1U];
00512          co3 = pCoef[ia3 * 2U];
00513          si3 = pCoef[(ia3 * 2U) + 1U];
00514 
00515          /*  Twiddle coefficients index modifier */
00516          ia1 = ia1 + twidCoefModifier;
00517 
00518          i0 = j;
00519          do
00520          {
00521             /*  index calculation for the input as, */
00522             /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
00523             i1 = i0 + n2;
00524             i2 = i1 + n2;
00525             i3 = i2 + n2;
00526 
00527             /* xa + xc */
00528             r1 = pSrc[(2U * i0)] + pSrc[(2U * i2)];
00529 
00530             /* xa - xc */
00531             r2 = pSrc[(2U * i0)] - pSrc[(2U * i2)];
00532 
00533             /* ya + yc */
00534             s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
00535 
00536             /* ya - yc */
00537             s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
00538 
00539             /* xb + xd */
00540             t1 = pSrc[2U * i1] + pSrc[2U * i3];
00541 
00542             /* xa' = xa + xb + xc + xd */
00543             pSrc[2U * i0] = r1 + t1;
00544 
00545             /* xa + xc -(xb + xd) */
00546             r1 = r1 - t1;
00547 
00548             /* yb + yd */
00549             t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
00550 
00551             /* ya' = ya + yb + yc + yd */
00552             pSrc[(2U * i0) + 1U] = s1 + t2;
00553 
00554             /* (ya + yc) - (yb + yd) */
00555             s1 = s1 - t2;
00556 
00557             /* (yb - yd) */
00558             t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
00559 
00560             /* (xb - xd) */
00561             t2 = pSrc[2U * i1] - pSrc[2U * i3];
00562 
00563             /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
00564             pSrc[2U * i1] = (r1 * co2) + (s1 * si2);
00565 
00566             /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
00567             pSrc[(2U * i1) + 1U] = (s1 * co2) - (r1 * si2);
00568 
00569             /* (xa - xc) + (yb - yd) */
00570             r1 = r2 + t1;
00571 
00572             /* (xa - xc) - (yb - yd) */
00573             r2 = r2 - t1;
00574 
00575             /* (ya - yc) -  (xb - xd) */
00576             s1 = s2 - t2;
00577 
00578             /* (ya - yc) +  (xb - xd) */
00579             s2 = s2 + t2;
00580 
00581             /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
00582             pSrc[2U * i2] = (r1 * co1) + (s1 * si1);
00583 
00584             /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
00585             pSrc[(2U * i2) + 1U] = (s1 * co1) - (r1 * si1);
00586 
00587             /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
00588             pSrc[2U * i3] = (r2 * co3) + (s2 * si3);
00589 
00590             /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
00591             pSrc[(2U * i3) + 1U] = (s2 * co3) - (r2 * si3);
00592 
00593             i0 += n1;
00594          } while ( i0 < fftLen);
00595          j++;
00596       } while (j <= (n2 - 1U));
00597       twidCoefModifier <<= 2U;
00598    }
00599 
00600 #endif /* #if defined (ARM_MATH_DSP) */
00601 
00602 }
00603 
00604 /*
00605 * @brief  Core function for the floating-point CIFFT butterfly process.
00606 * @param[in, out] *pSrc            points to the in-place buffer of floating-point data type.
00607 * @param[in]      fftLen           length of the FFT.
00608 * @param[in]      *pCoef           points to twiddle coefficient buffer.
00609 * @param[in]      twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
00610 * @param[in]      onebyfftLen      value of 1/fftLen.
00611 * @return none.
00612 */
00613 
00614 void arm_radix4_butterfly_inverse_f32(
00615 float32_t * pSrc,
00616 uint16_t fftLen,
00617 float32_t * pCoef,
00618 uint16_t twidCoefModifier,
00619 float32_t onebyfftLen)
00620 {
00621    float32_t co1, co2, co3, si1, si2, si3;
00622    uint32_t ia1, ia2, ia3;
00623    uint32_t i0, i1, i2, i3;
00624    uint32_t n1, n2, j, k;
00625 
00626 #if defined (ARM_MATH_DSP)
00627 
00628    float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
00629    float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
00630    Ybminusd;
00631    float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
00632    float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
00633    float32_t *ptr1;
00634    float32_t p0,p1,p2,p3,p4,p5,p6,p7;
00635    float32_t a0,a1,a2,a3,a4,a5,a6,a7;
00636 
00637 
00638    /*  Initializations for the first stage */
00639    n2 = fftLen;
00640    n1 = n2;
00641 
00642    /* n2 = fftLen/4 */
00643    n2 >>= 2U;
00644    i0 = 0U;
00645    ia1 = 0U;
00646 
00647    j = n2;
00648 
00649    /*  Calculation of first stage */
00650    do
00651    {
00652       /*  index calculation for the input as, */
00653       /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
00654       i1 = i0 + n2;
00655       i2 = i1 + n2;
00656       i3 = i2 + n2;
00657 
00658       /*  Butterfly implementation */
00659       xaIn = pSrc[(2U * i0)];
00660       yaIn = pSrc[(2U * i0) + 1U];
00661 
00662       xcIn = pSrc[(2U * i2)];
00663       ycIn = pSrc[(2U * i2) + 1U];
00664 
00665       xbIn = pSrc[(2U * i1)];
00666       ybIn = pSrc[(2U * i1) + 1U];
00667 
00668       xdIn = pSrc[(2U * i3)];
00669       ydIn = pSrc[(2U * i3) + 1U];
00670 
00671       /* xa + xc */
00672       Xaplusc = xaIn + xcIn;
00673       /* xb + xd */
00674       Xbplusd = xbIn + xdIn;
00675       /* ya + yc */
00676       Yaplusc = yaIn + ycIn;
00677       /* yb + yd */
00678       Ybplusd = ybIn + ydIn;
00679 
00680       /*  index calculation for the coefficients */
00681       ia2 = ia1 + ia1;
00682       co2 = pCoef[ia2 * 2U];
00683       si2 = pCoef[(ia2 * 2U) + 1U];
00684 
00685       /* xa - xc */
00686       Xaminusc = xaIn - xcIn;
00687       /* xb - xd */
00688       Xbminusd = xbIn - xdIn;
00689       /* ya - yc */
00690       Yaminusc = yaIn - ycIn;
00691       /* yb - yd */
00692       Ybminusd = ybIn - ydIn;
00693 
00694       /* xa' = xa + xb + xc + xd */
00695       pSrc[(2U * i0)] = Xaplusc + Xbplusd;
00696 
00697       /* ya' = ya + yb + yc + yd */
00698       pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
00699 
00700       /* (xa - xc) - (yb - yd) */
00701       Xb12C_out = (Xaminusc - Ybminusd);
00702       /* (ya - yc) + (xb - xd) */
00703       Yb12C_out = (Yaminusc + Xbminusd);
00704       /* (xa + xc) - (xb + xd) */
00705       Xc12C_out = (Xaplusc - Xbplusd);
00706       /* (ya + yc) - (yb + yd) */
00707       Yc12C_out = (Yaplusc - Ybplusd);
00708       /* (xa - xc) + (yb - yd) */
00709       Xd12C_out = (Xaminusc + Ybminusd);
00710       /* (ya - yc) - (xb - xd) */
00711       Yd12C_out = (Yaminusc - Xbminusd);
00712 
00713       co1 = pCoef[ia1 * 2U];
00714       si1 = pCoef[(ia1 * 2U) + 1U];
00715 
00716       /*  index calculation for the coefficients */
00717       ia3 = ia2 + ia1;
00718       co3 = pCoef[ia3 * 2U];
00719       si3 = pCoef[(ia3 * 2U) + 1U];
00720 
00721       Xb12_out = Xb12C_out * co1;
00722       Yb12_out = Yb12C_out * co1;
00723       Xc12_out = Xc12C_out * co2;
00724       Yc12_out = Yc12C_out * co2;
00725       Xd12_out = Xd12C_out * co3;
00726       Yd12_out = Yd12C_out * co3;
00727 
00728       /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00729       //Xb12_out -= Yb12C_out * si1;
00730       p0 = Yb12C_out * si1;
00731       /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00732       //Yb12_out += Xb12C_out * si1;
00733       p1 = Xb12C_out * si1;
00734       /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00735       //Xc12_out -= Yc12C_out * si2;
00736       p2 = Yc12C_out * si2;
00737       /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00738       //Yc12_out += Xc12C_out * si2;
00739       p3 = Xc12C_out * si2;
00740       /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00741       //Xd12_out -= Yd12C_out * si3;
00742       p4 = Yd12C_out * si3;
00743       /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00744       //Yd12_out += Xd12C_out * si3;
00745       p5 = Xd12C_out * si3;
00746 
00747       Xb12_out -= p0;
00748       Yb12_out += p1;
00749       Xc12_out -= p2;
00750       Yc12_out += p3;
00751       Xd12_out -= p4;
00752       Yd12_out += p5;
00753 
00754       /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00755       pSrc[2U * i1] = Xc12_out;
00756 
00757       /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00758       pSrc[(2U * i1) + 1U] = Yc12_out;
00759 
00760       /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00761       pSrc[2U * i2] = Xb12_out;
00762 
00763       /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00764       pSrc[(2U * i2) + 1U] = Yb12_out;
00765 
00766       /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00767       pSrc[2U * i3] = Xd12_out;
00768 
00769       /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00770       pSrc[(2U * i3) + 1U] = Yd12_out;
00771 
00772       /*  Twiddle coefficients index modifier */
00773       ia1 = ia1 + twidCoefModifier;
00774 
00775       /*  Updating input index */
00776       i0 = i0 + 1U;
00777 
00778    } while (--j);
00779 
00780    twidCoefModifier <<= 2U;
00781 
00782    /*  Calculation of second stage to excluding last stage */
00783    for (k = fftLen >> 2U; k > 4U; k >>= 2U)
00784    {
00785       /*  Initializations for the first stage */
00786       n1 = n2;
00787       n2 >>= 2U;
00788       ia1 = 0U;
00789 
00790       /*  Calculation of first stage */
00791       j = 0;
00792       do
00793       {
00794          /*  index calculation for the coefficients */
00795          ia2 = ia1 + ia1;
00796          ia3 = ia2 + ia1;
00797          co1 = pCoef[ia1 * 2U];
00798          si1 = pCoef[(ia1 * 2U) + 1U];
00799          co2 = pCoef[ia2 * 2U];
00800          si2 = pCoef[(ia2 * 2U) + 1U];
00801          co3 = pCoef[ia3 * 2U];
00802          si3 = pCoef[(ia3 * 2U) + 1U];
00803 
00804          /*  Twiddle coefficients index modifier */
00805          ia1 = ia1 + twidCoefModifier;
00806 
00807          i0 = j;
00808          do
00809          {
00810             /*  index calculation for the input as, */
00811             /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
00812             i1 = i0 + n2;
00813             i2 = i1 + n2;
00814             i3 = i2 + n2;
00815 
00816             xaIn = pSrc[(2U * i0)];
00817             yaIn = pSrc[(2U * i0) + 1U];
00818 
00819             xbIn = pSrc[(2U * i1)];
00820             ybIn = pSrc[(2U * i1) + 1U];
00821 
00822             xcIn = pSrc[(2U * i2)];
00823             ycIn = pSrc[(2U * i2) + 1U];
00824 
00825             xdIn = pSrc[(2U * i3)];
00826             ydIn = pSrc[(2U * i3) + 1U];
00827 
00828             /* xa - xc */
00829             Xaminusc = xaIn - xcIn;
00830             /* (xb - xd) */
00831             Xbminusd = xbIn - xdIn;
00832             /* ya - yc */
00833             Yaminusc = yaIn - ycIn;
00834             /* (yb - yd) */
00835             Ybminusd = ybIn - ydIn;
00836 
00837             /* xa + xc */
00838             Xaplusc = xaIn + xcIn;
00839             /* xb + xd */
00840             Xbplusd = xbIn + xdIn;
00841             /* ya + yc */
00842             Yaplusc = yaIn + ycIn;
00843             /* yb + yd */
00844             Ybplusd = ybIn + ydIn;
00845 
00846             /* (xa - xc) - (yb - yd) */
00847             Xb12C_out = (Xaminusc - Ybminusd);
00848             /* (ya - yc) +  (xb - xd) */
00849             Yb12C_out = (Yaminusc + Xbminusd);
00850             /* xa + xc -(xb + xd) */
00851             Xc12C_out = (Xaplusc - Xbplusd);
00852             /* (ya + yc) - (yb + yd) */
00853             Yc12C_out = (Yaplusc - Ybplusd);
00854             /* (xa - xc) + (yb - yd) */
00855             Xd12C_out = (Xaminusc + Ybminusd);
00856             /* (ya - yc) -  (xb - xd) */
00857             Yd12C_out = (Yaminusc - Xbminusd);
00858 
00859             pSrc[(2U * i0)] = Xaplusc + Xbplusd;
00860             pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
00861 
00862             Xb12_out = Xb12C_out * co1;
00863             Yb12_out = Yb12C_out * co1;
00864             Xc12_out = Xc12C_out * co2;
00865             Yc12_out = Yc12C_out * co2;
00866             Xd12_out = Xd12C_out * co3;
00867             Yd12_out = Yd12C_out * co3;
00868 
00869             /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00870             //Xb12_out -= Yb12C_out * si1;
00871             p0 = Yb12C_out * si1;
00872             /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00873             //Yb12_out += Xb12C_out * si1;
00874             p1 = Xb12C_out * si1;
00875             /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00876             //Xc12_out -= Yc12C_out * si2;
00877             p2 = Yc12C_out * si2;
00878             /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00879             //Yc12_out += Xc12C_out * si2;
00880             p3 = Xc12C_out * si2;
00881             /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00882             //Xd12_out -= Yd12C_out * si3;
00883             p4 = Yd12C_out * si3;
00884             /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00885             //Yd12_out += Xd12C_out * si3;
00886             p5 = Xd12C_out * si3;
00887 
00888             Xb12_out -= p0;
00889             Yb12_out += p1;
00890             Xc12_out -= p2;
00891             Yc12_out += p3;
00892             Xd12_out -= p4;
00893             Yd12_out += p5;
00894 
00895             /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
00896             pSrc[2U * i1] = Xc12_out;
00897 
00898             /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
00899             pSrc[(2U * i1) + 1U] = Yc12_out;
00900 
00901             /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
00902             pSrc[2U * i2] = Xb12_out;
00903 
00904             /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
00905             pSrc[(2U * i2) + 1U] = Yb12_out;
00906 
00907             /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
00908             pSrc[2U * i3] = Xd12_out;
00909 
00910             /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
00911             pSrc[(2U * i3) + 1U] = Yd12_out;
00912 
00913             i0 += n1;
00914          } while (i0 < fftLen);
00915          j++;
00916       } while (j <= (n2 - 1U));
00917       twidCoefModifier <<= 2U;
00918    }
00919    /*  Initializations of last stage */
00920 
00921    j = fftLen >> 2;
00922    ptr1 = &pSrc[0];
00923 
00924    /*  Calculations of last stage */
00925    do
00926    {
00927       xaIn = ptr1[0];
00928       yaIn = ptr1[1];
00929       xbIn = ptr1[2];
00930       ybIn = ptr1[3];
00931       xcIn = ptr1[4];
00932       ycIn = ptr1[5];
00933       xdIn = ptr1[6];
00934       ydIn = ptr1[7];
00935 
00936       /*  Butterfly implementation */
00937       /* xa + xc */
00938       Xaplusc = xaIn + xcIn;
00939 
00940       /* xa - xc */
00941       Xaminusc = xaIn - xcIn;
00942 
00943       /* ya + yc */
00944       Yaplusc = yaIn + ycIn;
00945 
00946       /* ya - yc */
00947       Yaminusc = yaIn - ycIn;
00948 
00949       /* xb + xd */
00950       Xbplusd = xbIn + xdIn;
00951 
00952       /* yb + yd */
00953       Ybplusd = ybIn + ydIn;
00954 
00955       /* (xb-xd) */
00956       Xbminusd = xbIn - xdIn;
00957 
00958       /* (yb-yd) */
00959       Ybminusd = ybIn - ydIn;
00960 
00961       /* xa' = (xa+xb+xc+xd) * onebyfftLen */
00962       a0 = (Xaplusc + Xbplusd);
00963       /* ya' = (ya+yb+yc+yd) * onebyfftLen */
00964       a1 = (Yaplusc + Ybplusd);
00965       /* xc' = (xa-xb+xc-xd) * onebyfftLen */
00966       a2 = (Xaplusc - Xbplusd);
00967       /* yc' = (ya-yb+yc-yd) * onebyfftLen  */
00968       a3 = (Yaplusc - Ybplusd);
00969       /* xb' = (xa-yb-xc+yd) * onebyfftLen */
00970       a4 = (Xaminusc - Ybminusd);
00971       /* yb' = (ya+xb-yc-xd) * onebyfftLen */
00972       a5 = (Yaminusc + Xbminusd);
00973       /* xd' = (xa-yb-xc+yd) * onebyfftLen */
00974       a6 = (Xaminusc + Ybminusd);
00975       /* yd' = (ya-xb-yc+xd) * onebyfftLen */
00976       a7 = (Yaminusc - Xbminusd);
00977 
00978       p0 = a0 * onebyfftLen;
00979       p1 = a1 * onebyfftLen;
00980       p2 = a2 * onebyfftLen;
00981       p3 = a3 * onebyfftLen;
00982       p4 = a4 * onebyfftLen;
00983       p5 = a5 * onebyfftLen;
00984       p6 = a6 * onebyfftLen;
00985       p7 = a7 * onebyfftLen;
00986 
00987       /* xa' = (xa+xb+xc+xd) * onebyfftLen */
00988       ptr1[0] = p0;
00989       /* ya' = (ya+yb+yc+yd) * onebyfftLen */
00990       ptr1[1] = p1;
00991       /* xc' = (xa-xb+xc-xd) * onebyfftLen */
00992       ptr1[2] = p2;
00993       /* yc' = (ya-yb+yc-yd) * onebyfftLen  */
00994       ptr1[3] = p3;
00995       /* xb' = (xa-yb-xc+yd) * onebyfftLen */
00996       ptr1[4] = p4;
00997       /* yb' = (ya+xb-yc-xd) * onebyfftLen */
00998       ptr1[5] = p5;
00999       /* xd' = (xa-yb-xc+yd) * onebyfftLen */
01000       ptr1[6] = p6;
01001       /* yd' = (ya-xb-yc+xd) * onebyfftLen */
01002       ptr1[7] = p7;
01003 
01004       /* increment source pointer by 8 for next calculations */
01005       ptr1 = ptr1 + 8U;
01006 
01007    } while (--j);
01008 
01009 #else
01010 
01011    float32_t t1, t2, r1, r2, s1, s2;
01012 
01013    /* Run the below code for Cortex-M0 */
01014 
01015    /*  Initializations for the first stage */
01016    n2 = fftLen;
01017    n1 = n2;
01018 
01019    /*  Calculation of first stage */
01020    for (k = fftLen; k > 4U; k >>= 2U)
01021    {
01022       /*  Initializations for the first stage */
01023       n1 = n2;
01024       n2 >>= 2U;
01025       ia1 = 0U;
01026 
01027       /*  Calculation of first stage */
01028       j = 0;
01029       do
01030       {
01031          /*  index calculation for the coefficients */
01032          ia2 = ia1 + ia1;
01033          ia3 = ia2 + ia1;
01034          co1 = pCoef[ia1 * 2U];
01035          si1 = pCoef[(ia1 * 2U) + 1U];
01036          co2 = pCoef[ia2 * 2U];
01037          si2 = pCoef[(ia2 * 2U) + 1U];
01038          co3 = pCoef[ia3 * 2U];
01039          si3 = pCoef[(ia3 * 2U) + 1U];
01040 
01041          /*  Twiddle coefficients index modifier */
01042          ia1 = ia1 + twidCoefModifier;
01043 
01044          i0 = j;
01045          do
01046          {
01047             /*  index calculation for the input as, */
01048             /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
01049             i1 = i0 + n2;
01050             i2 = i1 + n2;
01051             i3 = i2 + n2;
01052 
01053             /* xa + xc */
01054             r1 = pSrc[(2U * i0)] + pSrc[(2U * i2)];
01055 
01056             /* xa - xc */
01057             r2 = pSrc[(2U * i0)] - pSrc[(2U * i2)];
01058 
01059             /* ya + yc */
01060             s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
01061 
01062             /* ya - yc */
01063             s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
01064 
01065             /* xb + xd */
01066             t1 = pSrc[2U * i1] + pSrc[2U * i3];
01067 
01068             /* xa' = xa + xb + xc + xd */
01069             pSrc[2U * i0] = r1 + t1;
01070 
01071             /* xa + xc -(xb + xd) */
01072             r1 = r1 - t1;
01073 
01074             /* yb + yd */
01075             t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
01076 
01077             /* ya' = ya + yb + yc + yd */
01078             pSrc[(2U * i0) + 1U] = s1 + t2;
01079 
01080             /* (ya + yc) - (yb + yd) */
01081             s1 = s1 - t2;
01082 
01083             /* (yb - yd) */
01084             t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
01085 
01086             /* (xb - xd) */
01087             t2 = pSrc[2U * i1] - pSrc[2U * i3];
01088 
01089             /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
01090             pSrc[2U * i1] = (r1 * co2) - (s1 * si2);
01091 
01092             /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
01093             pSrc[(2U * i1) + 1U] = (s1 * co2) + (r1 * si2);
01094 
01095             /* (xa - xc) - (yb - yd) */
01096             r1 = r2 - t1;
01097 
01098             /* (xa - xc) + (yb - yd) */
01099             r2 = r2 + t1;
01100 
01101             /* (ya - yc) +  (xb - xd) */
01102             s1 = s2 + t2;
01103 
01104             /* (ya - yc) -  (xb - xd) */
01105             s2 = s2 - t2;
01106 
01107             /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
01108             pSrc[2U * i2] = (r1 * co1) - (s1 * si1);
01109 
01110             /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
01111             pSrc[(2U * i2) + 1U] = (s1 * co1) + (r1 * si1);
01112 
01113             /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
01114             pSrc[2U * i3] = (r2 * co3) - (s2 * si3);
01115 
01116             /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
01117             pSrc[(2U * i3) + 1U] = (s2 * co3) + (r2 * si3);
01118 
01119             i0 += n1;
01120          } while ( i0 < fftLen);
01121          j++;
01122       } while (j <= (n2 - 1U));
01123       twidCoefModifier <<= 2U;
01124    }
01125    /*  Initializations of last stage */
01126    n1 = n2;
01127    n2 >>= 2U;
01128 
01129    /*  Calculations of last stage */
01130    for (i0 = 0U; i0 <= (fftLen - n1); i0 += n1)
01131    {
01132       /*  index calculation for the input as, */
01133       /*  pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
01134       i1 = i0 + n2;
01135       i2 = i1 + n2;
01136       i3 = i2 + n2;
01137 
01138       /*  Butterfly implementation */
01139       /* xa + xc */
01140       r1 = pSrc[2U * i0] + pSrc[2U * i2];
01141 
01142       /* xa - xc */
01143       r2 = pSrc[2U * i0] - pSrc[2U * i2];
01144 
01145       /* ya + yc */
01146       s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
01147 
01148       /* ya - yc */
01149       s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
01150 
01151       /* xc + xd */
01152       t1 = pSrc[2U * i1] + pSrc[2U * i3];
01153 
01154       /* xa' = xa + xb + xc + xd */
01155       pSrc[2U * i0] = (r1 + t1) * onebyfftLen;
01156 
01157       /* (xa + xb) - (xc + xd) */
01158       r1 = r1 - t1;
01159 
01160       /* yb + yd */
01161       t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
01162 
01163       /* ya' = ya + yb + yc + yd */
01164       pSrc[(2U * i0) + 1U] = (s1 + t2) * onebyfftLen;
01165 
01166       /* (ya + yc) - (yb + yd) */
01167       s1 = s1 - t2;
01168 
01169       /* (yb-yd) */
01170       t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
01171 
01172       /* (xb-xd) */
01173       t2 = pSrc[2U * i1] - pSrc[2U * i3];
01174 
01175       /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
01176       pSrc[2U * i1] = r1 * onebyfftLen;
01177 
01178       /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
01179       pSrc[(2U * i1) + 1U] = s1 * onebyfftLen;
01180 
01181       /* (xa - xc) - (yb-yd) */
01182       r1 = r2 - t1;
01183 
01184       /* (xa - xc) + (yb-yd) */
01185       r2 = r2 + t1;
01186 
01187       /* (ya - yc) + (xb-xd) */
01188       s1 = s2 + t2;
01189 
01190       /* (ya - yc) - (xb-xd) */
01191       s2 = s2 - t2;
01192 
01193       /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
01194       pSrc[2U * i2] = r1 * onebyfftLen;
01195 
01196       /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
01197       pSrc[(2U * i2) + 1U] = s1 * onebyfftLen;
01198 
01199       /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
01200       pSrc[2U * i3] = r2 * onebyfftLen;
01201 
01202       /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
01203       pSrc[(2U * i3) + 1U] = s2 * onebyfftLen;
01204    }
01205 
01206 #endif /* #if defined (ARM_MATH_DSP) */
01207 }
01208 
01209 
01210