The CMSIS DSP 5 library
Dependents: Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more
functions/TransformFunctions/arm_cfft_radix4_init_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_radix4_init_q31.c |
xorjoep | 1:24714b45cd1b | 4 | * Description: Radix-4 Decimation in Frequency Q31 FFT & IFFT 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 | * |
xorjoep | 1:24714b45cd1b | 43 | * @brief Initialization function for the Q31 CFFT/CIFFT. |
xorjoep | 1:24714b45cd1b | 44 | * @deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed |
xorjoep | 1:24714b45cd1b | 45 | * @param[in,out] *S points to an instance of the Q31 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_q31( |
xorjoep | 1:24714b45cd1b | 65 | arm_cfft_radix4_instance_q31 * 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 | /* Initialise the FFT length */ |
xorjoep | 1:24714b45cd1b | 73 | S->fftLen = fftLen; |
xorjoep | 1:24714b45cd1b | 74 | /* Initialise the Twiddle coefficient pointer */ |
xorjoep | 1:24714b45cd1b | 75 | S->pTwiddle = (q31_t *) twiddleCoef_4096_q31; |
xorjoep | 1:24714b45cd1b | 76 | /* Initialise the Flag for selection of CFFT or CIFFT */ |
xorjoep | 1:24714b45cd1b | 77 | S->ifftFlag = ifftFlag; |
xorjoep | 1:24714b45cd1b | 78 | /* Initialise the Flag for calculation Bit reversal or not */ |
xorjoep | 1:24714b45cd1b | 79 | S->bitReverseFlag = bitReverseFlag; |
xorjoep | 1:24714b45cd1b | 80 | |
xorjoep | 1:24714b45cd1b | 81 | /* Initializations of Instance structure depending on the FFT length */ |
xorjoep | 1:24714b45cd1b | 82 | switch (S->fftLen) |
xorjoep | 1:24714b45cd1b | 83 | { |
xorjoep | 1:24714b45cd1b | 84 | /* Initializations of structure parameters for 4096 point FFT */ |
xorjoep | 1:24714b45cd1b | 85 | case 4096U: |
xorjoep | 1:24714b45cd1b | 86 | /* Initialise the twiddle coef modifier value */ |
xorjoep | 1:24714b45cd1b | 87 | S->twidCoefModifier = 1U; |
xorjoep | 1:24714b45cd1b | 88 | /* Initialise the bit reversal table modifier */ |
xorjoep | 1:24714b45cd1b | 89 | S->bitRevFactor = 1U; |
xorjoep | 1:24714b45cd1b | 90 | /* Initialise the bit reversal table pointer */ |
xorjoep | 1:24714b45cd1b | 91 | S->pBitRevTable = (uint16_t *) armBitRevTable; |
xorjoep | 1:24714b45cd1b | 92 | break; |
xorjoep | 1:24714b45cd1b | 93 | |
xorjoep | 1:24714b45cd1b | 94 | /* Initializations of structure parameters for 1024 point FFT */ |
xorjoep | 1:24714b45cd1b | 95 | case 1024U: |
xorjoep | 1:24714b45cd1b | 96 | /* Initialise the twiddle coef modifier value */ |
xorjoep | 1:24714b45cd1b | 97 | S->twidCoefModifier = 4U; |
xorjoep | 1:24714b45cd1b | 98 | /* Initialise the bit reversal table modifier */ |
xorjoep | 1:24714b45cd1b | 99 | S->bitRevFactor = 4U; |
xorjoep | 1:24714b45cd1b | 100 | /* Initialise the bit reversal table pointer */ |
xorjoep | 1:24714b45cd1b | 101 | S->pBitRevTable = (uint16_t *) & armBitRevTable[3]; |
xorjoep | 1:24714b45cd1b | 102 | break; |
xorjoep | 1:24714b45cd1b | 103 | |
xorjoep | 1:24714b45cd1b | 104 | case 256U: |
xorjoep | 1:24714b45cd1b | 105 | /* Initializations of structure parameters for 256 point FFT */ |
xorjoep | 1:24714b45cd1b | 106 | S->twidCoefModifier = 16U; |
xorjoep | 1:24714b45cd1b | 107 | S->bitRevFactor = 16U; |
xorjoep | 1:24714b45cd1b | 108 | S->pBitRevTable = (uint16_t *) & armBitRevTable[15]; |
xorjoep | 1:24714b45cd1b | 109 | break; |
xorjoep | 1:24714b45cd1b | 110 | |
xorjoep | 1:24714b45cd1b | 111 | case 64U: |
xorjoep | 1:24714b45cd1b | 112 | /* Initializations of structure parameters for 64 point FFT */ |
xorjoep | 1:24714b45cd1b | 113 | S->twidCoefModifier = 64U; |
xorjoep | 1:24714b45cd1b | 114 | S->bitRevFactor = 64U; |
xorjoep | 1:24714b45cd1b | 115 | S->pBitRevTable = (uint16_t *) & armBitRevTable[63]; |
xorjoep | 1:24714b45cd1b | 116 | break; |
xorjoep | 1:24714b45cd1b | 117 | |
xorjoep | 1:24714b45cd1b | 118 | case 16U: |
xorjoep | 1:24714b45cd1b | 119 | /* Initializations of structure parameters for 16 point FFT */ |
xorjoep | 1:24714b45cd1b | 120 | S->twidCoefModifier = 256U; |
xorjoep | 1:24714b45cd1b | 121 | S->bitRevFactor = 256U; |
xorjoep | 1:24714b45cd1b | 122 | S->pBitRevTable = (uint16_t *) & armBitRevTable[255]; |
xorjoep | 1:24714b45cd1b | 123 | break; |
xorjoep | 1:24714b45cd1b | 124 | |
xorjoep | 1:24714b45cd1b | 125 | default: |
xorjoep | 1:24714b45cd1b | 126 | /* Reporting argument error if fftSize is not valid value */ |
xorjoep | 1:24714b45cd1b | 127 | status = ARM_MATH_ARGUMENT_ERROR; |
xorjoep | 1:24714b45cd1b | 128 | break; |
xorjoep | 1:24714b45cd1b | 129 | } |
xorjoep | 1:24714b45cd1b | 130 | |
xorjoep | 1:24714b45cd1b | 131 | return (status); |
xorjoep | 1:24714b45cd1b | 132 | } |
xorjoep | 1:24714b45cd1b | 133 | |
xorjoep | 1:24714b45cd1b | 134 | /** |
xorjoep | 1:24714b45cd1b | 135 | * @} end of ComplexFFT group |
xorjoep | 1:24714b45cd1b | 136 | */ |