V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Committer:
emh203
Date:
Mon Jul 28 15:03:15 2014 +0000
Revision:
0:3d9c67d97d6f
1st working commit.   Had to remove arm_bitreversal2.s     arm_cfft_f32.c and arm_rfft_fast_f32.c.    The .s will not assemble.      For now I removed these functions so we could at least have a library for the other functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:3d9c67d97d6f 1 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 3 *
emh203 0:3d9c67d97d6f 4 * $Date: 12. March 2014
emh203 0:3d9c67d97d6f 5 * $Revision: V1.4.3
emh203 0:3d9c67d97d6f 6 *
emh203 0:3d9c67d97d6f 7 * Project: CMSIS DSP Library
emh203 0:3d9c67d97d6f 8 * Title: arm_cfft_radix4_f32.c
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: Radix-4 Decimation in Frequency CFFT & CIFFT Floating point processing function
emh203 0:3d9c67d97d6f 11 *
emh203 0:3d9c67d97d6f 12 *
emh203 0:3d9c67d97d6f 13 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emh203 0:3d9c67d97d6f 14 *
emh203 0:3d9c67d97d6f 15 * Redistribution and use in source and binary forms, with or without
emh203 0:3d9c67d97d6f 16 * modification, are permitted provided that the following conditions
emh203 0:3d9c67d97d6f 17 * are met:
emh203 0:3d9c67d97d6f 18 * - Redistributions of source code must retain the above copyright
emh203 0:3d9c67d97d6f 19 * notice, this list of conditions and the following disclaimer.
emh203 0:3d9c67d97d6f 20 * - Redistributions in binary form must reproduce the above copyright
emh203 0:3d9c67d97d6f 21 * notice, this list of conditions and the following disclaimer in
emh203 0:3d9c67d97d6f 22 * the documentation and/or other materials provided with the
emh203 0:3d9c67d97d6f 23 * distribution.
emh203 0:3d9c67d97d6f 24 * - Neither the name of ARM LIMITED nor the names of its contributors
emh203 0:3d9c67d97d6f 25 * may be used to endorse or promote products derived from this
emh203 0:3d9c67d97d6f 26 * software without specific prior written permission.
emh203 0:3d9c67d97d6f 27 *
emh203 0:3d9c67d97d6f 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
emh203 0:3d9c67d97d6f 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
emh203 0:3d9c67d97d6f 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
emh203 0:3d9c67d97d6f 31 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
emh203 0:3d9c67d97d6f 32 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
emh203 0:3d9c67d97d6f 33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
emh203 0:3d9c67d97d6f 34 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
emh203 0:3d9c67d97d6f 35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emh203 0:3d9c67d97d6f 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
emh203 0:3d9c67d97d6f 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
emh203 0:3d9c67d97d6f 38 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emh203 0:3d9c67d97d6f 39 * POSSIBILITY OF SUCH DAMAGE.
emh203 0:3d9c67d97d6f 40 * -------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 41
emh203 0:3d9c67d97d6f 42 #include "arm_math.h"
emh203 0:3d9c67d97d6f 43
emh203 0:3d9c67d97d6f 44 extern void arm_bitreversal_f32(
emh203 0:3d9c67d97d6f 45 float32_t * pSrc,
emh203 0:3d9c67d97d6f 46 uint16_t fftSize,
emh203 0:3d9c67d97d6f 47 uint16_t bitRevFactor,
emh203 0:3d9c67d97d6f 48 uint16_t * pBitRevTab);
emh203 0:3d9c67d97d6f 49
emh203 0:3d9c67d97d6f 50 /**
emh203 0:3d9c67d97d6f 51 * @ingroup groupTransforms
emh203 0:3d9c67d97d6f 52 */
emh203 0:3d9c67d97d6f 53
emh203 0:3d9c67d97d6f 54 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 55 ** Internal helper function used by the FFTs
emh203 0:3d9c67d97d6f 56 ** ------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 57
emh203 0:3d9c67d97d6f 58 /*
emh203 0:3d9c67d97d6f 59 * @brief Core function for the floating-point CFFT butterfly process.
emh203 0:3d9c67d97d6f 60 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
emh203 0:3d9c67d97d6f 61 * @param[in] fftLen length of the FFT.
emh203 0:3d9c67d97d6f 62 * @param[in] *pCoef points to the twiddle coefficient buffer.
emh203 0:3d9c67d97d6f 63 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
emh203 0:3d9c67d97d6f 64 * @return none.
emh203 0:3d9c67d97d6f 65 */
emh203 0:3d9c67d97d6f 66
emh203 0:3d9c67d97d6f 67 void arm_radix4_butterfly_f32(
emh203 0:3d9c67d97d6f 68 float32_t * pSrc,
emh203 0:3d9c67d97d6f 69 uint16_t fftLen,
emh203 0:3d9c67d97d6f 70 float32_t * pCoef,
emh203 0:3d9c67d97d6f 71 uint16_t twidCoefModifier)
emh203 0:3d9c67d97d6f 72 {
emh203 0:3d9c67d97d6f 73
emh203 0:3d9c67d97d6f 74 float32_t co1, co2, co3, si1, si2, si3;
emh203 0:3d9c67d97d6f 75 uint32_t ia1, ia2, ia3;
emh203 0:3d9c67d97d6f 76 uint32_t i0, i1, i2, i3;
emh203 0:3d9c67d97d6f 77 uint32_t n1, n2, j, k;
emh203 0:3d9c67d97d6f 78
emh203 0:3d9c67d97d6f 79 #ifndef ARM_MATH_CM0_FAMILY_FAMILY
emh203 0:3d9c67d97d6f 80
emh203 0:3d9c67d97d6f 81 /* Run the below code for Cortex-M4 and Cortex-M3 */
emh203 0:3d9c67d97d6f 82
emh203 0:3d9c67d97d6f 83 float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
emh203 0:3d9c67d97d6f 84 float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
emh203 0:3d9c67d97d6f 85 Ybminusd;
emh203 0:3d9c67d97d6f 86 float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
emh203 0:3d9c67d97d6f 87 float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
emh203 0:3d9c67d97d6f 88 float32_t *ptr1;
emh203 0:3d9c67d97d6f 89 float32_t p0,p1,p2,p3,p4,p5;
emh203 0:3d9c67d97d6f 90 float32_t a0,a1,a2,a3,a4,a5,a6,a7;
emh203 0:3d9c67d97d6f 91
emh203 0:3d9c67d97d6f 92 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 93 n2 = fftLen;
emh203 0:3d9c67d97d6f 94 n1 = n2;
emh203 0:3d9c67d97d6f 95
emh203 0:3d9c67d97d6f 96 /* n2 = fftLen/4 */
emh203 0:3d9c67d97d6f 97 n2 >>= 2u;
emh203 0:3d9c67d97d6f 98 i0 = 0u;
emh203 0:3d9c67d97d6f 99 ia1 = 0u;
emh203 0:3d9c67d97d6f 100
emh203 0:3d9c67d97d6f 101 j = n2;
emh203 0:3d9c67d97d6f 102
emh203 0:3d9c67d97d6f 103 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 104 do
emh203 0:3d9c67d97d6f 105 {
emh203 0:3d9c67d97d6f 106 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 107 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 108 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 109 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 110 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 111
emh203 0:3d9c67d97d6f 112 xaIn = pSrc[(2u * i0)];
emh203 0:3d9c67d97d6f 113 yaIn = pSrc[(2u * i0) + 1u];
emh203 0:3d9c67d97d6f 114
emh203 0:3d9c67d97d6f 115 xbIn = pSrc[(2u * i1)];
emh203 0:3d9c67d97d6f 116 ybIn = pSrc[(2u * i1) + 1u];
emh203 0:3d9c67d97d6f 117
emh203 0:3d9c67d97d6f 118 xcIn = pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 119 ycIn = pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 120
emh203 0:3d9c67d97d6f 121 xdIn = pSrc[(2u * i3)];
emh203 0:3d9c67d97d6f 122 ydIn = pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 123
emh203 0:3d9c67d97d6f 124 /* xa + xc */
emh203 0:3d9c67d97d6f 125 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 126 /* xb + xd */
emh203 0:3d9c67d97d6f 127 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 128 /* ya + yc */
emh203 0:3d9c67d97d6f 129 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 130 /* yb + yd */
emh203 0:3d9c67d97d6f 131 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 132
emh203 0:3d9c67d97d6f 133 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 134 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 135 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 136 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 137
emh203 0:3d9c67d97d6f 138 /* xa - xc */
emh203 0:3d9c67d97d6f 139 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 140 /* xb - xd */
emh203 0:3d9c67d97d6f 141 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 142 /* ya - yc */
emh203 0:3d9c67d97d6f 143 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 144 /* yb - yd */
emh203 0:3d9c67d97d6f 145 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 146
emh203 0:3d9c67d97d6f 147 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 148 pSrc[(2u * i0)] = Xaplusc + Xbplusd;
emh203 0:3d9c67d97d6f 149 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 150 pSrc[(2u * i0) + 1u] = Yaplusc + Ybplusd;
emh203 0:3d9c67d97d6f 151
emh203 0:3d9c67d97d6f 152 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 153 Xb12C_out = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 154 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 155 Yb12C_out = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 156 /* (xa + xc) - (xb + xd) */
emh203 0:3d9c67d97d6f 157 Xc12C_out = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 158 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 159 Yc12C_out = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 160 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 161 Xd12C_out = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 162 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 163 Yd12C_out = (Xbminusd + Yaminusc);
emh203 0:3d9c67d97d6f 164
emh203 0:3d9c67d97d6f 165 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 166 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 167
emh203 0:3d9c67d97d6f 168 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 169 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 170 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 171 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 172
emh203 0:3d9c67d97d6f 173 Xb12_out = Xb12C_out * co1;
emh203 0:3d9c67d97d6f 174 Yb12_out = Yb12C_out * co1;
emh203 0:3d9c67d97d6f 175 Xc12_out = Xc12C_out * co2;
emh203 0:3d9c67d97d6f 176 Yc12_out = Yc12C_out * co2;
emh203 0:3d9c67d97d6f 177 Xd12_out = Xd12C_out * co3;
emh203 0:3d9c67d97d6f 178 Yd12_out = Yd12C_out * co3;
emh203 0:3d9c67d97d6f 179
emh203 0:3d9c67d97d6f 180 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 181 //Xb12_out -= Yb12C_out * si1;
emh203 0:3d9c67d97d6f 182 p0 = Yb12C_out * si1;
emh203 0:3d9c67d97d6f 183 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 184 //Yb12_out += Xb12C_out * si1;
emh203 0:3d9c67d97d6f 185 p1 = Xb12C_out * si1;
emh203 0:3d9c67d97d6f 186 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 187 //Xc12_out -= Yc12C_out * si2;
emh203 0:3d9c67d97d6f 188 p2 = Yc12C_out * si2;
emh203 0:3d9c67d97d6f 189 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 190 //Yc12_out += Xc12C_out * si2;
emh203 0:3d9c67d97d6f 191 p3 = Xc12C_out * si2;
emh203 0:3d9c67d97d6f 192 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 193 //Xd12_out -= Yd12C_out * si3;
emh203 0:3d9c67d97d6f 194 p4 = Yd12C_out * si3;
emh203 0:3d9c67d97d6f 195 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 196 //Yd12_out += Xd12C_out * si3;
emh203 0:3d9c67d97d6f 197 p5 = Xd12C_out * si3;
emh203 0:3d9c67d97d6f 198
emh203 0:3d9c67d97d6f 199 Xb12_out += p0;
emh203 0:3d9c67d97d6f 200 Yb12_out -= p1;
emh203 0:3d9c67d97d6f 201 Xc12_out += p2;
emh203 0:3d9c67d97d6f 202 Yc12_out -= p3;
emh203 0:3d9c67d97d6f 203 Xd12_out += p4;
emh203 0:3d9c67d97d6f 204 Yd12_out -= p5;
emh203 0:3d9c67d97d6f 205
emh203 0:3d9c67d97d6f 206 /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 207 pSrc[2u * i1] = Xc12_out;
emh203 0:3d9c67d97d6f 208
emh203 0:3d9c67d97d6f 209 /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 210 pSrc[(2u * i1) + 1u] = Yc12_out;
emh203 0:3d9c67d97d6f 211
emh203 0:3d9c67d97d6f 212 /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 213 pSrc[2u * i2] = Xb12_out;
emh203 0:3d9c67d97d6f 214
emh203 0:3d9c67d97d6f 215 /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 216 pSrc[(2u * i2) + 1u] = Yb12_out;
emh203 0:3d9c67d97d6f 217
emh203 0:3d9c67d97d6f 218 /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 219 pSrc[2u * i3] = Xd12_out;
emh203 0:3d9c67d97d6f 220
emh203 0:3d9c67d97d6f 221 /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 222 pSrc[(2u * i3) + 1u] = Yd12_out;
emh203 0:3d9c67d97d6f 223
emh203 0:3d9c67d97d6f 224 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 225 ia1 += twidCoefModifier;
emh203 0:3d9c67d97d6f 226
emh203 0:3d9c67d97d6f 227 /* Updating input index */
emh203 0:3d9c67d97d6f 228 i0++;
emh203 0:3d9c67d97d6f 229
emh203 0:3d9c67d97d6f 230 }
emh203 0:3d9c67d97d6f 231 while(--j);
emh203 0:3d9c67d97d6f 232
emh203 0:3d9c67d97d6f 233 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 234
emh203 0:3d9c67d97d6f 235 /* Calculation of second stage to excluding last stage */
emh203 0:3d9c67d97d6f 236 for (k = fftLen >> 2u; k > 4u; k >>= 2u)
emh203 0:3d9c67d97d6f 237 {
emh203 0:3d9c67d97d6f 238 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 239 n1 = n2;
emh203 0:3d9c67d97d6f 240 n2 >>= 2u;
emh203 0:3d9c67d97d6f 241 ia1 = 0u;
emh203 0:3d9c67d97d6f 242
emh203 0:3d9c67d97d6f 243 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 244 j = 0;
emh203 0:3d9c67d97d6f 245 do
emh203 0:3d9c67d97d6f 246 {
emh203 0:3d9c67d97d6f 247 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 248 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 249 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 250 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 251 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 252 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 253 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 254 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 255 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 256
emh203 0:3d9c67d97d6f 257 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 258 ia1 += twidCoefModifier;
emh203 0:3d9c67d97d6f 259
emh203 0:3d9c67d97d6f 260 i0 = j;
emh203 0:3d9c67d97d6f 261 do
emh203 0:3d9c67d97d6f 262 {
emh203 0:3d9c67d97d6f 263 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 264 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 265 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 266 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 267 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 268
emh203 0:3d9c67d97d6f 269 xaIn = pSrc[(2u * i0)];
emh203 0:3d9c67d97d6f 270 yaIn = pSrc[(2u * i0) + 1u];
emh203 0:3d9c67d97d6f 271
emh203 0:3d9c67d97d6f 272 xbIn = pSrc[(2u * i1)];
emh203 0:3d9c67d97d6f 273 ybIn = pSrc[(2u * i1) + 1u];
emh203 0:3d9c67d97d6f 274
emh203 0:3d9c67d97d6f 275 xcIn = pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 276 ycIn = pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 277
emh203 0:3d9c67d97d6f 278 xdIn = pSrc[(2u * i3)];
emh203 0:3d9c67d97d6f 279 ydIn = pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 280
emh203 0:3d9c67d97d6f 281 /* xa - xc */
emh203 0:3d9c67d97d6f 282 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 283 /* (xb - xd) */
emh203 0:3d9c67d97d6f 284 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 285 /* ya - yc */
emh203 0:3d9c67d97d6f 286 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 287 /* (yb - yd) */
emh203 0:3d9c67d97d6f 288 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 289
emh203 0:3d9c67d97d6f 290 /* xa + xc */
emh203 0:3d9c67d97d6f 291 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 292 /* xb + xd */
emh203 0:3d9c67d97d6f 293 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 294 /* ya + yc */
emh203 0:3d9c67d97d6f 295 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 296 /* yb + yd */
emh203 0:3d9c67d97d6f 297 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 298
emh203 0:3d9c67d97d6f 299 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 300 Xb12C_out = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 301 /* (ya - yc) - (xb - xd) */
emh203 0:3d9c67d97d6f 302 Yb12C_out = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 303 /* xa + xc -(xb + xd) */
emh203 0:3d9c67d97d6f 304 Xc12C_out = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 305 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 306 Yc12C_out = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 307 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 308 Xd12C_out = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 309 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 310 Yd12C_out = (Xbminusd + Yaminusc);
emh203 0:3d9c67d97d6f 311
emh203 0:3d9c67d97d6f 312 pSrc[(2u * i0)] = Xaplusc + Xbplusd;
emh203 0:3d9c67d97d6f 313 pSrc[(2u * i0) + 1u] = Yaplusc + Ybplusd;
emh203 0:3d9c67d97d6f 314
emh203 0:3d9c67d97d6f 315 Xb12_out = Xb12C_out * co1;
emh203 0:3d9c67d97d6f 316 Yb12_out = Yb12C_out * co1;
emh203 0:3d9c67d97d6f 317 Xc12_out = Xc12C_out * co2;
emh203 0:3d9c67d97d6f 318 Yc12_out = Yc12C_out * co2;
emh203 0:3d9c67d97d6f 319 Xd12_out = Xd12C_out * co3;
emh203 0:3d9c67d97d6f 320 Yd12_out = Yd12C_out * co3;
emh203 0:3d9c67d97d6f 321
emh203 0:3d9c67d97d6f 322 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 323 //Xb12_out -= Yb12C_out * si1;
emh203 0:3d9c67d97d6f 324 p0 = Yb12C_out * si1;
emh203 0:3d9c67d97d6f 325 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 326 //Yb12_out += Xb12C_out * si1;
emh203 0:3d9c67d97d6f 327 p1 = Xb12C_out * si1;
emh203 0:3d9c67d97d6f 328 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 329 //Xc12_out -= Yc12C_out * si2;
emh203 0:3d9c67d97d6f 330 p2 = Yc12C_out * si2;
emh203 0:3d9c67d97d6f 331 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 332 //Yc12_out += Xc12C_out * si2;
emh203 0:3d9c67d97d6f 333 p3 = Xc12C_out * si2;
emh203 0:3d9c67d97d6f 334 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 335 //Xd12_out -= Yd12C_out * si3;
emh203 0:3d9c67d97d6f 336 p4 = Yd12C_out * si3;
emh203 0:3d9c67d97d6f 337 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 338 //Yd12_out += Xd12C_out * si3;
emh203 0:3d9c67d97d6f 339 p5 = Xd12C_out * si3;
emh203 0:3d9c67d97d6f 340
emh203 0:3d9c67d97d6f 341 Xb12_out += p0;
emh203 0:3d9c67d97d6f 342 Yb12_out -= p1;
emh203 0:3d9c67d97d6f 343 Xc12_out += p2;
emh203 0:3d9c67d97d6f 344 Yc12_out -= p3;
emh203 0:3d9c67d97d6f 345 Xd12_out += p4;
emh203 0:3d9c67d97d6f 346 Yd12_out -= p5;
emh203 0:3d9c67d97d6f 347
emh203 0:3d9c67d97d6f 348 /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 349 pSrc[2u * i1] = Xc12_out;
emh203 0:3d9c67d97d6f 350
emh203 0:3d9c67d97d6f 351 /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 352 pSrc[(2u * i1) + 1u] = Yc12_out;
emh203 0:3d9c67d97d6f 353
emh203 0:3d9c67d97d6f 354 /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 355 pSrc[2u * i2] = Xb12_out;
emh203 0:3d9c67d97d6f 356
emh203 0:3d9c67d97d6f 357 /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 358 pSrc[(2u * i2) + 1u] = Yb12_out;
emh203 0:3d9c67d97d6f 359
emh203 0:3d9c67d97d6f 360 /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 361 pSrc[2u * i3] = Xd12_out;
emh203 0:3d9c67d97d6f 362
emh203 0:3d9c67d97d6f 363 /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 364 pSrc[(2u * i3) + 1u] = Yd12_out;
emh203 0:3d9c67d97d6f 365
emh203 0:3d9c67d97d6f 366 i0 += n1;
emh203 0:3d9c67d97d6f 367 } while(i0 < fftLen);
emh203 0:3d9c67d97d6f 368 j++;
emh203 0:3d9c67d97d6f 369 } while(j <= (n2 - 1u));
emh203 0:3d9c67d97d6f 370 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 371 }
emh203 0:3d9c67d97d6f 372
emh203 0:3d9c67d97d6f 373 j = fftLen >> 2;
emh203 0:3d9c67d97d6f 374 ptr1 = &pSrc[0];
emh203 0:3d9c67d97d6f 375
emh203 0:3d9c67d97d6f 376 /* Calculations of last stage */
emh203 0:3d9c67d97d6f 377 do
emh203 0:3d9c67d97d6f 378 {
emh203 0:3d9c67d97d6f 379 xaIn = ptr1[0];
emh203 0:3d9c67d97d6f 380 yaIn = ptr1[1];
emh203 0:3d9c67d97d6f 381 xbIn = ptr1[2];
emh203 0:3d9c67d97d6f 382 ybIn = ptr1[3];
emh203 0:3d9c67d97d6f 383 xcIn = ptr1[4];
emh203 0:3d9c67d97d6f 384 ycIn = ptr1[5];
emh203 0:3d9c67d97d6f 385 xdIn = ptr1[6];
emh203 0:3d9c67d97d6f 386 ydIn = ptr1[7];
emh203 0:3d9c67d97d6f 387
emh203 0:3d9c67d97d6f 388 /* xa + xc */
emh203 0:3d9c67d97d6f 389 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 390
emh203 0:3d9c67d97d6f 391 /* xa - xc */
emh203 0:3d9c67d97d6f 392 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 393
emh203 0:3d9c67d97d6f 394 /* ya + yc */
emh203 0:3d9c67d97d6f 395 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 396
emh203 0:3d9c67d97d6f 397 /* ya - yc */
emh203 0:3d9c67d97d6f 398 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 399
emh203 0:3d9c67d97d6f 400 /* xb + xd */
emh203 0:3d9c67d97d6f 401 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 402
emh203 0:3d9c67d97d6f 403 /* yb + yd */
emh203 0:3d9c67d97d6f 404 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 405
emh203 0:3d9c67d97d6f 406 /* (xb-xd) */
emh203 0:3d9c67d97d6f 407 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 408
emh203 0:3d9c67d97d6f 409 /* (yb-yd) */
emh203 0:3d9c67d97d6f 410 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 411
emh203 0:3d9c67d97d6f 412 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 413 a0 = (Xaplusc + Xbplusd);
emh203 0:3d9c67d97d6f 414 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 415 a1 = (Yaplusc + Ybplusd);
emh203 0:3d9c67d97d6f 416 /* xc' = (xa-xb+xc-xd) */
emh203 0:3d9c67d97d6f 417 a2 = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 418 /* yc' = (ya-yb+yc-yd) */
emh203 0:3d9c67d97d6f 419 a3 = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 420 /* xb' = (xa+yb-xc-yd) */
emh203 0:3d9c67d97d6f 421 a4 = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 422 /* yb' = (ya-xb-yc+xd) */
emh203 0:3d9c67d97d6f 423 a5 = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 424 /* xd' = (xa-yb-xc+yd)) */
emh203 0:3d9c67d97d6f 425 a6 = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 426 /* yd' = (ya+xb-yc-xd) */
emh203 0:3d9c67d97d6f 427 a7 = (Xbminusd + Yaminusc);
emh203 0:3d9c67d97d6f 428
emh203 0:3d9c67d97d6f 429 ptr1[0] = a0;
emh203 0:3d9c67d97d6f 430 ptr1[1] = a1;
emh203 0:3d9c67d97d6f 431 ptr1[2] = a2;
emh203 0:3d9c67d97d6f 432 ptr1[3] = a3;
emh203 0:3d9c67d97d6f 433 ptr1[4] = a4;
emh203 0:3d9c67d97d6f 434 ptr1[5] = a5;
emh203 0:3d9c67d97d6f 435 ptr1[6] = a6;
emh203 0:3d9c67d97d6f 436 ptr1[7] = a7;
emh203 0:3d9c67d97d6f 437
emh203 0:3d9c67d97d6f 438 /* increment pointer by 8 */
emh203 0:3d9c67d97d6f 439 ptr1 += 8u;
emh203 0:3d9c67d97d6f 440 } while(--j);
emh203 0:3d9c67d97d6f 441
emh203 0:3d9c67d97d6f 442 #else
emh203 0:3d9c67d97d6f 443
emh203 0:3d9c67d97d6f 444 float32_t t1, t2, r1, r2, s1, s2;
emh203 0:3d9c67d97d6f 445
emh203 0:3d9c67d97d6f 446 /* Run the below code for Cortex-M0 */
emh203 0:3d9c67d97d6f 447
emh203 0:3d9c67d97d6f 448 /* Initializations for the fft calculation */
emh203 0:3d9c67d97d6f 449 n2 = fftLen;
emh203 0:3d9c67d97d6f 450 n1 = n2;
emh203 0:3d9c67d97d6f 451 for (k = fftLen; k > 1u; k >>= 2u)
emh203 0:3d9c67d97d6f 452 {
emh203 0:3d9c67d97d6f 453 /* Initializations for the fft calculation */
emh203 0:3d9c67d97d6f 454 n1 = n2;
emh203 0:3d9c67d97d6f 455 n2 >>= 2u;
emh203 0:3d9c67d97d6f 456 ia1 = 0u;
emh203 0:3d9c67d97d6f 457
emh203 0:3d9c67d97d6f 458 /* FFT Calculation */
emh203 0:3d9c67d97d6f 459 j = 0;
emh203 0:3d9c67d97d6f 460 do
emh203 0:3d9c67d97d6f 461 {
emh203 0:3d9c67d97d6f 462 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 463 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 464 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 465 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 466 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 467 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 468 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 469 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 470 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 471
emh203 0:3d9c67d97d6f 472 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 473 ia1 = ia1 + twidCoefModifier;
emh203 0:3d9c67d97d6f 474
emh203 0:3d9c67d97d6f 475 i0 = j;
emh203 0:3d9c67d97d6f 476 do
emh203 0:3d9c67d97d6f 477 {
emh203 0:3d9c67d97d6f 478 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 479 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 480 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 481 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 482 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 483
emh203 0:3d9c67d97d6f 484 /* xa + xc */
emh203 0:3d9c67d97d6f 485 r1 = pSrc[(2u * i0)] + pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 486
emh203 0:3d9c67d97d6f 487 /* xa - xc */
emh203 0:3d9c67d97d6f 488 r2 = pSrc[(2u * i0)] - pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 489
emh203 0:3d9c67d97d6f 490 /* ya + yc */
emh203 0:3d9c67d97d6f 491 s1 = pSrc[(2u * i0) + 1u] + pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 492
emh203 0:3d9c67d97d6f 493 /* ya - yc */
emh203 0:3d9c67d97d6f 494 s2 = pSrc[(2u * i0) + 1u] - pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 495
emh203 0:3d9c67d97d6f 496 /* xb + xd */
emh203 0:3d9c67d97d6f 497 t1 = pSrc[2u * i1] + pSrc[2u * i3];
emh203 0:3d9c67d97d6f 498
emh203 0:3d9c67d97d6f 499 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 500 pSrc[2u * i0] = r1 + t1;
emh203 0:3d9c67d97d6f 501
emh203 0:3d9c67d97d6f 502 /* xa + xc -(xb + xd) */
emh203 0:3d9c67d97d6f 503 r1 = r1 - t1;
emh203 0:3d9c67d97d6f 504
emh203 0:3d9c67d97d6f 505 /* yb + yd */
emh203 0:3d9c67d97d6f 506 t2 = pSrc[(2u * i1) + 1u] + pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 507
emh203 0:3d9c67d97d6f 508 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 509 pSrc[(2u * i0) + 1u] = s1 + t2;
emh203 0:3d9c67d97d6f 510
emh203 0:3d9c67d97d6f 511 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 512 s1 = s1 - t2;
emh203 0:3d9c67d97d6f 513
emh203 0:3d9c67d97d6f 514 /* (yb - yd) */
emh203 0:3d9c67d97d6f 515 t1 = pSrc[(2u * i1) + 1u] - pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 516
emh203 0:3d9c67d97d6f 517 /* (xb - xd) */
emh203 0:3d9c67d97d6f 518 t2 = pSrc[2u * i1] - pSrc[2u * i3];
emh203 0:3d9c67d97d6f 519
emh203 0:3d9c67d97d6f 520 /* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 521 pSrc[2u * i1] = (r1 * co2) + (s1 * si2);
emh203 0:3d9c67d97d6f 522
emh203 0:3d9c67d97d6f 523 /* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 524 pSrc[(2u * i1) + 1u] = (s1 * co2) - (r1 * si2);
emh203 0:3d9c67d97d6f 525
emh203 0:3d9c67d97d6f 526 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 527 r1 = r2 + t1;
emh203 0:3d9c67d97d6f 528
emh203 0:3d9c67d97d6f 529 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 530 r2 = r2 - t1;
emh203 0:3d9c67d97d6f 531
emh203 0:3d9c67d97d6f 532 /* (ya - yc) - (xb - xd) */
emh203 0:3d9c67d97d6f 533 s1 = s2 - t2;
emh203 0:3d9c67d97d6f 534
emh203 0:3d9c67d97d6f 535 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 536 s2 = s2 + t2;
emh203 0:3d9c67d97d6f 537
emh203 0:3d9c67d97d6f 538 /* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 539 pSrc[2u * i2] = (r1 * co1) + (s1 * si1);
emh203 0:3d9c67d97d6f 540
emh203 0:3d9c67d97d6f 541 /* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 542 pSrc[(2u * i2) + 1u] = (s1 * co1) - (r1 * si1);
emh203 0:3d9c67d97d6f 543
emh203 0:3d9c67d97d6f 544 /* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 545 pSrc[2u * i3] = (r2 * co3) + (s2 * si3);
emh203 0:3d9c67d97d6f 546
emh203 0:3d9c67d97d6f 547 /* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 548 pSrc[(2u * i3) + 1u] = (s2 * co3) - (r2 * si3);
emh203 0:3d9c67d97d6f 549
emh203 0:3d9c67d97d6f 550 i0 += n1;
emh203 0:3d9c67d97d6f 551 } while( i0 < fftLen);
emh203 0:3d9c67d97d6f 552 j++;
emh203 0:3d9c67d97d6f 553 } while(j <= (n2 - 1u));
emh203 0:3d9c67d97d6f 554 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 555 }
emh203 0:3d9c67d97d6f 556
emh203 0:3d9c67d97d6f 557 #endif /* #ifndef ARM_MATH_CM0_FAMILY_FAMILY */
emh203 0:3d9c67d97d6f 558
emh203 0:3d9c67d97d6f 559 }
emh203 0:3d9c67d97d6f 560
emh203 0:3d9c67d97d6f 561 /*
emh203 0:3d9c67d97d6f 562 * @brief Core function for the floating-point CIFFT butterfly process.
emh203 0:3d9c67d97d6f 563 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
emh203 0:3d9c67d97d6f 564 * @param[in] fftLen length of the FFT.
emh203 0:3d9c67d97d6f 565 * @param[in] *pCoef points to twiddle coefficient buffer.
emh203 0:3d9c67d97d6f 566 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
emh203 0:3d9c67d97d6f 567 * @param[in] onebyfftLen value of 1/fftLen.
emh203 0:3d9c67d97d6f 568 * @return none.
emh203 0:3d9c67d97d6f 569 */
emh203 0:3d9c67d97d6f 570
emh203 0:3d9c67d97d6f 571 void arm_radix4_butterfly_inverse_f32(
emh203 0:3d9c67d97d6f 572 float32_t * pSrc,
emh203 0:3d9c67d97d6f 573 uint16_t fftLen,
emh203 0:3d9c67d97d6f 574 float32_t * pCoef,
emh203 0:3d9c67d97d6f 575 uint16_t twidCoefModifier,
emh203 0:3d9c67d97d6f 576 float32_t onebyfftLen)
emh203 0:3d9c67d97d6f 577 {
emh203 0:3d9c67d97d6f 578 float32_t co1, co2, co3, si1, si2, si3;
emh203 0:3d9c67d97d6f 579 uint32_t ia1, ia2, ia3;
emh203 0:3d9c67d97d6f 580 uint32_t i0, i1, i2, i3;
emh203 0:3d9c67d97d6f 581 uint32_t n1, n2, j, k;
emh203 0:3d9c67d97d6f 582
emh203 0:3d9c67d97d6f 583 #ifndef ARM_MATH_CM0_FAMILY_FAMILY
emh203 0:3d9c67d97d6f 584
emh203 0:3d9c67d97d6f 585 float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
emh203 0:3d9c67d97d6f 586 float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
emh203 0:3d9c67d97d6f 587 Ybminusd;
emh203 0:3d9c67d97d6f 588 float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
emh203 0:3d9c67d97d6f 589 float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
emh203 0:3d9c67d97d6f 590 float32_t *ptr1;
emh203 0:3d9c67d97d6f 591 float32_t p0,p1,p2,p3,p4,p5,p6,p7;
emh203 0:3d9c67d97d6f 592 float32_t a0,a1,a2,a3,a4,a5,a6,a7;
emh203 0:3d9c67d97d6f 593
emh203 0:3d9c67d97d6f 594
emh203 0:3d9c67d97d6f 595 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 596 n2 = fftLen;
emh203 0:3d9c67d97d6f 597 n1 = n2;
emh203 0:3d9c67d97d6f 598
emh203 0:3d9c67d97d6f 599 /* n2 = fftLen/4 */
emh203 0:3d9c67d97d6f 600 n2 >>= 2u;
emh203 0:3d9c67d97d6f 601 i0 = 0u;
emh203 0:3d9c67d97d6f 602 ia1 = 0u;
emh203 0:3d9c67d97d6f 603
emh203 0:3d9c67d97d6f 604 j = n2;
emh203 0:3d9c67d97d6f 605
emh203 0:3d9c67d97d6f 606 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 607 do
emh203 0:3d9c67d97d6f 608 {
emh203 0:3d9c67d97d6f 609 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 610 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 611 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 612 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 613 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 614
emh203 0:3d9c67d97d6f 615 /* Butterfly implementation */
emh203 0:3d9c67d97d6f 616 xaIn = pSrc[(2u * i0)];
emh203 0:3d9c67d97d6f 617 yaIn = pSrc[(2u * i0) + 1u];
emh203 0:3d9c67d97d6f 618
emh203 0:3d9c67d97d6f 619 xcIn = pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 620 ycIn = pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 621
emh203 0:3d9c67d97d6f 622 xbIn = pSrc[(2u * i1)];
emh203 0:3d9c67d97d6f 623 ybIn = pSrc[(2u * i1) + 1u];
emh203 0:3d9c67d97d6f 624
emh203 0:3d9c67d97d6f 625 xdIn = pSrc[(2u * i3)];
emh203 0:3d9c67d97d6f 626 ydIn = pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 627
emh203 0:3d9c67d97d6f 628 /* xa + xc */
emh203 0:3d9c67d97d6f 629 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 630 /* xb + xd */
emh203 0:3d9c67d97d6f 631 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 632 /* ya + yc */
emh203 0:3d9c67d97d6f 633 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 634 /* yb + yd */
emh203 0:3d9c67d97d6f 635 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 636
emh203 0:3d9c67d97d6f 637 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 638 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 639 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 640 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 641
emh203 0:3d9c67d97d6f 642 /* xa - xc */
emh203 0:3d9c67d97d6f 643 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 644 /* xb - xd */
emh203 0:3d9c67d97d6f 645 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 646 /* ya - yc */
emh203 0:3d9c67d97d6f 647 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 648 /* yb - yd */
emh203 0:3d9c67d97d6f 649 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 650
emh203 0:3d9c67d97d6f 651 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 652 pSrc[(2u * i0)] = Xaplusc + Xbplusd;
emh203 0:3d9c67d97d6f 653
emh203 0:3d9c67d97d6f 654 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 655 pSrc[(2u * i0) + 1u] = Yaplusc + Ybplusd;
emh203 0:3d9c67d97d6f 656
emh203 0:3d9c67d97d6f 657 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 658 Xb12C_out = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 659 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 660 Yb12C_out = (Yaminusc + Xbminusd);
emh203 0:3d9c67d97d6f 661 /* (xa + xc) - (xb + xd) */
emh203 0:3d9c67d97d6f 662 Xc12C_out = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 663 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 664 Yc12C_out = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 665 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 666 Xd12C_out = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 667 /* (ya - yc) - (xb - xd) */
emh203 0:3d9c67d97d6f 668 Yd12C_out = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 669
emh203 0:3d9c67d97d6f 670 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 671 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 672
emh203 0:3d9c67d97d6f 673 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 674 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 675 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 676 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 677
emh203 0:3d9c67d97d6f 678 Xb12_out = Xb12C_out * co1;
emh203 0:3d9c67d97d6f 679 Yb12_out = Yb12C_out * co1;
emh203 0:3d9c67d97d6f 680 Xc12_out = Xc12C_out * co2;
emh203 0:3d9c67d97d6f 681 Yc12_out = Yc12C_out * co2;
emh203 0:3d9c67d97d6f 682 Xd12_out = Xd12C_out * co3;
emh203 0:3d9c67d97d6f 683 Yd12_out = Yd12C_out * co3;
emh203 0:3d9c67d97d6f 684
emh203 0:3d9c67d97d6f 685 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 686 //Xb12_out -= Yb12C_out * si1;
emh203 0:3d9c67d97d6f 687 p0 = Yb12C_out * si1;
emh203 0:3d9c67d97d6f 688 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 689 //Yb12_out += Xb12C_out * si1;
emh203 0:3d9c67d97d6f 690 p1 = Xb12C_out * si1;
emh203 0:3d9c67d97d6f 691 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 692 //Xc12_out -= Yc12C_out * si2;
emh203 0:3d9c67d97d6f 693 p2 = Yc12C_out * si2;
emh203 0:3d9c67d97d6f 694 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 695 //Yc12_out += Xc12C_out * si2;
emh203 0:3d9c67d97d6f 696 p3 = Xc12C_out * si2;
emh203 0:3d9c67d97d6f 697 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 698 //Xd12_out -= Yd12C_out * si3;
emh203 0:3d9c67d97d6f 699 p4 = Yd12C_out * si3;
emh203 0:3d9c67d97d6f 700 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 701 //Yd12_out += Xd12C_out * si3;
emh203 0:3d9c67d97d6f 702 p5 = Xd12C_out * si3;
emh203 0:3d9c67d97d6f 703
emh203 0:3d9c67d97d6f 704 Xb12_out -= p0;
emh203 0:3d9c67d97d6f 705 Yb12_out += p1;
emh203 0:3d9c67d97d6f 706 Xc12_out -= p2;
emh203 0:3d9c67d97d6f 707 Yc12_out += p3;
emh203 0:3d9c67d97d6f 708 Xd12_out -= p4;
emh203 0:3d9c67d97d6f 709 Yd12_out += p5;
emh203 0:3d9c67d97d6f 710
emh203 0:3d9c67d97d6f 711 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 712 pSrc[2u * i1] = Xc12_out;
emh203 0:3d9c67d97d6f 713
emh203 0:3d9c67d97d6f 714 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 715 pSrc[(2u * i1) + 1u] = Yc12_out;
emh203 0:3d9c67d97d6f 716
emh203 0:3d9c67d97d6f 717 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 718 pSrc[2u * i2] = Xb12_out;
emh203 0:3d9c67d97d6f 719
emh203 0:3d9c67d97d6f 720 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 721 pSrc[(2u * i2) + 1u] = Yb12_out;
emh203 0:3d9c67d97d6f 722
emh203 0:3d9c67d97d6f 723 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 724 pSrc[2u * i3] = Xd12_out;
emh203 0:3d9c67d97d6f 725
emh203 0:3d9c67d97d6f 726 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 727 pSrc[(2u * i3) + 1u] = Yd12_out;
emh203 0:3d9c67d97d6f 728
emh203 0:3d9c67d97d6f 729 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 730 ia1 = ia1 + twidCoefModifier;
emh203 0:3d9c67d97d6f 731
emh203 0:3d9c67d97d6f 732 /* Updating input index */
emh203 0:3d9c67d97d6f 733 i0 = i0 + 1u;
emh203 0:3d9c67d97d6f 734
emh203 0:3d9c67d97d6f 735 } while(--j);
emh203 0:3d9c67d97d6f 736
emh203 0:3d9c67d97d6f 737 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 738
emh203 0:3d9c67d97d6f 739 /* Calculation of second stage to excluding last stage */
emh203 0:3d9c67d97d6f 740 for (k = fftLen >> 2u; k > 4u; k >>= 2u)
emh203 0:3d9c67d97d6f 741 {
emh203 0:3d9c67d97d6f 742 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 743 n1 = n2;
emh203 0:3d9c67d97d6f 744 n2 >>= 2u;
emh203 0:3d9c67d97d6f 745 ia1 = 0u;
emh203 0:3d9c67d97d6f 746
emh203 0:3d9c67d97d6f 747 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 748 j = 0;
emh203 0:3d9c67d97d6f 749 do
emh203 0:3d9c67d97d6f 750 {
emh203 0:3d9c67d97d6f 751 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 752 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 753 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 754 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 755 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 756 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 757 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 758 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 759 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 760
emh203 0:3d9c67d97d6f 761 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 762 ia1 = ia1 + twidCoefModifier;
emh203 0:3d9c67d97d6f 763
emh203 0:3d9c67d97d6f 764 i0 = j;
emh203 0:3d9c67d97d6f 765 do
emh203 0:3d9c67d97d6f 766 {
emh203 0:3d9c67d97d6f 767 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 768 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 769 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 770 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 771 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 772
emh203 0:3d9c67d97d6f 773 xaIn = pSrc[(2u * i0)];
emh203 0:3d9c67d97d6f 774 yaIn = pSrc[(2u * i0) + 1u];
emh203 0:3d9c67d97d6f 775
emh203 0:3d9c67d97d6f 776 xbIn = pSrc[(2u * i1)];
emh203 0:3d9c67d97d6f 777 ybIn = pSrc[(2u * i1) + 1u];
emh203 0:3d9c67d97d6f 778
emh203 0:3d9c67d97d6f 779 xcIn = pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 780 ycIn = pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 781
emh203 0:3d9c67d97d6f 782 xdIn = pSrc[(2u * i3)];
emh203 0:3d9c67d97d6f 783 ydIn = pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 784
emh203 0:3d9c67d97d6f 785 /* xa - xc */
emh203 0:3d9c67d97d6f 786 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 787 /* (xb - xd) */
emh203 0:3d9c67d97d6f 788 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 789 /* ya - yc */
emh203 0:3d9c67d97d6f 790 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 791 /* (yb - yd) */
emh203 0:3d9c67d97d6f 792 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 793
emh203 0:3d9c67d97d6f 794 /* xa + xc */
emh203 0:3d9c67d97d6f 795 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 796 /* xb + xd */
emh203 0:3d9c67d97d6f 797 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 798 /* ya + yc */
emh203 0:3d9c67d97d6f 799 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 800 /* yb + yd */
emh203 0:3d9c67d97d6f 801 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 802
emh203 0:3d9c67d97d6f 803 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 804 Xb12C_out = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 805 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 806 Yb12C_out = (Yaminusc + Xbminusd);
emh203 0:3d9c67d97d6f 807 /* xa + xc -(xb + xd) */
emh203 0:3d9c67d97d6f 808 Xc12C_out = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 809 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 810 Yc12C_out = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 811 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 812 Xd12C_out = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 813 /* (ya - yc) - (xb - xd) */
emh203 0:3d9c67d97d6f 814 Yd12C_out = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 815
emh203 0:3d9c67d97d6f 816 pSrc[(2u * i0)] = Xaplusc + Xbplusd;
emh203 0:3d9c67d97d6f 817 pSrc[(2u * i0) + 1u] = Yaplusc + Ybplusd;
emh203 0:3d9c67d97d6f 818
emh203 0:3d9c67d97d6f 819 Xb12_out = Xb12C_out * co1;
emh203 0:3d9c67d97d6f 820 Yb12_out = Yb12C_out * co1;
emh203 0:3d9c67d97d6f 821 Xc12_out = Xc12C_out * co2;
emh203 0:3d9c67d97d6f 822 Yc12_out = Yc12C_out * co2;
emh203 0:3d9c67d97d6f 823 Xd12_out = Xd12C_out * co3;
emh203 0:3d9c67d97d6f 824 Yd12_out = Yd12C_out * co3;
emh203 0:3d9c67d97d6f 825
emh203 0:3d9c67d97d6f 826 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 827 //Xb12_out -= Yb12C_out * si1;
emh203 0:3d9c67d97d6f 828 p0 = Yb12C_out * si1;
emh203 0:3d9c67d97d6f 829 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 830 //Yb12_out += Xb12C_out * si1;
emh203 0:3d9c67d97d6f 831 p1 = Xb12C_out * si1;
emh203 0:3d9c67d97d6f 832 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 833 //Xc12_out -= Yc12C_out * si2;
emh203 0:3d9c67d97d6f 834 p2 = Yc12C_out * si2;
emh203 0:3d9c67d97d6f 835 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 836 //Yc12_out += Xc12C_out * si2;
emh203 0:3d9c67d97d6f 837 p3 = Xc12C_out * si2;
emh203 0:3d9c67d97d6f 838 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 839 //Xd12_out -= Yd12C_out * si3;
emh203 0:3d9c67d97d6f 840 p4 = Yd12C_out * si3;
emh203 0:3d9c67d97d6f 841 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 842 //Yd12_out += Xd12C_out * si3;
emh203 0:3d9c67d97d6f 843 p5 = Xd12C_out * si3;
emh203 0:3d9c67d97d6f 844
emh203 0:3d9c67d97d6f 845 Xb12_out -= p0;
emh203 0:3d9c67d97d6f 846 Yb12_out += p1;
emh203 0:3d9c67d97d6f 847 Xc12_out -= p2;
emh203 0:3d9c67d97d6f 848 Yc12_out += p3;
emh203 0:3d9c67d97d6f 849 Xd12_out -= p4;
emh203 0:3d9c67d97d6f 850 Yd12_out += p5;
emh203 0:3d9c67d97d6f 851
emh203 0:3d9c67d97d6f 852 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 853 pSrc[2u * i1] = Xc12_out;
emh203 0:3d9c67d97d6f 854
emh203 0:3d9c67d97d6f 855 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 856 pSrc[(2u * i1) + 1u] = Yc12_out;
emh203 0:3d9c67d97d6f 857
emh203 0:3d9c67d97d6f 858 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 859 pSrc[2u * i2] = Xb12_out;
emh203 0:3d9c67d97d6f 860
emh203 0:3d9c67d97d6f 861 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 862 pSrc[(2u * i2) + 1u] = Yb12_out;
emh203 0:3d9c67d97d6f 863
emh203 0:3d9c67d97d6f 864 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 865 pSrc[2u * i3] = Xd12_out;
emh203 0:3d9c67d97d6f 866
emh203 0:3d9c67d97d6f 867 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 868 pSrc[(2u * i3) + 1u] = Yd12_out;
emh203 0:3d9c67d97d6f 869
emh203 0:3d9c67d97d6f 870 i0 += n1;
emh203 0:3d9c67d97d6f 871 } while(i0 < fftLen);
emh203 0:3d9c67d97d6f 872 j++;
emh203 0:3d9c67d97d6f 873 } while(j <= (n2 - 1u));
emh203 0:3d9c67d97d6f 874 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 875 }
emh203 0:3d9c67d97d6f 876 /* Initializations of last stage */
emh203 0:3d9c67d97d6f 877
emh203 0:3d9c67d97d6f 878 j = fftLen >> 2;
emh203 0:3d9c67d97d6f 879 ptr1 = &pSrc[0];
emh203 0:3d9c67d97d6f 880
emh203 0:3d9c67d97d6f 881 /* Calculations of last stage */
emh203 0:3d9c67d97d6f 882 do
emh203 0:3d9c67d97d6f 883 {
emh203 0:3d9c67d97d6f 884 xaIn = ptr1[0];
emh203 0:3d9c67d97d6f 885 yaIn = ptr1[1];
emh203 0:3d9c67d97d6f 886 xbIn = ptr1[2];
emh203 0:3d9c67d97d6f 887 ybIn = ptr1[3];
emh203 0:3d9c67d97d6f 888 xcIn = ptr1[4];
emh203 0:3d9c67d97d6f 889 ycIn = ptr1[5];
emh203 0:3d9c67d97d6f 890 xdIn = ptr1[6];
emh203 0:3d9c67d97d6f 891 ydIn = ptr1[7];
emh203 0:3d9c67d97d6f 892
emh203 0:3d9c67d97d6f 893 /* Butterfly implementation */
emh203 0:3d9c67d97d6f 894 /* xa + xc */
emh203 0:3d9c67d97d6f 895 Xaplusc = xaIn + xcIn;
emh203 0:3d9c67d97d6f 896
emh203 0:3d9c67d97d6f 897 /* xa - xc */
emh203 0:3d9c67d97d6f 898 Xaminusc = xaIn - xcIn;
emh203 0:3d9c67d97d6f 899
emh203 0:3d9c67d97d6f 900 /* ya + yc */
emh203 0:3d9c67d97d6f 901 Yaplusc = yaIn + ycIn;
emh203 0:3d9c67d97d6f 902
emh203 0:3d9c67d97d6f 903 /* ya - yc */
emh203 0:3d9c67d97d6f 904 Yaminusc = yaIn - ycIn;
emh203 0:3d9c67d97d6f 905
emh203 0:3d9c67d97d6f 906 /* xb + xd */
emh203 0:3d9c67d97d6f 907 Xbplusd = xbIn + xdIn;
emh203 0:3d9c67d97d6f 908
emh203 0:3d9c67d97d6f 909 /* yb + yd */
emh203 0:3d9c67d97d6f 910 Ybplusd = ybIn + ydIn;
emh203 0:3d9c67d97d6f 911
emh203 0:3d9c67d97d6f 912 /* (xb-xd) */
emh203 0:3d9c67d97d6f 913 Xbminusd = xbIn - xdIn;
emh203 0:3d9c67d97d6f 914
emh203 0:3d9c67d97d6f 915 /* (yb-yd) */
emh203 0:3d9c67d97d6f 916 Ybminusd = ybIn - ydIn;
emh203 0:3d9c67d97d6f 917
emh203 0:3d9c67d97d6f 918 /* xa' = (xa+xb+xc+xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 919 a0 = (Xaplusc + Xbplusd);
emh203 0:3d9c67d97d6f 920 /* ya' = (ya+yb+yc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 921 a1 = (Yaplusc + Ybplusd);
emh203 0:3d9c67d97d6f 922 /* xc' = (xa-xb+xc-xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 923 a2 = (Xaplusc - Xbplusd);
emh203 0:3d9c67d97d6f 924 /* yc' = (ya-yb+yc-yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 925 a3 = (Yaplusc - Ybplusd);
emh203 0:3d9c67d97d6f 926 /* xb' = (xa-yb-xc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 927 a4 = (Xaminusc - Ybminusd);
emh203 0:3d9c67d97d6f 928 /* yb' = (ya+xb-yc-xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 929 a5 = (Yaminusc + Xbminusd);
emh203 0:3d9c67d97d6f 930 /* xd' = (xa-yb-xc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 931 a6 = (Xaminusc + Ybminusd);
emh203 0:3d9c67d97d6f 932 /* yd' = (ya-xb-yc+xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 933 a7 = (Yaminusc - Xbminusd);
emh203 0:3d9c67d97d6f 934
emh203 0:3d9c67d97d6f 935 p0 = a0 * onebyfftLen;
emh203 0:3d9c67d97d6f 936 p1 = a1 * onebyfftLen;
emh203 0:3d9c67d97d6f 937 p2 = a2 * onebyfftLen;
emh203 0:3d9c67d97d6f 938 p3 = a3 * onebyfftLen;
emh203 0:3d9c67d97d6f 939 p4 = a4 * onebyfftLen;
emh203 0:3d9c67d97d6f 940 p5 = a5 * onebyfftLen;
emh203 0:3d9c67d97d6f 941 p6 = a6 * onebyfftLen;
emh203 0:3d9c67d97d6f 942 p7 = a7 * onebyfftLen;
emh203 0:3d9c67d97d6f 943
emh203 0:3d9c67d97d6f 944 /* xa' = (xa+xb+xc+xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 945 ptr1[0] = p0;
emh203 0:3d9c67d97d6f 946 /* ya' = (ya+yb+yc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 947 ptr1[1] = p1;
emh203 0:3d9c67d97d6f 948 /* xc' = (xa-xb+xc-xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 949 ptr1[2] = p2;
emh203 0:3d9c67d97d6f 950 /* yc' = (ya-yb+yc-yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 951 ptr1[3] = p3;
emh203 0:3d9c67d97d6f 952 /* xb' = (xa-yb-xc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 953 ptr1[4] = p4;
emh203 0:3d9c67d97d6f 954 /* yb' = (ya+xb-yc-xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 955 ptr1[5] = p5;
emh203 0:3d9c67d97d6f 956 /* xd' = (xa-yb-xc+yd) * onebyfftLen */
emh203 0:3d9c67d97d6f 957 ptr1[6] = p6;
emh203 0:3d9c67d97d6f 958 /* yd' = (ya-xb-yc+xd) * onebyfftLen */
emh203 0:3d9c67d97d6f 959 ptr1[7] = p7;
emh203 0:3d9c67d97d6f 960
emh203 0:3d9c67d97d6f 961 /* increment source pointer by 8 for next calculations */
emh203 0:3d9c67d97d6f 962 ptr1 = ptr1 + 8u;
emh203 0:3d9c67d97d6f 963
emh203 0:3d9c67d97d6f 964 } while(--j);
emh203 0:3d9c67d97d6f 965
emh203 0:3d9c67d97d6f 966 #else
emh203 0:3d9c67d97d6f 967
emh203 0:3d9c67d97d6f 968 float32_t t1, t2, r1, r2, s1, s2;
emh203 0:3d9c67d97d6f 969
emh203 0:3d9c67d97d6f 970 /* Run the below code for Cortex-M0 */
emh203 0:3d9c67d97d6f 971
emh203 0:3d9c67d97d6f 972 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 973 n2 = fftLen;
emh203 0:3d9c67d97d6f 974 n1 = n2;
emh203 0:3d9c67d97d6f 975
emh203 0:3d9c67d97d6f 976 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 977 for (k = fftLen; k > 4u; k >>= 2u)
emh203 0:3d9c67d97d6f 978 {
emh203 0:3d9c67d97d6f 979 /* Initializations for the first stage */
emh203 0:3d9c67d97d6f 980 n1 = n2;
emh203 0:3d9c67d97d6f 981 n2 >>= 2u;
emh203 0:3d9c67d97d6f 982 ia1 = 0u;
emh203 0:3d9c67d97d6f 983
emh203 0:3d9c67d97d6f 984 /* Calculation of first stage */
emh203 0:3d9c67d97d6f 985 j = 0;
emh203 0:3d9c67d97d6f 986 do
emh203 0:3d9c67d97d6f 987 {
emh203 0:3d9c67d97d6f 988 /* index calculation for the coefficients */
emh203 0:3d9c67d97d6f 989 ia2 = ia1 + ia1;
emh203 0:3d9c67d97d6f 990 ia3 = ia2 + ia1;
emh203 0:3d9c67d97d6f 991 co1 = pCoef[ia1 * 2u];
emh203 0:3d9c67d97d6f 992 si1 = pCoef[(ia1 * 2u) + 1u];
emh203 0:3d9c67d97d6f 993 co2 = pCoef[ia2 * 2u];
emh203 0:3d9c67d97d6f 994 si2 = pCoef[(ia2 * 2u) + 1u];
emh203 0:3d9c67d97d6f 995 co3 = pCoef[ia3 * 2u];
emh203 0:3d9c67d97d6f 996 si3 = pCoef[(ia3 * 2u) + 1u];
emh203 0:3d9c67d97d6f 997
emh203 0:3d9c67d97d6f 998 /* Twiddle coefficients index modifier */
emh203 0:3d9c67d97d6f 999 ia1 = ia1 + twidCoefModifier;
emh203 0:3d9c67d97d6f 1000
emh203 0:3d9c67d97d6f 1001 i0 = j;
emh203 0:3d9c67d97d6f 1002 do
emh203 0:3d9c67d97d6f 1003 {
emh203 0:3d9c67d97d6f 1004 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 1005 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 1006 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 1007 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 1008 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 1009
emh203 0:3d9c67d97d6f 1010 /* xa + xc */
emh203 0:3d9c67d97d6f 1011 r1 = pSrc[(2u * i0)] + pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 1012
emh203 0:3d9c67d97d6f 1013 /* xa - xc */
emh203 0:3d9c67d97d6f 1014 r2 = pSrc[(2u * i0)] - pSrc[(2u * i2)];
emh203 0:3d9c67d97d6f 1015
emh203 0:3d9c67d97d6f 1016 /* ya + yc */
emh203 0:3d9c67d97d6f 1017 s1 = pSrc[(2u * i0) + 1u] + pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 1018
emh203 0:3d9c67d97d6f 1019 /* ya - yc */
emh203 0:3d9c67d97d6f 1020 s2 = pSrc[(2u * i0) + 1u] - pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 1021
emh203 0:3d9c67d97d6f 1022 /* xb + xd */
emh203 0:3d9c67d97d6f 1023 t1 = pSrc[2u * i1] + pSrc[2u * i3];
emh203 0:3d9c67d97d6f 1024
emh203 0:3d9c67d97d6f 1025 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 1026 pSrc[2u * i0] = r1 + t1;
emh203 0:3d9c67d97d6f 1027
emh203 0:3d9c67d97d6f 1028 /* xa + xc -(xb + xd) */
emh203 0:3d9c67d97d6f 1029 r1 = r1 - t1;
emh203 0:3d9c67d97d6f 1030
emh203 0:3d9c67d97d6f 1031 /* yb + yd */
emh203 0:3d9c67d97d6f 1032 t2 = pSrc[(2u * i1) + 1u] + pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 1033
emh203 0:3d9c67d97d6f 1034 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 1035 pSrc[(2u * i0) + 1u] = s1 + t2;
emh203 0:3d9c67d97d6f 1036
emh203 0:3d9c67d97d6f 1037 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 1038 s1 = s1 - t2;
emh203 0:3d9c67d97d6f 1039
emh203 0:3d9c67d97d6f 1040 /* (yb - yd) */
emh203 0:3d9c67d97d6f 1041 t1 = pSrc[(2u * i1) + 1u] - pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 1042
emh203 0:3d9c67d97d6f 1043 /* (xb - xd) */
emh203 0:3d9c67d97d6f 1044 t2 = pSrc[2u * i1] - pSrc[2u * i3];
emh203 0:3d9c67d97d6f 1045
emh203 0:3d9c67d97d6f 1046 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 1047 pSrc[2u * i1] = (r1 * co2) - (s1 * si2);
emh203 0:3d9c67d97d6f 1048
emh203 0:3d9c67d97d6f 1049 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 1050 pSrc[(2u * i1) + 1u] = (s1 * co2) + (r1 * si2);
emh203 0:3d9c67d97d6f 1051
emh203 0:3d9c67d97d6f 1052 /* (xa - xc) - (yb - yd) */
emh203 0:3d9c67d97d6f 1053 r1 = r2 - t1;
emh203 0:3d9c67d97d6f 1054
emh203 0:3d9c67d97d6f 1055 /* (xa - xc) + (yb - yd) */
emh203 0:3d9c67d97d6f 1056 r2 = r2 + t1;
emh203 0:3d9c67d97d6f 1057
emh203 0:3d9c67d97d6f 1058 /* (ya - yc) + (xb - xd) */
emh203 0:3d9c67d97d6f 1059 s1 = s2 + t2;
emh203 0:3d9c67d97d6f 1060
emh203 0:3d9c67d97d6f 1061 /* (ya - yc) - (xb - xd) */
emh203 0:3d9c67d97d6f 1062 s2 = s2 - t2;
emh203 0:3d9c67d97d6f 1063
emh203 0:3d9c67d97d6f 1064 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 1065 pSrc[2u * i2] = (r1 * co1) - (s1 * si1);
emh203 0:3d9c67d97d6f 1066
emh203 0:3d9c67d97d6f 1067 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 1068 pSrc[(2u * i2) + 1u] = (s1 * co1) + (r1 * si1);
emh203 0:3d9c67d97d6f 1069
emh203 0:3d9c67d97d6f 1070 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 1071 pSrc[2u * i3] = (r2 * co3) - (s2 * si3);
emh203 0:3d9c67d97d6f 1072
emh203 0:3d9c67d97d6f 1073 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 1074 pSrc[(2u * i3) + 1u] = (s2 * co3) + (r2 * si3);
emh203 0:3d9c67d97d6f 1075
emh203 0:3d9c67d97d6f 1076 i0 += n1;
emh203 0:3d9c67d97d6f 1077 } while( i0 < fftLen);
emh203 0:3d9c67d97d6f 1078 j++;
emh203 0:3d9c67d97d6f 1079 } while(j <= (n2 - 1u));
emh203 0:3d9c67d97d6f 1080 twidCoefModifier <<= 2u;
emh203 0:3d9c67d97d6f 1081 }
emh203 0:3d9c67d97d6f 1082 /* Initializations of last stage */
emh203 0:3d9c67d97d6f 1083 n1 = n2;
emh203 0:3d9c67d97d6f 1084 n2 >>= 2u;
emh203 0:3d9c67d97d6f 1085
emh203 0:3d9c67d97d6f 1086 /* Calculations of last stage */
emh203 0:3d9c67d97d6f 1087 for (i0 = 0u; i0 <= (fftLen - n1); i0 += n1)
emh203 0:3d9c67d97d6f 1088 {
emh203 0:3d9c67d97d6f 1089 /* index calculation for the input as, */
emh203 0:3d9c67d97d6f 1090 /* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
emh203 0:3d9c67d97d6f 1091 i1 = i0 + n2;
emh203 0:3d9c67d97d6f 1092 i2 = i1 + n2;
emh203 0:3d9c67d97d6f 1093 i3 = i2 + n2;
emh203 0:3d9c67d97d6f 1094
emh203 0:3d9c67d97d6f 1095 /* Butterfly implementation */
emh203 0:3d9c67d97d6f 1096 /* xa + xc */
emh203 0:3d9c67d97d6f 1097 r1 = pSrc[2u * i0] + pSrc[2u * i2];
emh203 0:3d9c67d97d6f 1098
emh203 0:3d9c67d97d6f 1099 /* xa - xc */
emh203 0:3d9c67d97d6f 1100 r2 = pSrc[2u * i0] - pSrc[2u * i2];
emh203 0:3d9c67d97d6f 1101
emh203 0:3d9c67d97d6f 1102 /* ya + yc */
emh203 0:3d9c67d97d6f 1103 s1 = pSrc[(2u * i0) + 1u] + pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 1104
emh203 0:3d9c67d97d6f 1105 /* ya - yc */
emh203 0:3d9c67d97d6f 1106 s2 = pSrc[(2u * i0) + 1u] - pSrc[(2u * i2) + 1u];
emh203 0:3d9c67d97d6f 1107
emh203 0:3d9c67d97d6f 1108 /* xc + xd */
emh203 0:3d9c67d97d6f 1109 t1 = pSrc[2u * i1] + pSrc[2u * i3];
emh203 0:3d9c67d97d6f 1110
emh203 0:3d9c67d97d6f 1111 /* xa' = xa + xb + xc + xd */
emh203 0:3d9c67d97d6f 1112 pSrc[2u * i0] = (r1 + t1) * onebyfftLen;
emh203 0:3d9c67d97d6f 1113
emh203 0:3d9c67d97d6f 1114 /* (xa + xb) - (xc + xd) */
emh203 0:3d9c67d97d6f 1115 r1 = r1 - t1;
emh203 0:3d9c67d97d6f 1116
emh203 0:3d9c67d97d6f 1117 /* yb + yd */
emh203 0:3d9c67d97d6f 1118 t2 = pSrc[(2u * i1) + 1u] + pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 1119
emh203 0:3d9c67d97d6f 1120 /* ya' = ya + yb + yc + yd */
emh203 0:3d9c67d97d6f 1121 pSrc[(2u * i0) + 1u] = (s1 + t2) * onebyfftLen;
emh203 0:3d9c67d97d6f 1122
emh203 0:3d9c67d97d6f 1123 /* (ya + yc) - (yb + yd) */
emh203 0:3d9c67d97d6f 1124 s1 = s1 - t2;
emh203 0:3d9c67d97d6f 1125
emh203 0:3d9c67d97d6f 1126 /* (yb-yd) */
emh203 0:3d9c67d97d6f 1127 t1 = pSrc[(2u * i1) + 1u] - pSrc[(2u * i3) + 1u];
emh203 0:3d9c67d97d6f 1128
emh203 0:3d9c67d97d6f 1129 /* (xb-xd) */
emh203 0:3d9c67d97d6f 1130 t2 = pSrc[2u * i1] - pSrc[2u * i3];
emh203 0:3d9c67d97d6f 1131
emh203 0:3d9c67d97d6f 1132 /* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
emh203 0:3d9c67d97d6f 1133 pSrc[2u * i1] = r1 * onebyfftLen;
emh203 0:3d9c67d97d6f 1134
emh203 0:3d9c67d97d6f 1135 /* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
emh203 0:3d9c67d97d6f 1136 pSrc[(2u * i1) + 1u] = s1 * onebyfftLen;
emh203 0:3d9c67d97d6f 1137
emh203 0:3d9c67d97d6f 1138 /* (xa - xc) - (yb-yd) */
emh203 0:3d9c67d97d6f 1139 r1 = r2 - t1;
emh203 0:3d9c67d97d6f 1140
emh203 0:3d9c67d97d6f 1141 /* (xa - xc) + (yb-yd) */
emh203 0:3d9c67d97d6f 1142 r2 = r2 + t1;
emh203 0:3d9c67d97d6f 1143
emh203 0:3d9c67d97d6f 1144 /* (ya - yc) + (xb-xd) */
emh203 0:3d9c67d97d6f 1145 s1 = s2 + t2;
emh203 0:3d9c67d97d6f 1146
emh203 0:3d9c67d97d6f 1147 /* (ya - yc) - (xb-xd) */
emh203 0:3d9c67d97d6f 1148 s2 = s2 - t2;
emh203 0:3d9c67d97d6f 1149
emh203 0:3d9c67d97d6f 1150 /* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
emh203 0:3d9c67d97d6f 1151 pSrc[2u * i2] = r1 * onebyfftLen;
emh203 0:3d9c67d97d6f 1152
emh203 0:3d9c67d97d6f 1153 /* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
emh203 0:3d9c67d97d6f 1154 pSrc[(2u * i2) + 1u] = s1 * onebyfftLen;
emh203 0:3d9c67d97d6f 1155
emh203 0:3d9c67d97d6f 1156 /* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
emh203 0:3d9c67d97d6f 1157 pSrc[2u * i3] = r2 * onebyfftLen;
emh203 0:3d9c67d97d6f 1158
emh203 0:3d9c67d97d6f 1159 /* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
emh203 0:3d9c67d97d6f 1160 pSrc[(2u * i3) + 1u] = s2 * onebyfftLen;
emh203 0:3d9c67d97d6f 1161 }
emh203 0:3d9c67d97d6f 1162
emh203 0:3d9c67d97d6f 1163 #endif /* #ifndef ARM_MATH_CM0_FAMILY_FAMILY */
emh203 0:3d9c67d97d6f 1164 }
emh203 0:3d9c67d97d6f 1165
emh203 0:3d9c67d97d6f 1166 /**
emh203 0:3d9c67d97d6f 1167 * @addtogroup ComplexFFT
emh203 0:3d9c67d97d6f 1168 * @{
emh203 0:3d9c67d97d6f 1169 */
emh203 0:3d9c67d97d6f 1170
emh203 0:3d9c67d97d6f 1171 /**
emh203 0:3d9c67d97d6f 1172 * @details
emh203 0:3d9c67d97d6f 1173 * @brief Processing function for the floating-point Radix-4 CFFT/CIFFT.
emh203 0:3d9c67d97d6f 1174 * @deprecated Do not use this function. It has been superceded by \ref arm_cfft_f32 and will be removed
emh203 0:3d9c67d97d6f 1175 * in the future.
emh203 0:3d9c67d97d6f 1176 * @param[in] *S points to an instance of the floating-point Radix-4 CFFT/CIFFT structure.
emh203 0:3d9c67d97d6f 1177 * @param[in, out] *pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place.
emh203 0:3d9c67d97d6f 1178 * @return none.
emh203 0:3d9c67d97d6f 1179 */
emh203 0:3d9c67d97d6f 1180
emh203 0:3d9c67d97d6f 1181 void arm_cfft_radix4_f32(
emh203 0:3d9c67d97d6f 1182 const arm_cfft_radix4_instance_f32 * S,
emh203 0:3d9c67d97d6f 1183 float32_t * pSrc)
emh203 0:3d9c67d97d6f 1184 {
emh203 0:3d9c67d97d6f 1185
emh203 0:3d9c67d97d6f 1186 if(S->ifftFlag == 1u)
emh203 0:3d9c67d97d6f 1187 {
emh203 0:3d9c67d97d6f 1188 /* Complex IFFT radix-4 */
emh203 0:3d9c67d97d6f 1189 arm_radix4_butterfly_inverse_f32(pSrc, S->fftLen, S->pTwiddle,
emh203 0:3d9c67d97d6f 1190 S->twidCoefModifier, S->onebyfftLen);
emh203 0:3d9c67d97d6f 1191 }
emh203 0:3d9c67d97d6f 1192 else
emh203 0:3d9c67d97d6f 1193 {
emh203 0:3d9c67d97d6f 1194 /* Complex FFT radix-4 */
emh203 0:3d9c67d97d6f 1195 arm_radix4_butterfly_f32(pSrc, S->fftLen, S->pTwiddle,
emh203 0:3d9c67d97d6f 1196 S->twidCoefModifier);
emh203 0:3d9c67d97d6f 1197 }
emh203 0:3d9c67d97d6f 1198
emh203 0:3d9c67d97d6f 1199 if(S->bitReverseFlag == 1u)
emh203 0:3d9c67d97d6f 1200 {
emh203 0:3d9c67d97d6f 1201 /* Bit Reversal */
emh203 0:3d9c67d97d6f 1202 arm_bitreversal_f32(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
emh203 0:3d9c67d97d6f 1203 }
emh203 0:3d9c67d97d6f 1204
emh203 0:3d9c67d97d6f 1205 }
emh203 0:3d9c67d97d6f 1206
emh203 0:3d9c67d97d6f 1207 /**
emh203 0:3d9c67d97d6f 1208 * @} end of ComplexFFT group
emh203 0:3d9c67d97d6f 1209 */
emh203 0:3d9c67d97d6f 1210