Project Ne10
An Open Optimized Software Library Project for the ARM Architecture
Loading...
Searching...
No Matches
NE10_fft.h
1/*
2 * Copyright 2013-15 ARM Limited and Contributors.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of ARM Limited nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY ARM LIMITED AND CONTRIBUTORS "AS IS" AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/*
29 * NE10 Library : dsp/NE10_fft.h
30 */
31
32#include "NE10_dsp.h"
33#include "NE10_types.h"
34#include "NE10_fft_common_varibles.h"
35#include "NE10_fft_cplx_ops.h"
36#include "NE10_fft_bfly.h"
37#include "NE10_fft_debug_macro.h"
38
39#ifndef NE10_FFT_H
40#define NE10_FFT_H
41
43// Internal macro define
45#define NE10_FFT_BYTE_ALIGNMENT 8
46#define NE10_INLINE inline static
47
48/* Algorithms used in FFT */
49#define NE10_FFT_ALG_24 0
50#define NE10_FFT_ALG_ANY 1
51
52/* NE10_FACTOR_FLAGS */
53// Only factors into 2, 3, 4, 5
54#define NE10_FACTOR_DEFAULT 0
55// Factors into 2, 3, 4, 5, 8
56#define NE10_FACTOR_EIGHT 1
57
58// Comment when do not want to scale output result
59#define NE10_DSP_RFFT_SCALING
60#define NE10_DSP_CFFT_SCALING
61
62#define NE10_FFT_PARA_LEVEL 4
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
69// function prototypes:
71
72 /*common fft functions */
73 extern ne10_int32_t ne10_factor (ne10_int32_t n, ne10_int32_t * facbuf, ne10_int32_t ne10_factor_flags);
74
75 extern ne10_fft_cpx_float32_t* ne10_fft_generate_twiddles_float32 (ne10_fft_cpx_float32_t * twiddles,
76 const ne10_int32_t * factors,
77 const ne10_int32_t nfft );
78
79 extern ne10_fft_cpx_float32_t* ne10_fft_generate_twiddles_transposed_float32 (
80 ne10_fft_cpx_float32_t * twiddles,
81 const ne10_int32_t * factors,
82 const ne10_int32_t nfft );
83
84 extern ne10_fft_cpx_int32_t* ne10_fft_generate_twiddles_int32 (ne10_fft_cpx_int32_t * twiddles,
85 const ne10_int32_t * factors,
86 const ne10_int32_t nfft );
87
88 /*common functions for float fft */
89 extern void ne10_mixed_radix_generic_butterfly_float32_c (ne10_fft_cpx_float32_t * Fout,
90 const ne10_fft_cpx_float32_t * Fin,
91 const ne10_int32_t * factors,
92 const ne10_fft_cpx_float32_t * twiddles,
94 const ne10_int32_t is_scaled);
95
96 extern void ne10_mixed_radix_generic_butterfly_inverse_float32_c (ne10_fft_cpx_float32_t * Fout,
97 const ne10_fft_cpx_float32_t * Fin,
98 const ne10_int32_t * factors,
99 const ne10_fft_cpx_float32_t * twiddles,
100 ne10_fft_cpx_float32_t * buffer,
101 const ne10_int32_t is_scaled);
102
103 extern void ne10_mixed_radix_generic_butterfly_float32_neon (ne10_fft_cpx_float32_t * Fout,
104 const ne10_fft_cpx_float32_t * Fin,
105 const ne10_int32_t * factors,
106 const ne10_fft_cpx_float32_t * twiddles,
107 ne10_fft_cpx_float32_t * buffer,
108 const ne10_int32_t is_scaled);
109
110 extern void ne10_mixed_radix_generic_butterfly_inverse_float32_neon (ne10_fft_cpx_float32_t * Fout,
111 const ne10_fft_cpx_float32_t * Fin,
112 const ne10_int32_t * factors,
113 const ne10_fft_cpx_float32_t * twiddles,
114 ne10_fft_cpx_float32_t * buffer,
115 const ne10_int32_t is_scaled);
116
117 extern void ne10_mixed_radix_fft_forward_float32_neon (ne10_fft_cpx_float32_t * Fout,
119 ne10_int32_t * factors,
120 ne10_fft_cpx_float32_t * twiddles,
121 ne10_fft_cpx_float32_t * buffer)
122 asm ("ne10_mixed_radix_fft_forward_float32_neon");
123
124 extern void ne10_mixed_radix_fft_backward_float32_neon (ne10_fft_cpx_float32_t * Fout,
126 ne10_int32_t * factors,
127 ne10_fft_cpx_float32_t * twiddles,
128 ne10_fft_cpx_float32_t * buffer)
129 asm ("ne10_mixed_radix_fft_backward_float32_neon");
130
131 /* common functions for fixed point fft */
132 /* butterfly for int 32 */
133 extern void ne10_mixed_radix_generic_butterfly_int32_c (ne10_fft_cpx_int32_t * Fout,
134 const ne10_fft_cpx_int32_t * Fin,
135 const ne10_int32_t * factors,
136 const ne10_fft_cpx_int32_t * twiddles,
137 ne10_fft_cpx_int32_t * buffer,
138 const ne10_int32_t scaled_flag);
139
140 extern void ne10_mixed_radix_generic_butterfly_inverse_int32_c (ne10_fft_cpx_int32_t * Fout,
141 const ne10_fft_cpx_int32_t * Fin,
142 const ne10_int32_t * factors,
143 const ne10_fft_cpx_int32_t * twiddles,
144 ne10_fft_cpx_int32_t * buffer,
145 const ne10_int32_t scaled_flag);
146
147 extern void ne10_mixed_radix_generic_butterfly_int32_neon (ne10_fft_cpx_int32_t * Fout,
148 const ne10_fft_cpx_int32_t * Fin,
149 const ne10_int32_t * factors,
150 const ne10_fft_cpx_int32_t * twiddles,
151 ne10_fft_cpx_int32_t * buffer,
152 const ne10_int32_t scaled_flag);
153
154 extern void ne10_mixed_radix_generic_butterfly_inverse_int32_neon (ne10_fft_cpx_int32_t * Fout,
155 const ne10_fft_cpx_int32_t * Fin,
156 const ne10_int32_t * factors,
157 const ne10_fft_cpx_int32_t * twiddles,
158 ne10_fft_cpx_int32_t * buffer,
159 const ne10_int32_t scaled_flag);
160
161 extern void ne10_mixed_radix_fft_forward_int32_unscaled_neon (ne10_fft_cpx_int32_t * Fout,
163 ne10_int32_t * factors,
164 ne10_fft_cpx_int32_t * twiddles,
165 ne10_fft_cpx_int32_t * buffer)
166 asm ("ne10_mixed_radix_fft_forward_int32_unscaled_neon");
167 extern void ne10_mixed_radix_fft_backward_int32_unscaled_neon (ne10_fft_cpx_int32_t * Fout,
169 ne10_int32_t * factors,
170 ne10_fft_cpx_int32_t * twiddles,
171 ne10_fft_cpx_int32_t * buffer)
172 asm ("ne10_mixed_radix_fft_backward_int32_unscaled_neon");
173 extern void ne10_mixed_radix_fft_forward_int32_scaled_neon (ne10_fft_cpx_int32_t * Fout,
175 ne10_int32_t * factors,
176 ne10_fft_cpx_int32_t * twiddles,
177 ne10_fft_cpx_int32_t * buffer)
178 asm ("ne10_mixed_radix_fft_forward_int32_scaled_neon");
179 extern void ne10_mixed_radix_fft_backward_int32_scaled_neon (ne10_fft_cpx_int32_t * Fout,
181 ne10_int32_t * factors,
182 ne10_fft_cpx_int32_t * twiddles,
183 ne10_fft_cpx_int32_t * buffer)
184 asm ("ne10_mixed_radix_fft_backward_int32_scaled_neon");
185
186 /* butterfly for int 16 */
187 extern void ne10_mixed_radix_fft_forward_int16_unscaled_neon (ne10_fft_cpx_int16_t * Fout,
189 ne10_int32_t * factors,
190 ne10_fft_cpx_int16_t * twiddles,
191 ne10_fft_cpx_int16_t * buffer)
192 asm ("ne10_mixed_radix_fft_forward_int16_unscaled_neon");
193 extern void ne10_mixed_radix_fft_backward_int16_unscaled_neon (ne10_fft_cpx_int16_t * Fout,
195 ne10_int32_t * factors,
196 ne10_fft_cpx_int16_t * twiddles,
197 ne10_fft_cpx_int16_t * buffer)
198 asm ("ne10_mixed_radix_fft_backward_int16_unscaled_neon");
199 extern void ne10_mixed_radix_fft_forward_int16_scaled_neon (ne10_fft_cpx_int16_t * Fout,
201 ne10_int32_t * factors,
202 ne10_fft_cpx_int16_t * twiddles,
203 ne10_fft_cpx_int16_t * buffer)
204 asm ("ne10_mixed_radix_fft_forward_int16_scaled_neon");
205 extern void ne10_mixed_radix_fft_backward_int16_scaled_neon (ne10_fft_cpx_int16_t * Fout,
207 ne10_int32_t * factors,
208 ne10_fft_cpx_int16_t * twiddles,
209 ne10_fft_cpx_int16_t * buffer)
210 asm ("ne10_mixed_radix_fft_backward_int16_scaled_neon");
211
212#if (NE10_UNROLL_LEVEL > 0)
213 extern void ne10_radix8_r2c_c (ne10_fft_cpx_float32_t *Fout,
214 const ne10_fft_cpx_float32_t *Fin,
215 const ne10_int32_t fstride,
216 const ne10_int32_t mstride,
217 const ne10_int32_t nfft);
218
219 extern void ne10_radix8_c2r_c (ne10_fft_cpx_float32_t *Fout,
220 const ne10_fft_cpx_float32_t *Fin,
221 const ne10_int32_t fstride,
222 const ne10_int32_t mstride,
223 const ne10_int32_t nfft);
224#endif // NE10_UNROLL_LEVEL
225
226#ifdef __cplusplus
227}
228#endif
229
230#endif
structure for the 16 bits fixed point FFT function.
Definition NE10_types.h:298
structure for the 32 bits fixed point FFT function.
Definition NE10_types.h:329