The CMSIS DSP 5 library

Dependents:   Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more

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?

UserRevisionLine numberNew contents of line
xorjoep 1:24714b45cd1b 1 /* ----------------------------------------------------------------------
xorjoep 1:24714b45cd1b 2 * Project: CMSIS DSP Library
xorjoep 1:24714b45cd1b 3 * Title: arm_cfft_init_f32.c
xorjoep 1:24714b45cd1b 4 * Description: Split Radix Decimation in Frequency CFFT Floating 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 #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 RealFFT
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 real FFT.
xorjoep 1:24714b45cd1b 43 * @param[in,out] *S points to an arm_rfft_fast_instance_f32 structure.
xorjoep 1:24714b45cd1b 44 * @param[in] fftLen length of the Real Sequence.
xorjoep 1:24714b45cd1b 45 * @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 46 *
xorjoep 1:24714b45cd1b 47 * \par Description:
xorjoep 1:24714b45cd1b 48 * \par
xorjoep 1:24714b45cd1b 49 * The parameter <code>fftLen</code> Specifies length of RFFT/CIFFT process. Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096.
xorjoep 1:24714b45cd1b 50 * \par
xorjoep 1:24714b45cd1b 51 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
xorjoep 1:24714b45cd1b 52 */
xorjoep 1:24714b45cd1b 53 arm_status arm_rfft_fast_init_f32(
xorjoep 1:24714b45cd1b 54 arm_rfft_fast_instance_f32 * S,
xorjoep 1:24714b45cd1b 55 uint16_t fftLen)
xorjoep 1:24714b45cd1b 56 {
xorjoep 1:24714b45cd1b 57 arm_cfft_instance_f32 * Sint;
xorjoep 1:24714b45cd1b 58 /* Initialise the default arm status */
xorjoep 1:24714b45cd1b 59 arm_status status = ARM_MATH_SUCCESS;
xorjoep 1:24714b45cd1b 60 /* Initialise the FFT length */
xorjoep 1:24714b45cd1b 61 Sint = &(S->Sint);
xorjoep 1:24714b45cd1b 62 Sint->fftLen = fftLen/2;
xorjoep 1:24714b45cd1b 63 S->fftLenRFFT = fftLen;
xorjoep 1:24714b45cd1b 64
xorjoep 1:24714b45cd1b 65 /* Initializations of structure parameters depending on the FFT length */
xorjoep 1:24714b45cd1b 66 switch (Sint->fftLen)
xorjoep 1:24714b45cd1b 67 {
xorjoep 1:24714b45cd1b 68 case 2048U:
xorjoep 1:24714b45cd1b 69 /* Initializations of structure parameters for 2048 point FFT */
xorjoep 1:24714b45cd1b 70 /* Initialise the bit reversal table length */
xorjoep 1:24714b45cd1b 71 Sint->bitRevLength = ARMBITREVINDEXTABLE_2048_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 72 /* Initialise the bit reversal table pointer */
xorjoep 1:24714b45cd1b 73 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048;
xorjoep 1:24714b45cd1b 74 /* Initialise the Twiddle coefficient pointers */
xorjoep 1:24714b45cd1b 75 Sint->pTwiddle = (float32_t *) twiddleCoef_2048;
xorjoep 1:24714b45cd1b 76 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_4096;
xorjoep 1:24714b45cd1b 77 break;
xorjoep 1:24714b45cd1b 78 case 1024U:
xorjoep 1:24714b45cd1b 79 Sint->bitRevLength = ARMBITREVINDEXTABLE_1024_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 80 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024;
xorjoep 1:24714b45cd1b 81 Sint->pTwiddle = (float32_t *) twiddleCoef_1024;
xorjoep 1:24714b45cd1b 82 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_2048;
xorjoep 1:24714b45cd1b 83 break;
xorjoep 1:24714b45cd1b 84 case 512U:
xorjoep 1:24714b45cd1b 85 Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 86 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512;
xorjoep 1:24714b45cd1b 87 Sint->pTwiddle = (float32_t *) twiddleCoef_512;
xorjoep 1:24714b45cd1b 88 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_1024;
xorjoep 1:24714b45cd1b 89 break;
xorjoep 1:24714b45cd1b 90 case 256U:
xorjoep 1:24714b45cd1b 91 Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 92 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256;
xorjoep 1:24714b45cd1b 93 Sint->pTwiddle = (float32_t *) twiddleCoef_256;
xorjoep 1:24714b45cd1b 94 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_512;
xorjoep 1:24714b45cd1b 95 break;
xorjoep 1:24714b45cd1b 96 case 128U:
xorjoep 1:24714b45cd1b 97 Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 98 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128;
xorjoep 1:24714b45cd1b 99 Sint->pTwiddle = (float32_t *) twiddleCoef_128;
xorjoep 1:24714b45cd1b 100 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_256;
xorjoep 1:24714b45cd1b 101 break;
xorjoep 1:24714b45cd1b 102 case 64U:
xorjoep 1:24714b45cd1b 103 Sint->bitRevLength = ARMBITREVINDEXTABLE_64_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 104 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64;
xorjoep 1:24714b45cd1b 105 Sint->pTwiddle = (float32_t *) twiddleCoef_64;
xorjoep 1:24714b45cd1b 106 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_128;
xorjoep 1:24714b45cd1b 107 break;
xorjoep 1:24714b45cd1b 108 case 32U:
xorjoep 1:24714b45cd1b 109 Sint->bitRevLength = ARMBITREVINDEXTABLE_32_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 110 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32;
xorjoep 1:24714b45cd1b 111 Sint->pTwiddle = (float32_t *) twiddleCoef_32;
xorjoep 1:24714b45cd1b 112 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_64;
xorjoep 1:24714b45cd1b 113 break;
xorjoep 1:24714b45cd1b 114 case 16U:
xorjoep 1:24714b45cd1b 115 Sint->bitRevLength = ARMBITREVINDEXTABLE_16_TABLE_LENGTH;
xorjoep 1:24714b45cd1b 116 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16;
xorjoep 1:24714b45cd1b 117 Sint->pTwiddle = (float32_t *) twiddleCoef_16;
xorjoep 1:24714b45cd1b 118 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_32;
xorjoep 1:24714b45cd1b 119 break;
xorjoep 1:24714b45cd1b 120 default:
xorjoep 1:24714b45cd1b 121 /* Reporting argument error if fftSize is not valid value */
xorjoep 1:24714b45cd1b 122 status = ARM_MATH_ARGUMENT_ERROR;
xorjoep 1:24714b45cd1b 123 break;
xorjoep 1:24714b45cd1b 124 }
xorjoep 1:24714b45cd1b 125
xorjoep 1:24714b45cd1b 126 return (status);
xorjoep 1:24714b45cd1b 127 }
xorjoep 1:24714b45cd1b 128
xorjoep 1:24714b45cd1b 129 /**
xorjoep 1:24714b45cd1b 130 * @} end of RealFFT group
xorjoep 1:24714b45cd1b 131 */