The CMSIS DSP 5 library
Dependents: Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more
functions/TransformFunctions/arm_cfft_radix2_q31.c@3:4098b9d3d571, 2018-06-21 (annotated)
- Committer:
- xorjoep
- Date:
- Thu Jun 21 11:56:27 2018 +0000
- Revision:
- 3:4098b9d3d571
- Parent:
- 1:24714b45cd1b
headers is a folder not a library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xorjoep | 1:24714b45cd1b | 1 | /* ---------------------------------------------------------------------- |
xorjoep | 1:24714b45cd1b | 2 | * Project: CMSIS DSP Library |
xorjoep | 1:24714b45cd1b | 3 | * Title: arm_cfft_radix2_q31.c |
xorjoep | 1:24714b45cd1b | 4 | * Description: Radix-2 Decimation in Frequency CFFT & CIFFT Fixed point processing function |
xorjoep | 1:24714b45cd1b | 5 | * |
xorjoep | 1:24714b45cd1b | 6 | * $Date: 27. January 2017 |
xorjoep | 1:24714b45cd1b | 7 | * $Revision: V.1.5.1 |
xorjoep | 1:24714b45cd1b | 8 | * |
xorjoep | 1:24714b45cd1b | 9 | * Target Processor: Cortex-M cores |
xorjoep | 1:24714b45cd1b | 10 | * -------------------------------------------------------------------- */ |
xorjoep | 1:24714b45cd1b | 11 | /* |
xorjoep | 1:24714b45cd1b | 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. |
xorjoep | 1:24714b45cd1b | 13 | * |
xorjoep | 1:24714b45cd1b | 14 | * SPDX-License-Identifier: Apache-2.0 |
xorjoep | 1:24714b45cd1b | 15 | * |
xorjoep | 1:24714b45cd1b | 16 | * Licensed under the Apache License, Version 2.0 (the License); you may |
xorjoep | 1:24714b45cd1b | 17 | * not use this file except in compliance with the License. |
xorjoep | 1:24714b45cd1b | 18 | * You may obtain a copy of the License at |
xorjoep | 1:24714b45cd1b | 19 | * |
xorjoep | 1:24714b45cd1b | 20 | * www.apache.org/licenses/LICENSE-2.0 |
xorjoep | 1:24714b45cd1b | 21 | * |
xorjoep | 1:24714b45cd1b | 22 | * Unless required by applicable law or agreed to in writing, software |
xorjoep | 1:24714b45cd1b | 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
xorjoep | 1:24714b45cd1b | 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
xorjoep | 1:24714b45cd1b | 25 | * See the License for the specific language governing permissions and |
xorjoep | 1:24714b45cd1b | 26 | * limitations under the License. |
xorjoep | 1:24714b45cd1b | 27 | */ |
xorjoep | 1:24714b45cd1b | 28 | |
xorjoep | 1:24714b45cd1b | 29 | #include "arm_math.h" |
xorjoep | 1:24714b45cd1b | 30 | |
xorjoep | 1:24714b45cd1b | 31 | void arm_radix2_butterfly_q31( |
xorjoep | 1:24714b45cd1b | 32 | q31_t * pSrc, |
xorjoep | 1:24714b45cd1b | 33 | uint32_t fftLen, |
xorjoep | 1:24714b45cd1b | 34 | q31_t * pCoef, |
xorjoep | 1:24714b45cd1b | 35 | uint16_t twidCoefModifier); |
xorjoep | 1:24714b45cd1b | 36 | |
xorjoep | 1:24714b45cd1b | 37 | void arm_radix2_butterfly_inverse_q31( |
xorjoep | 1:24714b45cd1b | 38 | q31_t * pSrc, |
xorjoep | 1:24714b45cd1b | 39 | uint32_t fftLen, |
xorjoep | 1:24714b45cd1b | 40 | q31_t * pCoef, |
xorjoep | 1:24714b45cd1b | 41 | uint16_t twidCoefModifier); |
xorjoep | 1:24714b45cd1b | 42 | |
xorjoep | 1:24714b45cd1b | 43 | void arm_bitreversal_q31( |
xorjoep | 1:24714b45cd1b | 44 | q31_t * pSrc, |
xorjoep | 1:24714b45cd1b | 45 | uint32_t fftLen, |
xorjoep | 1:24714b45cd1b | 46 | uint16_t bitRevFactor, |
xorjoep | 1:24714b45cd1b | 47 | uint16_t * pBitRevTab); |
xorjoep | 1:24714b45cd1b | 48 | |
xorjoep | 1:24714b45cd1b | 49 | /** |
xorjoep | 1:24714b45cd1b | 50 | * @ingroup groupTransforms |
xorjoep | 1:24714b45cd1b | 51 | */ |
xorjoep | 1:24714b45cd1b | 52 | |
xorjoep | 1:24714b45cd1b | 53 | /** |
xorjoep | 1:24714b45cd1b | 54 | * @addtogroup ComplexFFT |
xorjoep | 1:24714b45cd1b | 55 | * @{ |
xorjoep | 1:24714b45cd1b | 56 | */ |
xorjoep | 1:24714b45cd1b | 57 | |
xorjoep | 1:24714b45cd1b | 58 | /** |
xorjoep | 1:24714b45cd1b | 59 | * @details |
xorjoep | 1:24714b45cd1b | 60 | * @brief Processing function for the fixed-point CFFT/CIFFT. |
xorjoep | 1:24714b45cd1b | 61 | * @deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed |
xorjoep | 1:24714b45cd1b | 62 | * @param[in] *S points to an instance of the fixed-point CFFT/CIFFT structure. |
xorjoep | 1:24714b45cd1b | 63 | * @param[in, out] *pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place. |
xorjoep | 1:24714b45cd1b | 64 | * @return none. |
xorjoep | 1:24714b45cd1b | 65 | */ |
xorjoep | 1:24714b45cd1b | 66 | |
xorjoep | 1:24714b45cd1b | 67 | void arm_cfft_radix2_q31( |
xorjoep | 1:24714b45cd1b | 68 | const arm_cfft_radix2_instance_q31 * S, |
xorjoep | 1:24714b45cd1b | 69 | q31_t * pSrc) |
xorjoep | 1:24714b45cd1b | 70 | { |
xorjoep | 1:24714b45cd1b | 71 | |
xorjoep | 1:24714b45cd1b | 72 | if (S->ifftFlag == 1U) |
xorjoep | 1:24714b45cd1b | 73 | { |
xorjoep | 1:24714b45cd1b | 74 | arm_radix2_butterfly_inverse_q31(pSrc, S->fftLen, |
xorjoep | 1:24714b45cd1b | 75 | S->pTwiddle, S->twidCoefModifier); |
xorjoep | 1:24714b45cd1b | 76 | } |
xorjoep | 1:24714b45cd1b | 77 | else |
xorjoep | 1:24714b45cd1b | 78 | { |
xorjoep | 1:24714b45cd1b | 79 | arm_radix2_butterfly_q31(pSrc, S->fftLen, |
xorjoep | 1:24714b45cd1b | 80 | S->pTwiddle, S->twidCoefModifier); |
xorjoep | 1:24714b45cd1b | 81 | } |
xorjoep | 1:24714b45cd1b | 82 | |
xorjoep | 1:24714b45cd1b | 83 | arm_bitreversal_q31(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable); |
xorjoep | 1:24714b45cd1b | 84 | } |
xorjoep | 1:24714b45cd1b | 85 | |
xorjoep | 1:24714b45cd1b | 86 | /** |
xorjoep | 1:24714b45cd1b | 87 | * @} end of ComplexFFT group |
xorjoep | 1:24714b45cd1b | 88 | */ |
xorjoep | 1:24714b45cd1b | 89 | |
xorjoep | 1:24714b45cd1b | 90 | void arm_radix2_butterfly_q31( |
xorjoep | 1:24714b45cd1b | 91 | q31_t * pSrc, |
xorjoep | 1:24714b45cd1b | 92 | uint32_t fftLen, |
xorjoep | 1:24714b45cd1b | 93 | q31_t * pCoef, |
xorjoep | 1:24714b45cd1b | 94 | uint16_t twidCoefModifier) |
xorjoep | 1:24714b45cd1b | 95 | { |
xorjoep | 1:24714b45cd1b | 96 | |
xorjoep | 1:24714b45cd1b | 97 | unsigned i, j, k, l, m; |
xorjoep | 1:24714b45cd1b | 98 | unsigned n1, n2, ia; |
xorjoep | 1:24714b45cd1b | 99 | q31_t xt, yt, cosVal, sinVal; |
xorjoep | 1:24714b45cd1b | 100 | q31_t p0, p1; |
xorjoep | 1:24714b45cd1b | 101 | |
xorjoep | 1:24714b45cd1b | 102 | //N = fftLen; |
xorjoep | 1:24714b45cd1b | 103 | n2 = fftLen; |
xorjoep | 1:24714b45cd1b | 104 | |
xorjoep | 1:24714b45cd1b | 105 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 106 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 107 | ia = 0; |
xorjoep | 1:24714b45cd1b | 108 | |
xorjoep | 1:24714b45cd1b | 109 | // loop for groups |
xorjoep | 1:24714b45cd1b | 110 | for (i = 0; i < n2; i++) |
xorjoep | 1:24714b45cd1b | 111 | { |
xorjoep | 1:24714b45cd1b | 112 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 113 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 114 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 115 | |
xorjoep | 1:24714b45cd1b | 116 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 117 | xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U); |
xorjoep | 1:24714b45cd1b | 118 | pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U; |
xorjoep | 1:24714b45cd1b | 119 | |
xorjoep | 1:24714b45cd1b | 120 | yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U); |
xorjoep | 1:24714b45cd1b | 121 | pSrc[2 * i + 1] = |
xorjoep | 1:24714b45cd1b | 122 | ((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U; |
xorjoep | 1:24714b45cd1b | 123 | |
xorjoep | 1:24714b45cd1b | 124 | mult_32x32_keep32_R(p0, xt, cosVal); |
xorjoep | 1:24714b45cd1b | 125 | mult_32x32_keep32_R(p1, yt, cosVal); |
xorjoep | 1:24714b45cd1b | 126 | multAcc_32x32_keep32_R(p0, yt, sinVal); |
xorjoep | 1:24714b45cd1b | 127 | multSub_32x32_keep32_R(p1, xt, sinVal); |
xorjoep | 1:24714b45cd1b | 128 | |
xorjoep | 1:24714b45cd1b | 129 | pSrc[2U * l] = p0; |
xorjoep | 1:24714b45cd1b | 130 | pSrc[2U * l + 1U] = p1; |
xorjoep | 1:24714b45cd1b | 131 | |
xorjoep | 1:24714b45cd1b | 132 | } // groups loop end |
xorjoep | 1:24714b45cd1b | 133 | |
xorjoep | 1:24714b45cd1b | 134 | twidCoefModifier <<= 1U; |
xorjoep | 1:24714b45cd1b | 135 | |
xorjoep | 1:24714b45cd1b | 136 | // loop for stage |
xorjoep | 1:24714b45cd1b | 137 | for (k = fftLen / 2; k > 2; k = k >> 1) |
xorjoep | 1:24714b45cd1b | 138 | { |
xorjoep | 1:24714b45cd1b | 139 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 140 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 141 | ia = 0; |
xorjoep | 1:24714b45cd1b | 142 | |
xorjoep | 1:24714b45cd1b | 143 | // loop for groups |
xorjoep | 1:24714b45cd1b | 144 | for (j = 0; j < n2; j++) |
xorjoep | 1:24714b45cd1b | 145 | { |
xorjoep | 1:24714b45cd1b | 146 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 147 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 148 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 149 | |
xorjoep | 1:24714b45cd1b | 150 | // loop for butterfly |
xorjoep | 1:24714b45cd1b | 151 | i = j; |
xorjoep | 1:24714b45cd1b | 152 | m = fftLen / n1; |
xorjoep | 1:24714b45cd1b | 153 | do |
xorjoep | 1:24714b45cd1b | 154 | { |
xorjoep | 1:24714b45cd1b | 155 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 156 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 157 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U; |
xorjoep | 1:24714b45cd1b | 158 | |
xorjoep | 1:24714b45cd1b | 159 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 160 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U; |
xorjoep | 1:24714b45cd1b | 161 | |
xorjoep | 1:24714b45cd1b | 162 | mult_32x32_keep32_R(p0, xt, cosVal); |
xorjoep | 1:24714b45cd1b | 163 | mult_32x32_keep32_R(p1, yt, cosVal); |
xorjoep | 1:24714b45cd1b | 164 | multAcc_32x32_keep32_R(p0, yt, sinVal); |
xorjoep | 1:24714b45cd1b | 165 | multSub_32x32_keep32_R(p1, xt, sinVal); |
xorjoep | 1:24714b45cd1b | 166 | |
xorjoep | 1:24714b45cd1b | 167 | pSrc[2U * l] = p0; |
xorjoep | 1:24714b45cd1b | 168 | pSrc[2U * l + 1U] = p1; |
xorjoep | 1:24714b45cd1b | 169 | i += n1; |
xorjoep | 1:24714b45cd1b | 170 | m--; |
xorjoep | 1:24714b45cd1b | 171 | } while ( m > 0); // butterfly loop end |
xorjoep | 1:24714b45cd1b | 172 | |
xorjoep | 1:24714b45cd1b | 173 | } // groups loop end |
xorjoep | 1:24714b45cd1b | 174 | |
xorjoep | 1:24714b45cd1b | 175 | twidCoefModifier <<= 1U; |
xorjoep | 1:24714b45cd1b | 176 | } // stages loop end |
xorjoep | 1:24714b45cd1b | 177 | |
xorjoep | 1:24714b45cd1b | 178 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 179 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 180 | ia = 0; |
xorjoep | 1:24714b45cd1b | 181 | |
xorjoep | 1:24714b45cd1b | 182 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 183 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 184 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 185 | |
xorjoep | 1:24714b45cd1b | 186 | // loop for butterfly |
xorjoep | 1:24714b45cd1b | 187 | for (i = 0; i < fftLen; i += n1) |
xorjoep | 1:24714b45cd1b | 188 | { |
xorjoep | 1:24714b45cd1b | 189 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 190 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 191 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]); |
xorjoep | 1:24714b45cd1b | 192 | |
xorjoep | 1:24714b45cd1b | 193 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 194 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]); |
xorjoep | 1:24714b45cd1b | 195 | |
xorjoep | 1:24714b45cd1b | 196 | pSrc[2U * l] = xt; |
xorjoep | 1:24714b45cd1b | 197 | |
xorjoep | 1:24714b45cd1b | 198 | pSrc[2U * l + 1U] = yt; |
xorjoep | 1:24714b45cd1b | 199 | |
xorjoep | 1:24714b45cd1b | 200 | i += n1; |
xorjoep | 1:24714b45cd1b | 201 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 202 | |
xorjoep | 1:24714b45cd1b | 203 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 204 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]); |
xorjoep | 1:24714b45cd1b | 205 | |
xorjoep | 1:24714b45cd1b | 206 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 207 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]); |
xorjoep | 1:24714b45cd1b | 208 | |
xorjoep | 1:24714b45cd1b | 209 | pSrc[2U * l] = xt; |
xorjoep | 1:24714b45cd1b | 210 | |
xorjoep | 1:24714b45cd1b | 211 | pSrc[2U * l + 1U] = yt; |
xorjoep | 1:24714b45cd1b | 212 | |
xorjoep | 1:24714b45cd1b | 213 | } // butterfly loop end |
xorjoep | 1:24714b45cd1b | 214 | |
xorjoep | 1:24714b45cd1b | 215 | } |
xorjoep | 1:24714b45cd1b | 216 | |
xorjoep | 1:24714b45cd1b | 217 | |
xorjoep | 1:24714b45cd1b | 218 | void arm_radix2_butterfly_inverse_q31( |
xorjoep | 1:24714b45cd1b | 219 | q31_t * pSrc, |
xorjoep | 1:24714b45cd1b | 220 | uint32_t fftLen, |
xorjoep | 1:24714b45cd1b | 221 | q31_t * pCoef, |
xorjoep | 1:24714b45cd1b | 222 | uint16_t twidCoefModifier) |
xorjoep | 1:24714b45cd1b | 223 | { |
xorjoep | 1:24714b45cd1b | 224 | |
xorjoep | 1:24714b45cd1b | 225 | unsigned i, j, k, l; |
xorjoep | 1:24714b45cd1b | 226 | unsigned n1, n2, ia; |
xorjoep | 1:24714b45cd1b | 227 | q31_t xt, yt, cosVal, sinVal; |
xorjoep | 1:24714b45cd1b | 228 | q31_t p0, p1; |
xorjoep | 1:24714b45cd1b | 229 | |
xorjoep | 1:24714b45cd1b | 230 | //N = fftLen; |
xorjoep | 1:24714b45cd1b | 231 | n2 = fftLen; |
xorjoep | 1:24714b45cd1b | 232 | |
xorjoep | 1:24714b45cd1b | 233 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 234 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 235 | ia = 0; |
xorjoep | 1:24714b45cd1b | 236 | |
xorjoep | 1:24714b45cd1b | 237 | // loop for groups |
xorjoep | 1:24714b45cd1b | 238 | for (i = 0; i < n2; i++) |
xorjoep | 1:24714b45cd1b | 239 | { |
xorjoep | 1:24714b45cd1b | 240 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 241 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 242 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 243 | |
xorjoep | 1:24714b45cd1b | 244 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 245 | xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U); |
xorjoep | 1:24714b45cd1b | 246 | pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U; |
xorjoep | 1:24714b45cd1b | 247 | |
xorjoep | 1:24714b45cd1b | 248 | yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U); |
xorjoep | 1:24714b45cd1b | 249 | pSrc[2 * i + 1] = |
xorjoep | 1:24714b45cd1b | 250 | ((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U; |
xorjoep | 1:24714b45cd1b | 251 | |
xorjoep | 1:24714b45cd1b | 252 | mult_32x32_keep32_R(p0, xt, cosVal); |
xorjoep | 1:24714b45cd1b | 253 | mult_32x32_keep32_R(p1, yt, cosVal); |
xorjoep | 1:24714b45cd1b | 254 | multSub_32x32_keep32_R(p0, yt, sinVal); |
xorjoep | 1:24714b45cd1b | 255 | multAcc_32x32_keep32_R(p1, xt, sinVal); |
xorjoep | 1:24714b45cd1b | 256 | |
xorjoep | 1:24714b45cd1b | 257 | pSrc[2U * l] = p0; |
xorjoep | 1:24714b45cd1b | 258 | pSrc[2U * l + 1U] = p1; |
xorjoep | 1:24714b45cd1b | 259 | } // groups loop end |
xorjoep | 1:24714b45cd1b | 260 | |
xorjoep | 1:24714b45cd1b | 261 | twidCoefModifier = twidCoefModifier << 1U; |
xorjoep | 1:24714b45cd1b | 262 | |
xorjoep | 1:24714b45cd1b | 263 | // loop for stage |
xorjoep | 1:24714b45cd1b | 264 | for (k = fftLen / 2; k > 2; k = k >> 1) |
xorjoep | 1:24714b45cd1b | 265 | { |
xorjoep | 1:24714b45cd1b | 266 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 267 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 268 | ia = 0; |
xorjoep | 1:24714b45cd1b | 269 | |
xorjoep | 1:24714b45cd1b | 270 | // loop for groups |
xorjoep | 1:24714b45cd1b | 271 | for (j = 0; j < n2; j++) |
xorjoep | 1:24714b45cd1b | 272 | { |
xorjoep | 1:24714b45cd1b | 273 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 274 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 275 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 276 | |
xorjoep | 1:24714b45cd1b | 277 | // loop for butterfly |
xorjoep | 1:24714b45cd1b | 278 | for (i = j; i < fftLen; i += n1) |
xorjoep | 1:24714b45cd1b | 279 | { |
xorjoep | 1:24714b45cd1b | 280 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 281 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 282 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U; |
xorjoep | 1:24714b45cd1b | 283 | |
xorjoep | 1:24714b45cd1b | 284 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 285 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U; |
xorjoep | 1:24714b45cd1b | 286 | |
xorjoep | 1:24714b45cd1b | 287 | mult_32x32_keep32_R(p0, xt, cosVal); |
xorjoep | 1:24714b45cd1b | 288 | mult_32x32_keep32_R(p1, yt, cosVal); |
xorjoep | 1:24714b45cd1b | 289 | multSub_32x32_keep32_R(p0, yt, sinVal); |
xorjoep | 1:24714b45cd1b | 290 | multAcc_32x32_keep32_R(p1, xt, sinVal); |
xorjoep | 1:24714b45cd1b | 291 | |
xorjoep | 1:24714b45cd1b | 292 | pSrc[2U * l] = p0; |
xorjoep | 1:24714b45cd1b | 293 | pSrc[2U * l + 1U] = p1; |
xorjoep | 1:24714b45cd1b | 294 | } // butterfly loop end |
xorjoep | 1:24714b45cd1b | 295 | |
xorjoep | 1:24714b45cd1b | 296 | } // groups loop end |
xorjoep | 1:24714b45cd1b | 297 | |
xorjoep | 1:24714b45cd1b | 298 | twidCoefModifier = twidCoefModifier << 1U; |
xorjoep | 1:24714b45cd1b | 299 | } // stages loop end |
xorjoep | 1:24714b45cd1b | 300 | |
xorjoep | 1:24714b45cd1b | 301 | n1 = n2; |
xorjoep | 1:24714b45cd1b | 302 | n2 = n2 >> 1; |
xorjoep | 1:24714b45cd1b | 303 | ia = 0; |
xorjoep | 1:24714b45cd1b | 304 | |
xorjoep | 1:24714b45cd1b | 305 | cosVal = pCoef[ia * 2]; |
xorjoep | 1:24714b45cd1b | 306 | sinVal = pCoef[(ia * 2) + 1]; |
xorjoep | 1:24714b45cd1b | 307 | ia = ia + twidCoefModifier; |
xorjoep | 1:24714b45cd1b | 308 | |
xorjoep | 1:24714b45cd1b | 309 | // loop for butterfly |
xorjoep | 1:24714b45cd1b | 310 | for (i = 0; i < fftLen; i += n1) |
xorjoep | 1:24714b45cd1b | 311 | { |
xorjoep | 1:24714b45cd1b | 312 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 313 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 314 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]); |
xorjoep | 1:24714b45cd1b | 315 | |
xorjoep | 1:24714b45cd1b | 316 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 317 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]); |
xorjoep | 1:24714b45cd1b | 318 | |
xorjoep | 1:24714b45cd1b | 319 | pSrc[2U * l] = xt; |
xorjoep | 1:24714b45cd1b | 320 | |
xorjoep | 1:24714b45cd1b | 321 | pSrc[2U * l + 1U] = yt; |
xorjoep | 1:24714b45cd1b | 322 | |
xorjoep | 1:24714b45cd1b | 323 | i += n1; |
xorjoep | 1:24714b45cd1b | 324 | l = i + n2; |
xorjoep | 1:24714b45cd1b | 325 | |
xorjoep | 1:24714b45cd1b | 326 | xt = pSrc[2 * i] - pSrc[2 * l]; |
xorjoep | 1:24714b45cd1b | 327 | pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]); |
xorjoep | 1:24714b45cd1b | 328 | |
xorjoep | 1:24714b45cd1b | 329 | yt = pSrc[2 * i + 1] - pSrc[2 * l + 1]; |
xorjoep | 1:24714b45cd1b | 330 | pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]); |
xorjoep | 1:24714b45cd1b | 331 | |
xorjoep | 1:24714b45cd1b | 332 | pSrc[2U * l] = xt; |
xorjoep | 1:24714b45cd1b | 333 | |
xorjoep | 1:24714b45cd1b | 334 | pSrc[2U * l + 1U] = yt; |
xorjoep | 1:24714b45cd1b | 335 | |
xorjoep | 1:24714b45cd1b | 336 | } // butterfly loop end |
xorjoep | 1:24714b45cd1b | 337 | |
xorjoep | 1:24714b45cd1b | 338 | } |