mbed-os 6.10 versione
cmsis_dsp/TransformFunctions/arm_rfft_fast_init_f32.c@5:ed60e5c5c2a8, 2021-06-21 (annotated)
- Committer:
- michelericcio
- Date:
- Mon Jun 21 10:16:02 2021 +0000
- Revision:
- 5:ed60e5c5c2a8
- Parent:
- 3:7a284390b0ce
mbed-dsp working on ST Nucleo F767ZI and mbed-OS 6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 3:7a284390b0ce | 1 | /* ---------------------------------------------------------------------- |
mbed_official | 3:7a284390b0ce | 2 | * Copyright (C) 2010-2013 ARM Limited. All rights reserved. |
mbed_official | 3:7a284390b0ce | 3 | * |
mbed_official | 3:7a284390b0ce | 4 | * $Date: 17. January 2013 |
mbed_official | 3:7a284390b0ce | 5 | * $Revision: V1.4.1 |
mbed_official | 3:7a284390b0ce | 6 | * |
mbed_official | 3:7a284390b0ce | 7 | * Project: CMSIS DSP Library |
mbed_official | 3:7a284390b0ce | 8 | * Title: arm_cfft_init_f32.c |
mbed_official | 3:7a284390b0ce | 9 | * |
mbed_official | 3:7a284390b0ce | 10 | * Description: Split Radix Decimation in Frequency CFFT Floating point processing function |
mbed_official | 3:7a284390b0ce | 11 | * |
mbed_official | 3:7a284390b0ce | 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 |
mbed_official | 3:7a284390b0ce | 13 | * |
mbed_official | 3:7a284390b0ce | 14 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 3:7a284390b0ce | 15 | * modification, are permitted provided that the following conditions |
mbed_official | 3:7a284390b0ce | 16 | * are met: |
mbed_official | 3:7a284390b0ce | 17 | * - Redistributions of source code must retain the above copyright |
mbed_official | 3:7a284390b0ce | 18 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 3:7a284390b0ce | 19 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 3:7a284390b0ce | 20 | * notice, this list of conditions and the following disclaimer in |
mbed_official | 3:7a284390b0ce | 21 | * the documentation and/or other materials provided with the |
mbed_official | 3:7a284390b0ce | 22 | * distribution. |
mbed_official | 3:7a284390b0ce | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
mbed_official | 3:7a284390b0ce | 24 | * may be used to endorse or promote products derived from this |
mbed_official | 3:7a284390b0ce | 25 | * software without specific prior written permission. |
mbed_official | 3:7a284390b0ce | 26 | * |
mbed_official | 3:7a284390b0ce | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
mbed_official | 3:7a284390b0ce | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
mbed_official | 3:7a284390b0ce | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
mbed_official | 3:7a284390b0ce | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
mbed_official | 3:7a284390b0ce | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
mbed_official | 3:7a284390b0ce | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
mbed_official | 3:7a284390b0ce | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
mbed_official | 3:7a284390b0ce | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 3:7a284390b0ce | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
mbed_official | 3:7a284390b0ce | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
mbed_official | 3:7a284390b0ce | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 3:7a284390b0ce | 38 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 3:7a284390b0ce | 39 | * -------------------------------------------------------------------- */ |
mbed_official | 3:7a284390b0ce | 40 | |
mbed_official | 3:7a284390b0ce | 41 | #include "arm_math.h" |
mbed_official | 3:7a284390b0ce | 42 | #include "arm_common_tables.h" |
mbed_official | 3:7a284390b0ce | 43 | |
mbed_official | 3:7a284390b0ce | 44 | /** |
mbed_official | 3:7a284390b0ce | 45 | * @ingroup groupTransforms |
mbed_official | 3:7a284390b0ce | 46 | */ |
mbed_official | 3:7a284390b0ce | 47 | |
mbed_official | 3:7a284390b0ce | 48 | /** |
mbed_official | 3:7a284390b0ce | 49 | * @addtogroup RealFFT |
mbed_official | 3:7a284390b0ce | 50 | * @{ |
mbed_official | 3:7a284390b0ce | 51 | */ |
mbed_official | 3:7a284390b0ce | 52 | |
mbed_official | 3:7a284390b0ce | 53 | /** |
mbed_official | 3:7a284390b0ce | 54 | * @brief Initialization function for the floating-point real FFT. |
mbed_official | 3:7a284390b0ce | 55 | * @param[in,out] *S points to an arm_rfft_fast_instance_f32 structure. |
mbed_official | 3:7a284390b0ce | 56 | * @param[in] fftLen length of the Real Sequence. |
mbed_official | 3:7a284390b0ce | 57 | * @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. |
mbed_official | 3:7a284390b0ce | 58 | * |
mbed_official | 3:7a284390b0ce | 59 | * \par Description: |
mbed_official | 3:7a284390b0ce | 60 | * \par |
mbed_official | 3:7a284390b0ce | 61 | * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed. |
mbed_official | 3:7a284390b0ce | 62 | * Set(=1) ifftFlag for calculation of CIFFT otherwise RFFT is calculated |
mbed_official | 3:7a284390b0ce | 63 | * \par |
mbed_official | 3:7a284390b0ce | 64 | * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order. |
mbed_official | 3:7a284390b0ce | 65 | * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order. |
mbed_official | 3:7a284390b0ce | 66 | * \par |
mbed_official | 3:7a284390b0ce | 67 | * The parameter <code>fftLen</code> Specifies length of RFFT/CIFFT process. Supported FFT Lengths are 16, 32, 64, 128, 256, 512, 1024, 2048, 4096. |
mbed_official | 3:7a284390b0ce | 68 | * \par |
mbed_official | 3:7a284390b0ce | 69 | * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer. |
mbed_official | 3:7a284390b0ce | 70 | */ |
mbed_official | 3:7a284390b0ce | 71 | arm_status arm_rfft_fast_init_f32( |
mbed_official | 3:7a284390b0ce | 72 | arm_rfft_fast_instance_f32 * S, |
mbed_official | 3:7a284390b0ce | 73 | uint16_t fftLen) |
mbed_official | 3:7a284390b0ce | 74 | { |
mbed_official | 3:7a284390b0ce | 75 | arm_cfft_instance_f32 * Sint; |
mbed_official | 3:7a284390b0ce | 76 | /* Initialise the default arm status */ |
mbed_official | 3:7a284390b0ce | 77 | arm_status status = ARM_MATH_SUCCESS; |
mbed_official | 3:7a284390b0ce | 78 | /* Initialise the FFT length */ |
mbed_official | 3:7a284390b0ce | 79 | Sint = &(S->Sint); |
mbed_official | 3:7a284390b0ce | 80 | Sint->fftLen = fftLen/2; |
mbed_official | 3:7a284390b0ce | 81 | S->fftLenRFFT = fftLen; |
mbed_official | 3:7a284390b0ce | 82 | /* Initialise the Twiddle coefficient pointer */ |
mbed_official | 3:7a284390b0ce | 83 | // S->pTwiddle = (float32_t *) twiddleCoef; |
mbed_official | 3:7a284390b0ce | 84 | |
mbed_official | 3:7a284390b0ce | 85 | /* Initializations of structure parameters depending on the FFT length */ |
mbed_official | 3:7a284390b0ce | 86 | switch (Sint->fftLen) |
mbed_official | 3:7a284390b0ce | 87 | { |
mbed_official | 3:7a284390b0ce | 88 | case 4096u: |
mbed_official | 3:7a284390b0ce | 89 | /* Initializations of structure parameters for 4096 point FFT */ |
mbed_official | 3:7a284390b0ce | 90 | /* Initialise the bit reversal table length */ |
mbed_official | 3:7a284390b0ce | 91 | Sint->bitRevLength = ARMBITREVINDEXTABLE4096_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 92 | /* Initialise the bit reversal table pointer */ |
mbed_official | 3:7a284390b0ce | 93 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable4096; |
mbed_official | 3:7a284390b0ce | 94 | /* Initialise the 1/fftLen Value */ |
mbed_official | 3:7a284390b0ce | 95 | break; |
mbed_official | 3:7a284390b0ce | 96 | case 2048u: |
mbed_official | 3:7a284390b0ce | 97 | Sint->bitRevLength = ARMBITREVINDEXTABLE2048_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 98 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048; |
mbed_official | 3:7a284390b0ce | 99 | break; |
mbed_official | 3:7a284390b0ce | 100 | case 1024u: |
mbed_official | 3:7a284390b0ce | 101 | Sint->bitRevLength = ARMBITREVINDEXTABLE1024_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 102 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024; |
mbed_official | 3:7a284390b0ce | 103 | break; |
mbed_official | 3:7a284390b0ce | 104 | case 512u: |
mbed_official | 3:7a284390b0ce | 105 | Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 106 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512; |
mbed_official | 3:7a284390b0ce | 107 | break; |
mbed_official | 3:7a284390b0ce | 108 | case 256u: |
mbed_official | 3:7a284390b0ce | 109 | Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 110 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256; |
mbed_official | 3:7a284390b0ce | 111 | break; |
mbed_official | 3:7a284390b0ce | 112 | case 128u: |
mbed_official | 3:7a284390b0ce | 113 | Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 114 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128; |
mbed_official | 3:7a284390b0ce | 115 | break; |
mbed_official | 3:7a284390b0ce | 116 | case 64u: |
mbed_official | 3:7a284390b0ce | 117 | Sint->bitRevLength = ARMBITREVINDEXTABLE__64_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 118 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64; |
mbed_official | 3:7a284390b0ce | 119 | break; |
mbed_official | 3:7a284390b0ce | 120 | case 32u: |
mbed_official | 3:7a284390b0ce | 121 | Sint->bitRevLength = ARMBITREVINDEXTABLE__32_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 122 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32; |
mbed_official | 3:7a284390b0ce | 123 | break; |
mbed_official | 3:7a284390b0ce | 124 | case 16u: |
mbed_official | 3:7a284390b0ce | 125 | Sint->bitRevLength = ARMBITREVINDEXTABLE__16_TABLE_LENGTH; |
mbed_official | 3:7a284390b0ce | 126 | Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16; |
mbed_official | 3:7a284390b0ce | 127 | break; |
mbed_official | 3:7a284390b0ce | 128 | default: |
mbed_official | 3:7a284390b0ce | 129 | /* Reporting argument error if fftSize is not valid value */ |
mbed_official | 3:7a284390b0ce | 130 | status = ARM_MATH_ARGUMENT_ERROR; |
mbed_official | 3:7a284390b0ce | 131 | break; |
mbed_official | 3:7a284390b0ce | 132 | } |
mbed_official | 3:7a284390b0ce | 133 | |
mbed_official | 3:7a284390b0ce | 134 | return (status); |
mbed_official | 3:7a284390b0ce | 135 | } |
mbed_official | 3:7a284390b0ce | 136 | |
mbed_official | 3:7a284390b0ce | 137 | /** |
mbed_official | 3:7a284390b0ce | 138 | * @} end of RealFFT group |
mbed_official | 3:7a284390b0ce | 139 | */ |