1 /* ----------------------------------------------------------------------
2 * Copyright (C) 2010-2013 ARM Limited. All rights reserved.
4 * $Date: 17. January 2013
7 * Project: CMSIS DSP Library
8 * Title: arm_cfft_init_f32.c
10 * Description: Split Radix Decimation in Frequency CFFT Floating point processing function
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
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
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.
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 * -------------------------------------------------------------------- */
42 #include "arm_common_tables.h"
45 * @ingroup groupTransforms
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.
61 * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
62 * Set(=1) ifftFlag for calculation of CIFFT otherwise RFFT is calculated
64 * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
65 * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
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.
69 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
71 arm_status
arm_rfft_fast_init_f32(
72 arm_rfft_fast_instance_f32
* S
,
75 arm_cfft_instance_f32
* Sint
;
76 /* Initialise the default arm status */
77 arm_status status
= ARM_MATH_SUCCESS
;
78 /* Initialise the FFT length */
80 Sint
->fftLen
= fftLen
/2;
81 S
->fftLenRFFT
= fftLen
;
82 /* Initialise the Twiddle coefficient pointer */
83 // S->pTwiddle = (float32_t *) twiddleCoef;
85 /* Initializations of structure parameters depending on the FFT length */
89 /* Initializations of structure parameters for 4096 point FFT */
90 /* Initialise the bit reversal table length */
91 Sint
->bitRevLength
= ARMBITREVINDEXTABLE4096_TABLE_LENGTH
;
92 /* Initialise the bit reversal table pointer */
93 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable4096
;
94 /* Initialise the 1/fftLen Value */
97 Sint
->bitRevLength
= ARMBITREVINDEXTABLE2048_TABLE_LENGTH
;
98 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable2048
;
101 Sint
->bitRevLength
= ARMBITREVINDEXTABLE1024_TABLE_LENGTH
;
102 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable1024
;
105 Sint
->bitRevLength
= ARMBITREVINDEXTABLE_512_TABLE_LENGTH
;
106 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable512
;
109 Sint
->bitRevLength
= ARMBITREVINDEXTABLE_256_TABLE_LENGTH
;
110 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable256
;
113 Sint
->bitRevLength
= ARMBITREVINDEXTABLE_128_TABLE_LENGTH
;
114 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable128
;
117 Sint
->bitRevLength
= ARMBITREVINDEXTABLE__64_TABLE_LENGTH
;
118 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable64
;
121 Sint
->bitRevLength
= ARMBITREVINDEXTABLE__32_TABLE_LENGTH
;
122 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable32
;
125 Sint
->bitRevLength
= ARMBITREVINDEXTABLE__16_TABLE_LENGTH
;
126 Sint
->pBitRevTable
= (uint16_t *)armBitRevIndexTable16
;
129 /* Reporting argument error if fftSize is not valid value */
130 status
= ARM_MATH_ARGUMENT_ERROR
;
138 * @} end of RealFFT group