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