The CMSIS DSP 5 library
Dependents: Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more
functions/TransformFunctions/arm_cfft_radix4_init_f32.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_radix4_init_f32.c |
xorjoep | 1:24714b45cd1b | 4 | * Description: Radix-4 Decimation in Frequency Floating-point CFFT & CIFFT Initialization 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 | #include "arm_common_tables.h" |
xorjoep | 1:24714b45cd1b | 31 | |
xorjoep | 1:24714b45cd1b | 32 | /** |
xorjoep | 1:24714b45cd1b | 33 | * @ingroup groupTransforms |
xorjoep | 1:24714b45cd1b | 34 | */ |
xorjoep | 1:24714b45cd1b | 35 | |
xorjoep | 1:24714b45cd1b | 36 | /** |
xorjoep | 1:24714b45cd1b | 37 | * @addtogroup ComplexFFT |
xorjoep | 1:24714b45cd1b | 38 | * @{ |
xorjoep | 1:24714b45cd1b | 39 | */ |
xorjoep | 1:24714b45cd1b | 40 | |
xorjoep | 1:24714b45cd1b | 41 | /** |
xorjoep | 1:24714b45cd1b | 42 | * @brief Initialization function for the floating-point CFFT/CIFFT. |
xorjoep | 1:24714b45cd1b | 43 | * @deprecated Do not use this function. It has been superceded by \ref arm_cfft_f32 and will be removed |
xorjoep | 1:24714b45cd1b | 44 | * in the future. |
xorjoep | 1:24714b45cd1b | 45 | * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure. |
xorjoep | 1:24714b45cd1b | 46 | * @param[in] fftLen length of the FFT. |
xorjoep | 1:24714b45cd1b | 47 | * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. |
xorjoep | 1:24714b45cd1b | 48 | * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. |
xorjoep | 1:24714b45cd1b | 49 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value. |
xorjoep | 1:24714b45cd1b | 50 | * |
xorjoep | 1:24714b45cd1b | 51 | * \par Description: |
xorjoep | 1:24714b45cd1b | 52 | * \par |
xorjoep | 1:24714b45cd1b | 53 | * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed. |
xorjoep | 1:24714b45cd1b | 54 | * Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated |
xorjoep | 1:24714b45cd1b | 55 | * \par |
xorjoep | 1:24714b45cd1b | 56 | * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order. |
xorjoep | 1:24714b45cd1b | 57 | * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order. |
xorjoep | 1:24714b45cd1b | 58 | * \par |
xorjoep | 1:24714b45cd1b | 59 | * The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024. |
xorjoep | 1:24714b45cd1b | 60 | * \par |
xorjoep | 1:24714b45cd1b | 61 | * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer. |
xorjoep | 1:24714b45cd1b | 62 | */ |
xorjoep | 1:24714b45cd1b | 63 | |
xorjoep | 1:24714b45cd1b | 64 | arm_status arm_cfft_radix4_init_f32( |
xorjoep | 1:24714b45cd1b | 65 | arm_cfft_radix4_instance_f32 * S, |
xorjoep | 1:24714b45cd1b | 66 | uint16_t fftLen, |
xorjoep | 1:24714b45cd1b | 67 | uint8_t ifftFlag, |
xorjoep | 1:24714b45cd1b | 68 | uint8_t bitReverseFlag) |
xorjoep | 1:24714b45cd1b | 69 | { |
xorjoep | 1:24714b45cd1b | 70 | /* Initialise the default arm status */ |
xorjoep | 1:24714b45cd1b | 71 | arm_status status = ARM_MATH_SUCCESS; |
xorjoep | 1:24714b45cd1b | 72 | |
xorjoep | 1:24714b45cd1b | 73 | /* Initialise the FFT length */ |
xorjoep | 1:24714b45cd1b | 74 | S->fftLen = fftLen; |
xorjoep | 1:24714b45cd1b | 75 | |
xorjoep | 1:24714b45cd1b | 76 | /* Initialise the Twiddle coefficient pointer */ |
xorjoep | 1:24714b45cd1b | 77 | S->pTwiddle = (float32_t *) twiddleCoef; |
xorjoep | 1:24714b45cd1b | 78 | |
xorjoep | 1:24714b45cd1b | 79 | /* Initialise the Flag for selection of CFFT or CIFFT */ |
xorjoep | 1:24714b45cd1b | 80 | S->ifftFlag = ifftFlag; |
xorjoep | 1:24714b45cd1b | 81 | |
xorjoep | 1:24714b45cd1b | 82 | /* Initialise the Flag for calculation Bit reversal or not */ |
xorjoep | 1:24714b45cd1b | 83 | S->bitReverseFlag = bitReverseFlag; |
xorjoep | 1:24714b45cd1b | 84 | |
xorjoep | 1:24714b45cd1b | 85 | /* Initializations of structure parameters depending on the FFT length */ |
xorjoep | 1:24714b45cd1b | 86 | switch (S->fftLen) |
xorjoep | 1:24714b45cd1b | 87 | { |
xorjoep | 1:24714b45cd1b | 88 | |
xorjoep | 1:24714b45cd1b | 89 | case 4096U: |
xorjoep | 1:24714b45cd1b | 90 | /* Initializations of structure parameters for 4096 point FFT */ |
xorjoep | 1:24714b45cd1b | 91 | |
xorjoep | 1:24714b45cd1b | 92 | /* Initialise the twiddle coef modifier value */ |
xorjoep | 1:24714b45cd1b | 93 | S->twidCoefModifier = 1U; |
xorjoep | 1:24714b45cd1b | 94 | /* Initialise the bit reversal table modifier */ |
xorjoep | 1:24714b45cd1b | 95 | S->bitRevFactor = 1U; |
xorjoep | 1:24714b45cd1b | 96 | /* Initialise the bit reversal table pointer */ |
xorjoep | 1:24714b45cd1b | 97 | S->pBitRevTable = (uint16_t *) armBitRevTable; |
xorjoep | 1:24714b45cd1b | 98 | /* Initialise the 1/fftLen Value */ |
xorjoep | 1:24714b45cd1b | 99 | S->onebyfftLen = 0.000244140625; |
xorjoep | 1:24714b45cd1b | 100 | break; |
xorjoep | 1:24714b45cd1b | 101 | |
xorjoep | 1:24714b45cd1b | 102 | case 1024U: |
xorjoep | 1:24714b45cd1b | 103 | /* Initializations of structure parameters for 1024 point FFT */ |
xorjoep | 1:24714b45cd1b | 104 | |
xorjoep | 1:24714b45cd1b | 105 | /* Initialise the twiddle coef modifier value */ |
xorjoep | 1:24714b45cd1b | 106 | S->twidCoefModifier = 4U; |
xorjoep | 1:24714b45cd1b | 107 | /* Initialise the bit reversal table modifier */ |
xorjoep | 1:24714b45cd1b | 108 | S->bitRevFactor = 4U; |
xorjoep | 1:24714b45cd1b | 109 | /* Initialise the bit reversal table pointer */ |
xorjoep | 1:24714b45cd1b | 110 | S->pBitRevTable = (uint16_t *) & armBitRevTable[3]; |
xorjoep | 1:24714b45cd1b | 111 | /* Initialise the 1/fftLen Value */ |
xorjoep | 1:24714b45cd1b | 112 | S->onebyfftLen = 0.0009765625f; |
xorjoep | 1:24714b45cd1b | 113 | break; |
xorjoep | 1:24714b45cd1b | 114 | |
xorjoep | 1:24714b45cd1b | 115 | |
xorjoep | 1:24714b45cd1b | 116 | case 256U: |
xorjoep | 1:24714b45cd1b | 117 | /* Initializations of structure parameters for 256 point FFT */ |
xorjoep | 1:24714b45cd1b | 118 | S->twidCoefModifier = 16U; |
xorjoep | 1:24714b45cd1b | 119 | S->bitRevFactor = 16U; |
xorjoep | 1:24714b45cd1b | 120 | S->pBitRevTable = (uint16_t *) & armBitRevTable[15]; |
xorjoep | 1:24714b45cd1b | 121 | S->onebyfftLen = 0.00390625f; |
xorjoep | 1:24714b45cd1b | 122 | break; |
xorjoep | 1:24714b45cd1b | 123 | |
xorjoep | 1:24714b45cd1b | 124 | case 64U: |
xorjoep | 1:24714b45cd1b | 125 | /* Initializations of structure parameters for 64 point FFT */ |
xorjoep | 1:24714b45cd1b | 126 | S->twidCoefModifier = 64U; |
xorjoep | 1:24714b45cd1b | 127 | S->bitRevFactor = 64U; |
xorjoep | 1:24714b45cd1b | 128 | S->pBitRevTable = (uint16_t *) & armBitRevTable[63]; |
xorjoep | 1:24714b45cd1b | 129 | S->onebyfftLen = 0.015625f; |
xorjoep | 1:24714b45cd1b | 130 | break; |
xorjoep | 1:24714b45cd1b | 131 | |
xorjoep | 1:24714b45cd1b | 132 | case 16U: |
xorjoep | 1:24714b45cd1b | 133 | /* Initializations of structure parameters for 16 point FFT */ |
xorjoep | 1:24714b45cd1b | 134 | S->twidCoefModifier = 256U; |
xorjoep | 1:24714b45cd1b | 135 | S->bitRevFactor = 256U; |
xorjoep | 1:24714b45cd1b | 136 | S->pBitRevTable = (uint16_t *) & armBitRevTable[255]; |
xorjoep | 1:24714b45cd1b | 137 | S->onebyfftLen = 0.0625f; |
xorjoep | 1:24714b45cd1b | 138 | break; |
xorjoep | 1:24714b45cd1b | 139 | |
xorjoep | 1:24714b45cd1b | 140 | |
xorjoep | 1:24714b45cd1b | 141 | default: |
xorjoep | 1:24714b45cd1b | 142 | /* Reporting argument error if fftSize is not valid value */ |
xorjoep | 1:24714b45cd1b | 143 | status = ARM_MATH_ARGUMENT_ERROR; |
xorjoep | 1:24714b45cd1b | 144 | break; |
xorjoep | 1:24714b45cd1b | 145 | } |
xorjoep | 1:24714b45cd1b | 146 | |
xorjoep | 1:24714b45cd1b | 147 | return (status); |
xorjoep | 1:24714b45cd1b | 148 | } |
xorjoep | 1:24714b45cd1b | 149 | |
xorjoep | 1:24714b45cd1b | 150 | /** |
xorjoep | 1:24714b45cd1b | 151 | * @} end of ComplexFFT group |
xorjoep | 1:24714b45cd1b | 152 | */ |