Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dsp by
arm_cfft_radix2_init_f32.c
00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2010-2013 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 17. January 2013 00005 * $Revision: V1.4.1 00006 * 00007 * Project: CMSIS DSP Library 00008 * Title: arm_cfft_radix4_init_f32.c 00009 * 00010 * Description: Radix-4 Decimation in Frequency Floating-point CFFT & CIFFT Initialization function 00011 * 00012 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions 00016 * are met: 00017 * - Redistributions of source code must retain the above copyright 00018 * notice, this list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright 00020 * notice, this list of conditions and the following disclaimer in 00021 * the documentation and/or other materials provided with the 00022 * distribution. 00023 * - Neither the name of ARM LIMITED nor the names of its contributors 00024 * may be used to endorse or promote products derived from this 00025 * software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00028 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00029 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00030 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00031 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00032 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00033 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00034 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00035 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00036 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00037 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00038 * POSSIBILITY OF SUCH DAMAGE. 00039 * -------------------------------------------------------------------- */ 00040 00041 00042 #include "arm_math.h" 00043 #include "arm_common_tables.h" 00044 00045 /** 00046 * @ingroup groupTransforms 00047 */ 00048 00049 /** 00050 * @addtogroup ComplexFFT 00051 * @{ 00052 */ 00053 00054 /** 00055 * @brief Initialization function for the floating-point CFFT/CIFFT. 00056 * @deprecated Do not use this function. It has been superceded by \ref arm_cfft_f32 and will be removed 00057 * in the future. 00058 * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure. 00059 * @param[in] fftLen length of the FFT. 00060 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. 00061 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. 00062 * @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. 00063 * 00064 * \par Description: 00065 * \par 00066 * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed. 00067 * Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated 00068 * \par 00069 * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order. 00070 * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order. 00071 * \par 00072 * The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024. 00073 * \par 00074 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer. 00075 */ 00076 arm_status arm_cfft_radix2_init_f32( 00077 arm_cfft_radix2_instance_f32 * S, 00078 uint16_t fftLen, 00079 uint8_t ifftFlag, 00080 uint8_t bitReverseFlag) 00081 { 00082 /* Initialise the default arm status */ 00083 arm_status status = ARM_MATH_SUCCESS; 00084 00085 /* Initialise the FFT length */ 00086 S->fftLen = fftLen; 00087 00088 /* Initialise the Twiddle coefficient pointer */ 00089 S->pTwiddle = (float32_t *) twiddleCoef; 00090 00091 /* Initialise the Flag for selection of CFFT or CIFFT */ 00092 S->ifftFlag = ifftFlag; 00093 00094 /* Initialise the Flag for calculation Bit reversal or not */ 00095 S->bitReverseFlag = bitReverseFlag; 00096 00097 /* Initializations of structure parameters depending on the FFT length */ 00098 switch (S->fftLen) 00099 { 00100 00101 case 4096u: 00102 /* Initializations of structure parameters for 4096 point FFT */ 00103 00104 /* Initialise the twiddle coef modifier value */ 00105 S->twidCoefModifier = 1u; 00106 /* Initialise the bit reversal table modifier */ 00107 S->bitRevFactor = 1u; 00108 /* Initialise the bit reversal table pointer */ 00109 S->pBitRevTable = (uint16_t *) armBitRevTable ; 00110 /* Initialise the 1/fftLen Value */ 00111 S->onebyfftLen = 0.000244140625; 00112 break; 00113 00114 case 2048u: 00115 /* Initializations of structure parameters for 2048 point FFT */ 00116 00117 /* Initialise the twiddle coef modifier value */ 00118 S->twidCoefModifier = 2u; 00119 /* Initialise the bit reversal table modifier */ 00120 S->bitRevFactor = 2u; 00121 /* Initialise the bit reversal table pointer */ 00122 S->pBitRevTable = (uint16_t *) & armBitRevTable [1]; 00123 /* Initialise the 1/fftLen Value */ 00124 S->onebyfftLen = 0.00048828125; 00125 break; 00126 00127 case 1024u: 00128 /* Initializations of structure parameters for 1024 point FFT */ 00129 00130 /* Initialise the twiddle coef modifier value */ 00131 S->twidCoefModifier = 4u; 00132 /* Initialise the bit reversal table modifier */ 00133 S->bitRevFactor = 4u; 00134 /* Initialise the bit reversal table pointer */ 00135 S->pBitRevTable = (uint16_t *) & armBitRevTable [3]; 00136 /* Initialise the 1/fftLen Value */ 00137 S->onebyfftLen = 0.0009765625f; 00138 break; 00139 00140 case 512u: 00141 /* Initializations of structure parameters for 512 point FFT */ 00142 00143 /* Initialise the twiddle coef modifier value */ 00144 S->twidCoefModifier = 8u; 00145 /* Initialise the bit reversal table modifier */ 00146 S->bitRevFactor = 8u; 00147 /* Initialise the bit reversal table pointer */ 00148 S->pBitRevTable = (uint16_t *) & armBitRevTable [7]; 00149 /* Initialise the 1/fftLen Value */ 00150 S->onebyfftLen = 0.001953125; 00151 break; 00152 00153 case 256u: 00154 /* Initializations of structure parameters for 256 point FFT */ 00155 S->twidCoefModifier = 16u; 00156 S->bitRevFactor = 16u; 00157 S->pBitRevTable = (uint16_t *) & armBitRevTable [15]; 00158 S->onebyfftLen = 0.00390625f; 00159 break; 00160 00161 case 128u: 00162 /* Initializations of structure parameters for 128 point FFT */ 00163 S->twidCoefModifier = 32u; 00164 S->bitRevFactor = 32u; 00165 S->pBitRevTable = (uint16_t *) & armBitRevTable [31]; 00166 S->onebyfftLen = 0.0078125; 00167 break; 00168 00169 case 64u: 00170 /* Initializations of structure parameters for 64 point FFT */ 00171 S->twidCoefModifier = 64u; 00172 S->bitRevFactor = 64u; 00173 S->pBitRevTable = (uint16_t *) & armBitRevTable [63]; 00174 S->onebyfftLen = 0.015625f; 00175 break; 00176 00177 case 32u: 00178 /* Initializations of structure parameters for 64 point FFT */ 00179 S->twidCoefModifier = 128u; 00180 S->bitRevFactor = 128u; 00181 S->pBitRevTable = (uint16_t *) & armBitRevTable [127]; 00182 S->onebyfftLen = 0.03125; 00183 break; 00184 00185 case 16u: 00186 /* Initializations of structure parameters for 16 point FFT */ 00187 S->twidCoefModifier = 256u; 00188 S->bitRevFactor = 256u; 00189 S->pBitRevTable = (uint16_t *) & armBitRevTable [255]; 00190 S->onebyfftLen = 0.0625f; 00191 break; 00192 00193 00194 default: 00195 /* Reporting argument error if fftSize is not valid value */ 00196 status = ARM_MATH_ARGUMENT_ERROR; 00197 break; 00198 } 00199 00200 return (status); 00201 } 00202 00203 /** 00204 * @} end of ComplexFFT group 00205 */
Generated on Tue Jul 12 2022 18:44:08 by
1.7.2
