CMSIS-DSP: MVE version of arm_cfft_f32.
parent
169877344c
commit
3060b1da8f
@ -0,0 +1,97 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_mve_tables.h
|
||||
* Description: common tables like fft twiddle factors, Bitreverse, reciprocal etc
|
||||
* used for MVE implementation only
|
||||
*
|
||||
* $Date: 08. January 2020
|
||||
* $Revision: V1.7.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_MVE_TABLES_H
|
||||
#define _ARM_MVE_TABLES_H
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES)
|
||||
|
||||
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_16) || defined(ARM_TABLE_TWIDDLECOEF_F32_32)
|
||||
|
||||
extern uint32_t rearranged_twiddle_tab_stride1_arr_16[2];
|
||||
extern uint32_t rearranged_twiddle_tab_stride2_arr_16[2];
|
||||
extern uint32_t rearranged_twiddle_tab_stride3_arr_16[2];
|
||||
extern float32_t rearranged_twiddle_stride1_16[8];
|
||||
extern float32_t rearranged_twiddle_stride2_16[8];
|
||||
extern float32_t rearranged_twiddle_stride3_16[8];
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_64) || defined(ARM_TABLE_TWIDDLECOEF_F32_128)
|
||||
|
||||
extern uint32_t rearranged_twiddle_tab_stride1_arr_64[3];
|
||||
extern uint32_t rearranged_twiddle_tab_stride2_arr_64[3];
|
||||
extern uint32_t rearranged_twiddle_tab_stride3_arr_64[3];
|
||||
extern float32_t rearranged_twiddle_stride1_64[40];
|
||||
extern float32_t rearranged_twiddle_stride2_64[40];
|
||||
extern float32_t rearranged_twiddle_stride3_64[40];
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_256) || defined(ARM_TABLE_TWIDDLECOEF_F32_512)
|
||||
|
||||
extern uint32_t rearranged_twiddle_tab_stride1_arr_256[4];
|
||||
extern uint32_t rearranged_twiddle_tab_stride2_arr_256[4];
|
||||
extern uint32_t rearranged_twiddle_tab_stride3_arr_256[4];
|
||||
extern float32_t rearranged_twiddle_stride1_256[168];
|
||||
extern float32_t rearranged_twiddle_stride2_256[168];
|
||||
extern float32_t rearranged_twiddle_stride3_256[168];
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_1024) || defined(ARM_TABLE_TWIDDLECOEF_F32_2048)
|
||||
|
||||
extern uint32_t rearranged_twiddle_tab_stride1_arr_1024[5];
|
||||
extern uint32_t rearranged_twiddle_tab_stride2_arr_1024[5];
|
||||
extern uint32_t rearranged_twiddle_tab_stride3_arr_1024[5];
|
||||
extern float32_t rearranged_twiddle_stride1_1024[680];
|
||||
extern float32_t rearranged_twiddle_stride2_1024[680];
|
||||
extern float32_t rearranged_twiddle_stride3_1024[680];
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_4096) || defined(ARM_TABLE_TWIDDLECOEF_F32_8192)
|
||||
|
||||
extern uint32_t rearranged_twiddle_tab_stride1_arr_4096[6];
|
||||
extern uint32_t rearranged_twiddle_tab_stride2_arr_4096[6];
|
||||
extern uint32_t rearranged_twiddle_tab_stride3_arr_4096[6];
|
||||
extern float32_t rearranged_twiddle_stride1_4096[2728];
|
||||
extern float32_t rearranged_twiddle_stride2_4096[2728];
|
||||
extern float32_t rearranged_twiddle_stride3_4096[2728];
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */
|
||||
|
||||
#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */
|
||||
|
||||
#endif /*_ARM_MVE_TABLES_H*/
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
/******************************************************************************
|
||||
* @file arm_vec_fft.h
|
||||
* @brief Private header file for CMSIS DSP Library
|
||||
* @version V1.7.0
|
||||
* @date 07. January 2020
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_VEC_FFT_H_
|
||||
#define _ARM_VEC_FFT_H_
|
||||
|
||||
#include "arm_math.h"
|
||||
#include "arm_helium_utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE)
|
||||
|
||||
#define MVE_CMPLX_ADD_A_ixB(A, B) vcaddq_rot90(A,B)
|
||||
#define MVE_CMPLX_SUB_A_ixB(A,B) vcaddq_rot270(A,B)
|
||||
#define MVE_CMPLX_MULT_FLT_AxB(A,B) vcmlaq_rot90(vcmulq(A, B), A, B)
|
||||
#define MVE_CMPLX_MULT_FLT_Conj_AxB(A,B) vcmlaq_rot270(vcmulq(A, B), A, B)
|
||||
|
||||
#define MVE_CMPLX_MULT_FX_AxB(A,B) vqdmladhxq(vqdmlsdhq((__typeof(A))vuninitializedq_s32(), A, B), A, B);
|
||||
#define MVE_CMPLX_MULT_FX_AxConjB(A,B) vqdmladhq(vqdmlsdhxq((__typeof(A))vuninitializedq_s32(), A, B), A, B);
|
||||
|
||||
#define MVE_CMPLX_ADD_FX_A_ixB(A, B) vhcaddq_rot90(A,B)
|
||||
#define MVE_CMPLX_SUB_FX_A_ixB(A,B) vhcaddq_rot270(A,B)
|
||||
|
||||
|
||||
#endif /* (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE)*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _ARM_VEC_FFT_H_ */
|
||||
@ -0,0 +1,4 @@
|
||||
README
|
||||
======
|
||||
|
||||
Python scripts to generate C arrays used in implementation of some algorithms.
|
||||
@ -0,0 +1,266 @@
|
||||
import numpy as np
|
||||
import math
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='Generate C arrays')
|
||||
parser.add_argument('-f', nargs='?',type = str, default="../Source/CommonTables/arm_mve_tables.c", help="C File path")
|
||||
parser.add_argument('-he', nargs='?',type = str, default="../Include/arm_mve_tables.h", help="H File path")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
COLLIM = 80
|
||||
|
||||
condition="""#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_%d) || defined(ARM_TABLE_TWIDDLECOEF_F32_%d)
|
||||
"""
|
||||
|
||||
def printCUInt32Array(f,name,arr):
|
||||
nb = 0
|
||||
print("uint32_t %s[%d]={" % (name,len(arr)),file=f)
|
||||
|
||||
for d in arr:
|
||||
val = "%d," % d
|
||||
nb = nb + len(val)
|
||||
if nb > COLLIM:
|
||||
print("",file=f)
|
||||
nb = len(val)
|
||||
print(val,end="",file=f)
|
||||
|
||||
print("};\n",file=f)
|
||||
|
||||
def printCFloat32Array(f,name,arr):
|
||||
nb = 0
|
||||
print("float32_t %s[%d]={" % (name,len(arr)),file=f)
|
||||
|
||||
for d in arr:
|
||||
val = "%.20ff," % d
|
||||
nb = nb + len(val)
|
||||
if nb > COLLIM:
|
||||
print("",file=f)
|
||||
nb = len(val)
|
||||
print(val,end="",file=f)
|
||||
|
||||
print("};\n",file=f)
|
||||
|
||||
def printHUInt32Array(f,name,arr):
|
||||
print("extern uint32_t %s[%d];" % (name,len(arr)),file=f)
|
||||
|
||||
def printHFloat32Array(f,name,arr):
|
||||
print("extern float32_t %s[%d];" % (name,len(arr)),file=f)
|
||||
|
||||
def twiddle(n):
|
||||
a=2.0*math.pi*np.linspace(0,n,num=n,endpoint=False)/n
|
||||
c=np.cos(a)
|
||||
s=np.sin(a)
|
||||
|
||||
r = np.empty((c.size + s.size,), dtype=c.dtype)
|
||||
r[0::2] = c
|
||||
r[1::2] = s
|
||||
return(r)
|
||||
|
||||
def reorderTwiddle(f,h,n):
|
||||
numStages = 6
|
||||
coefs= twiddle(n)
|
||||
|
||||
|
||||
if n == 4096:
|
||||
numStages = 6
|
||||
arraySize = 1364
|
||||
|
||||
if n == 1024:
|
||||
numStages = 5
|
||||
arraySize = 340
|
||||
|
||||
if n == 256:
|
||||
numStages = 4
|
||||
arraySize = 84
|
||||
|
||||
if n == 64:
|
||||
numStages = 3
|
||||
arraySize = 20
|
||||
|
||||
if n == 16:
|
||||
numStages = 2
|
||||
arraySize = 4
|
||||
|
||||
incr = 1
|
||||
nbOfElt = n
|
||||
|
||||
maxNb = 0
|
||||
|
||||
tab1 = np.zeros(2*arraySize)
|
||||
tab2 = np.zeros(2*arraySize)
|
||||
tab3 = np.zeros(2*arraySize)
|
||||
|
||||
tab1Index=0
|
||||
tab2Index=0
|
||||
tab3Index=0
|
||||
|
||||
tab1Offset = np.zeros(numStages)
|
||||
tab2Offset = np.zeros(numStages)
|
||||
tab3Offset = np.zeros(numStages)
|
||||
|
||||
|
||||
|
||||
for stage in range(0,numStages-1):
|
||||
nbOfElt = nbOfElt >> 2
|
||||
pVectCoef1 = 0
|
||||
pVectCoef2 = 0
|
||||
pVectCoef3 = 0
|
||||
|
||||
tab1Offset[stage] = tab1Index
|
||||
tab2Offset[stage] = tab2Index
|
||||
tab3Offset[stage] = tab3Index
|
||||
|
||||
for i in range(0,nbOfElt):
|
||||
tab1[tab1Index] = coefs[pVectCoef1]
|
||||
tab1[tab1Index + 1] = coefs[pVectCoef1 + 1];
|
||||
tab1Index = tab1Index + 2
|
||||
pVectCoef1 = pVectCoef1 + (incr * 1 * 2)
|
||||
|
||||
tab2[tab2Index] = coefs[pVectCoef2]
|
||||
tab2[tab2Index + 1] = coefs[pVectCoef2 + 1];
|
||||
tab2Index = tab2Index + 2
|
||||
pVectCoef2 = pVectCoef2 + (incr * 2 * 2)
|
||||
|
||||
tab3[tab3Index] = coefs[pVectCoef3]
|
||||
tab3[tab3Index + 1] = coefs[pVectCoef3 + 1];
|
||||
tab3Index = tab3Index + 2
|
||||
pVectCoef3 = pVectCoef3 + (incr * 3 * 2)
|
||||
|
||||
maxNb = maxNb + 1
|
||||
|
||||
incr = 4 * incr
|
||||
|
||||
print(condition % (n, n << 1),file=f)
|
||||
print(condition % (n, n << 1),file=h)
|
||||
printCUInt32Array(f,"rearranged_twiddle_tab_stride1_arr_%d" % n,list(tab1Offset))
|
||||
printHUInt32Array(h,"rearranged_twiddle_tab_stride1_arr_%d" % n,list(tab1Offset))
|
||||
|
||||
printCUInt32Array(f,"rearranged_twiddle_tab_stride2_arr_%d" % n,list(tab2Offset))
|
||||
printHUInt32Array(h,"rearranged_twiddle_tab_stride2_arr_%d" % n,list(tab2Offset))
|
||||
|
||||
printCUInt32Array(f,"rearranged_twiddle_tab_stride3_arr_%d" % n,list(tab3Offset))
|
||||
printHUInt32Array(h,"rearranged_twiddle_tab_stride3_arr_%d" % n,list(tab3Offset))
|
||||
|
||||
printCFloat32Array(f,"rearranged_twiddle_stride1_%d" % n,list(tab1))
|
||||
printHFloat32Array(h,"rearranged_twiddle_stride1_%d" % n,list(tab1))
|
||||
|
||||
printCFloat32Array(f,"rearranged_twiddle_stride2_%d" % n,list(tab2))
|
||||
printHFloat32Array(h,"rearranged_twiddle_stride2_%d" % n,list(tab2))
|
||||
|
||||
printCFloat32Array(f,"rearranged_twiddle_stride3_%d" % n,list(tab3))
|
||||
printHFloat32Array(h,"rearranged_twiddle_stride3_%d" % n,list(tab3))
|
||||
print("#endif\n",file=f)
|
||||
print("#endif\n",file=h)
|
||||
|
||||
|
||||
|
||||
#test = twiddle(16)
|
||||
#printCFloat32Array("Test",list(test))
|
||||
|
||||
cheader="""/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_mve_tables.c
|
||||
* Description: common tables like fft twiddle factors, Bitreverse, reciprocal etc
|
||||
* used for MVE implementation only
|
||||
*
|
||||
* $Date: 08. January 2020
|
||||
* $Revision: V1.7.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
cfooter="""
|
||||
|
||||
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */
|
||||
#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */
|
||||
"""
|
||||
|
||||
hheader="""/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_mve_tables.h
|
||||
* Description: common tables like fft twiddle factors, Bitreverse, reciprocal etc
|
||||
* used for MVE implementation only
|
||||
*
|
||||
* $Date: 08. January 2020
|
||||
* $Revision: V1.7.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_MVE_TABLES_H
|
||||
#define _ARM_MVE_TABLES_H
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
hfooter="""
|
||||
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */
|
||||
|
||||
#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */
|
||||
|
||||
#endif /*_ARM_MVE_TABLES_H*/
|
||||
"""
|
||||
|
||||
with open(args.f,'w') as f:
|
||||
with open(args.he,'w') as h:
|
||||
print(cheader,file=f)
|
||||
print(hheader,file=h)
|
||||
|
||||
reorderTwiddle(f,h,16)
|
||||
reorderTwiddle(f,h,64)
|
||||
reorderTwiddle(f,h,256)
|
||||
reorderTwiddle(f,h,1024)
|
||||
reorderTwiddle(f,h,4096)
|
||||
|
||||
print(cfooter,file=f)
|
||||
print(hfooter,file=h)
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,353 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_cfft_init_f32.c
|
||||
* Description: Initialization function for cfft f32 instance
|
||||
*
|
||||
* $Date: 07. January 2020
|
||||
* $Revision: V1.7.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define FFTINIT(EXT,SIZE) \
|
||||
S->bitRevLength = arm_cfft_sR_##EXT##_len##SIZE.bitRevLength; \
|
||||
S->pBitRevTable = arm_cfft_sR_##EXT##_len##SIZE.pBitRevTable; \
|
||||
S->pTwiddle = arm_cfft_sR_##EXT##_len##SIZE.pTwiddle;
|
||||
|
||||
/**
|
||||
@addtogroup ComplexFFT
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief Initialization function for the cfft f32 function
|
||||
@param[in,out] S points to an instance of the floating-point CFFT structure
|
||||
@param[in] fftLen fft length (number of complex samples)
|
||||
@return execution status
|
||||
- \ref ARM_MATH_SUCCESS : Operation successful
|
||||
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
|
||||
|
||||
@par Use of this function is mandatory only for the MVE version of the FFT.
|
||||
Other versions can still initialize directly the data structure using
|
||||
variables declared in arm_const_structs.h
|
||||
*/
|
||||
|
||||
#include "arm_math.h"
|
||||
#include "arm_common_tables.h"
|
||||
#include "arm_const_structs.h"
|
||||
|
||||
#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
|
||||
|
||||
#include "arm_vec_fft.h"
|
||||
#include "arm_mve_tables.h"
|
||||
|
||||
arm_status arm_cfft_radix4by2_rearrange_twiddles_f32(arm_cfft_instance_f32 *S, int twidCoefModifier)
|
||||
{
|
||||
|
||||
switch (S->fftLen >> (twidCoefModifier - 1)) {
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_4096)
|
||||
case 4096U:
|
||||
S->rearranged_twiddle_tab_stride1_arr = rearranged_twiddle_tab_stride1_arr_4096;
|
||||
S->rearranged_twiddle_stride1 = rearranged_twiddle_stride1_4096;
|
||||
|
||||
S->rearranged_twiddle_tab_stride2_arr = rearranged_twiddle_tab_stride2_arr_4096;
|
||||
S->rearranged_twiddle_stride2 = rearranged_twiddle_stride2_4096;
|
||||
|
||||
S->rearranged_twiddle_tab_stride3_arr = rearranged_twiddle_tab_stride3_arr_4096;
|
||||
S->rearranged_twiddle_stride3 = rearranged_twiddle_stride3_4096;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_1024) || defined(ARM_TABLE_BITREVIDX_FXT_2048)
|
||||
case 1024U:
|
||||
S->rearranged_twiddle_tab_stride1_arr = rearranged_twiddle_tab_stride1_arr_1024;
|
||||
S->rearranged_twiddle_stride1 = rearranged_twiddle_stride1_1024;
|
||||
|
||||
S->rearranged_twiddle_tab_stride2_arr = rearranged_twiddle_tab_stride2_arr_1024;
|
||||
S->rearranged_twiddle_stride2 = rearranged_twiddle_stride2_1024;
|
||||
|
||||
S->rearranged_twiddle_tab_stride3_arr = rearranged_twiddle_tab_stride3_arr_1024;
|
||||
S->rearranged_twiddle_stride3 = rearranged_twiddle_stride3_1024;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_256) || defined(ARM_TABLE_BITREVIDX_FXT_512)
|
||||
case 256U:
|
||||
S->rearranged_twiddle_tab_stride1_arr = rearranged_twiddle_tab_stride1_arr_256;
|
||||
S->rearranged_twiddle_stride1 = rearranged_twiddle_stride1_256;
|
||||
|
||||
S->rearranged_twiddle_tab_stride2_arr = rearranged_twiddle_tab_stride2_arr_256;
|
||||
S->rearranged_twiddle_stride2 = rearranged_twiddle_stride2_256;
|
||||
|
||||
S->rearranged_twiddle_tab_stride3_arr = rearranged_twiddle_tab_stride3_arr_256;
|
||||
S->rearranged_twiddle_stride3 = rearranged_twiddle_stride3_256;
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_64) || defined(ARM_TABLE_BITREVIDX_FXT_128)
|
||||
case 64U:
|
||||
S->rearranged_twiddle_tab_stride1_arr = rearranged_twiddle_tab_stride1_arr_64;
|
||||
S->rearranged_twiddle_stride1 = rearranged_twiddle_stride1_64;
|
||||
|
||||
S->rearranged_twiddle_tab_stride2_arr = rearranged_twiddle_tab_stride2_arr_64;
|
||||
S->rearranged_twiddle_stride2 = rearranged_twiddle_stride2_64;
|
||||
|
||||
S->rearranged_twiddle_tab_stride3_arr = rearranged_twiddle_tab_stride3_arr_64;
|
||||
S->rearranged_twiddle_stride3 = rearranged_twiddle_stride3_64;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_16) || defined(ARM_TABLE_BITREVIDX_FXT_32)
|
||||
case 16U:
|
||||
S->rearranged_twiddle_tab_stride1_arr = rearranged_twiddle_tab_stride1_arr_16;
|
||||
S->rearranged_twiddle_stride1 = rearranged_twiddle_stride1_16;
|
||||
|
||||
S->rearranged_twiddle_tab_stride2_arr = rearranged_twiddle_tab_stride2_arr_16;
|
||||
S->rearranged_twiddle_stride2 = rearranged_twiddle_stride2_16;
|
||||
|
||||
S->rearranged_twiddle_tab_stride3_arr = rearranged_twiddle_tab_stride3_arr_16;
|
||||
S->rearranged_twiddle_stride3 = rearranged_twiddle_stride3_16;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return(ARM_MATH_ARGUMENT_ERROR);
|
||||
break;
|
||||
/* invalid sizes already filtered */
|
||||
}
|
||||
|
||||
return(ARM_MATH_SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
arm_status arm_cfft_init_f32(
|
||||
arm_cfft_instance_f32 * S,
|
||||
uint16_t fftLen)
|
||||
{
|
||||
|
||||
/* Initialise the default arm status */
|
||||
arm_status status = ARM_MATH_SUCCESS;
|
||||
|
||||
/* Initialise the FFT length */
|
||||
S->fftLen = fftLen;
|
||||
|
||||
/* Initialise the Twiddle coefficient pointer */
|
||||
S->pTwiddle = NULL;
|
||||
|
||||
|
||||
/* Initializations of Instance structure depending on the FFT length */
|
||||
switch (S->fftLen) {
|
||||
/* Initializations of structure parameters for 4096 point FFT */
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_4096)
|
||||
case 4096U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_4096;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_4096;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_2048)
|
||||
/* Initializations of structure parameters for 2048 point FFT */
|
||||
case 2048U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_2048;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_2048;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_1024)
|
||||
/* Initializations of structure parameters for 1024 point FFT */
|
||||
case 1024U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_1024;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_1024;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_512)
|
||||
/* Initializations of structure parameters for 512 point FFT */
|
||||
case 512U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_512;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_512;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_256)
|
||||
case 256U:
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_256;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_256;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_128)
|
||||
case 128U:
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_128;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_128;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_64)
|
||||
case 64U:
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_64;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_64;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_32)
|
||||
case 32U:
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_32;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_32;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_16)
|
||||
case 16U:
|
||||
/* Initializations of structure parameters for 16 point FFT */
|
||||
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH;
|
||||
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_16;
|
||||
S->pTwiddle = (float32_t *)twiddleCoef_16;
|
||||
status=arm_cfft_radix4by2_rearrange_twiddles_f32(S, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* Reporting argument error if fftSize is not valid value */
|
||||
status = ARM_MATH_ARGUMENT_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (status);
|
||||
}
|
||||
#else
|
||||
arm_status arm_cfft_init_f32(
|
||||
arm_cfft_instance_f32 * S,
|
||||
uint16_t fftLen)
|
||||
{
|
||||
/* Initialise the default arm status */
|
||||
arm_status status = ARM_MATH_SUCCESS;
|
||||
|
||||
/* Initialise the FFT length */
|
||||
S->fftLen = fftLen;
|
||||
|
||||
/* Initialise the Twiddle coefficient pointer */
|
||||
S->pTwiddle = NULL;
|
||||
|
||||
|
||||
/* Initializations of Instance structure depending on the FFT length */
|
||||
switch (S->fftLen) {
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_4096) && defined(ARM_TABLE_BITREVIDX_FLT_4096))
|
||||
/* Initializations of structure parameters for 4096 point FFT */
|
||||
case 4096U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
FFTINIT(f32,4096);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_BITREVIDX_FLT_2048))
|
||||
/* Initializations of structure parameters for 2048 point FFT */
|
||||
case 2048U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
FFTINIT(f32,2048);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_BITREVIDX_FLT_1024))
|
||||
/* Initializations of structure parameters for 1024 point FFT */
|
||||
case 1024U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
FFTINIT(f32,1024);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_BITREVIDX_FLT_512))
|
||||
/* Initializations of structure parameters for 512 point FFT */
|
||||
case 512U:
|
||||
/* Initialise the bit reversal table modifier */
|
||||
FFTINIT(f32,512);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_BITREVIDX_FLT_256))
|
||||
case 256U:
|
||||
FFTINIT(f32,256);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_BITREVIDX_FLT_128))
|
||||
case 128U:
|
||||
FFTINIT(f32,128);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_BITREVIDX_FLT_64))
|
||||
case 64U:
|
||||
FFTINIT(f32,64);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_BITREVIDX_FLT_32))
|
||||
case 32U:
|
||||
FFTINIT(f32,32);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_BITREVIDX_FLT_16))
|
||||
case 16U:
|
||||
/* Initializations of structure parameters for 16 point FFT */
|
||||
FFTINIT(f32,16);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* Reporting argument error if fftSize is not valid value */
|
||||
status = ARM_MATH_ARGUMENT_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (status);
|
||||
}
|
||||
#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */
|
||||
|
||||
/**
|
||||
@} end of ComplexFFT group
|
||||
*/
|
||||
Loading…
Reference in New Issue