1
|
1
|
|
2 /*
|
|
3 * srfftp.h
|
|
4 *
|
|
5 * Copyright (C) Yuqing Deng <Yuqing_Deng@brown.edu> - April 2000
|
|
6 *
|
|
7 * 64 and 128 point split radix fft for ac3dec
|
|
8 *
|
|
9 * The algorithm is desribed in the book:
|
|
10 * "Computational Frameworks of the Fast Fourier Transform".
|
|
11 *
|
|
12 * The ideas and the the organization of code borrowed from djbfft written by
|
|
13 * D. J. Bernstein <djb@cr.py.to>. djbff can be found at
|
|
14 * http://cr.yp.to/djbfft.html.
|
|
15 *
|
|
16 * srfftp.h is free software; you can redistribute it and/or modify
|
|
17 * it under the terms of the GNU General Public License as published by
|
|
18 * the Free Software Foundation; either version 2, or (at your option)
|
|
19 * any later version.
|
|
20 *
|
|
21 * srfftp.h is distributed in the hope that it will be useful,
|
|
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24 * GNU General Public License for more details.
|
|
25 *
|
|
26 * You should have received a copy of the GNU General Public License
|
|
27 * along with GNU Make; see the file COPYING. If not, write to
|
|
28 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
29 *
|
|
30 */
|
|
31
|
|
32 #ifndef SRFFTP_H__
|
|
33 #define SRFFTP_H__
|
|
34
|
920
|
35 static complex_t delta16[4] __attribute__((aligned(16))) =
|
1
|
36 { {1.00000000000000, 0.00000000000000},
|
|
37 {0.92387953251129, -0.38268343236509},
|
|
38 {0.70710678118655, -0.70710678118655},
|
|
39 {0.38268343236509, -0.92387953251129}};
|
|
40
|
920
|
41 static complex_t delta16_3[4] __attribute__((aligned(16))) =
|
1
|
42 { {1.00000000000000, 0.00000000000000},
|
|
43 {0.38268343236509, -0.92387953251129},
|
|
44 {-0.70710678118655, -0.70710678118655},
|
|
45 {-0.92387953251129, 0.38268343236509}};
|
|
46
|
920
|
47 static complex_t delta32[8] __attribute__((aligned(16))) =
|
1
|
48 { {1.00000000000000, 0.00000000000000},
|
|
49 {0.98078528040323, -0.19509032201613},
|
|
50 {0.92387953251129, -0.38268343236509},
|
|
51 {0.83146961230255, -0.55557023301960},
|
|
52 {0.70710678118655, -0.70710678118655},
|
|
53 {0.55557023301960, -0.83146961230255},
|
|
54 {0.38268343236509, -0.92387953251129},
|
|
55 {0.19509032201613, -0.98078528040323}};
|
|
56
|
920
|
57 static complex_t delta32_3[8] __attribute__((aligned(16))) =
|
1
|
58 { {1.00000000000000, 0.00000000000000},
|
|
59 {0.83146961230255, -0.55557023301960},
|
|
60 {0.38268343236509, -0.92387953251129},
|
|
61 {-0.19509032201613, -0.98078528040323},
|
|
62 {-0.70710678118655, -0.70710678118655},
|
|
63 {-0.98078528040323, -0.19509032201613},
|
|
64 {-0.92387953251129, 0.38268343236509},
|
|
65 {-0.55557023301960, 0.83146961230255}};
|
|
66
|
920
|
67 static complex_t delta64[16] __attribute__((aligned(16))) =
|
1
|
68 { {1.00000000000000, 0.00000000000000},
|
|
69 {0.99518472667220, -0.09801714032956},
|
|
70 {0.98078528040323, -0.19509032201613},
|
|
71 {0.95694033573221, -0.29028467725446},
|
|
72 {0.92387953251129, -0.38268343236509},
|
|
73 {0.88192126434836, -0.47139673682600},
|
|
74 {0.83146961230255, -0.55557023301960},
|
|
75 {0.77301045336274, -0.63439328416365},
|
|
76 {0.70710678118655, -0.70710678118655},
|
|
77 {0.63439328416365, -0.77301045336274},
|
|
78 {0.55557023301960, -0.83146961230255},
|
|
79 {0.47139673682600, -0.88192126434835},
|
|
80 {0.38268343236509, -0.92387953251129},
|
|
81 {0.29028467725446, -0.95694033573221},
|
|
82 {0.19509032201613, -0.98078528040323},
|
|
83 {0.09801714032956, -0.99518472667220}};
|
|
84
|
920
|
85 static complex_t delta64_3[16] __attribute__((aligned(16))) =
|
1
|
86 { {1.00000000000000, 0.00000000000000},
|
|
87 {0.95694033573221, -0.29028467725446},
|
|
88 {0.83146961230255, -0.55557023301960},
|
|
89 {0.63439328416365, -0.77301045336274},
|
|
90 {0.38268343236509, -0.92387953251129},
|
|
91 {0.09801714032956, -0.99518472667220},
|
|
92 {-0.19509032201613, -0.98078528040323},
|
|
93 {-0.47139673682600, -0.88192126434836},
|
|
94 {-0.70710678118655, -0.70710678118655},
|
|
95 {-0.88192126434835, -0.47139673682600},
|
|
96 {-0.98078528040323, -0.19509032201613},
|
|
97 {-0.99518472667220, 0.09801714032956},
|
|
98 {-0.92387953251129, 0.38268343236509},
|
|
99 {-0.77301045336274, 0.63439328416365},
|
|
100 {-0.55557023301960, 0.83146961230255},
|
|
101 {-0.29028467725446, 0.95694033573221}};
|
|
102
|
920
|
103 static complex_t delta128[32] __attribute__((aligned(16))) =
|
1
|
104 { {1.00000000000000, 0.00000000000000},
|
|
105 {0.99879545620517, -0.04906767432742},
|
|
106 {0.99518472667220, -0.09801714032956},
|
|
107 {0.98917650996478, -0.14673047445536},
|
|
108 {0.98078528040323, -0.19509032201613},
|
|
109 {0.97003125319454, -0.24298017990326},
|
|
110 {0.95694033573221, -0.29028467725446},
|
|
111 {0.94154406518302, -0.33688985339222},
|
|
112 {0.92387953251129, -0.38268343236509},
|
|
113 {0.90398929312344, -0.42755509343028},
|
|
114 {0.88192126434836, -0.47139673682600},
|
|
115 {0.85772861000027, -0.51410274419322},
|
|
116 {0.83146961230255, -0.55557023301960},
|
|
117 {0.80320753148064, -0.59569930449243},
|
|
118 {0.77301045336274, -0.63439328416365},
|
|
119 {0.74095112535496, -0.67155895484702},
|
|
120 {0.70710678118655, -0.70710678118655},
|
|
121 {0.67155895484702, -0.74095112535496},
|
|
122 {0.63439328416365, -0.77301045336274},
|
|
123 {0.59569930449243, -0.80320753148064},
|
|
124 {0.55557023301960, -0.83146961230255},
|
|
125 {0.51410274419322, -0.85772861000027},
|
|
126 {0.47139673682600, -0.88192126434835},
|
|
127 {0.42755509343028, -0.90398929312344},
|
|
128 {0.38268343236509, -0.92387953251129},
|
|
129 {0.33688985339222, -0.94154406518302},
|
|
130 {0.29028467725446, -0.95694033573221},
|
|
131 {0.24298017990326, -0.97003125319454},
|
|
132 {0.19509032201613, -0.98078528040323},
|
|
133 {0.14673047445536, -0.98917650996478},
|
|
134 {0.09801714032956, -0.99518472667220},
|
|
135 {0.04906767432742, -0.99879545620517}};
|
|
136
|
920
|
137 static complex_t delta128_3[32] __attribute__((aligned(16))) =
|
1
|
138 { {1.00000000000000, 0.00000000000000},
|
|
139 {0.98917650996478, -0.14673047445536},
|
|
140 {0.95694033573221, -0.29028467725446},
|
|
141 {0.90398929312344, -0.42755509343028},
|
|
142 {0.83146961230255, -0.55557023301960},
|
|
143 {0.74095112535496, -0.67155895484702},
|
|
144 {0.63439328416365, -0.77301045336274},
|
|
145 {0.51410274419322, -0.85772861000027},
|
|
146 {0.38268343236509, -0.92387953251129},
|
|
147 {0.24298017990326, -0.97003125319454},
|
|
148 {0.09801714032956, -0.99518472667220},
|
|
149 {-0.04906767432742, -0.99879545620517},
|
|
150 {-0.19509032201613, -0.98078528040323},
|
|
151 {-0.33688985339222, -0.94154406518302},
|
|
152 {-0.47139673682600, -0.88192126434836},
|
|
153 {-0.59569930449243, -0.80320753148065},
|
|
154 {-0.70710678118655, -0.70710678118655},
|
|
155 {-0.80320753148065, -0.59569930449243},
|
|
156 {-0.88192126434835, -0.47139673682600},
|
|
157 {-0.94154406518302, -0.33688985339222},
|
|
158 {-0.98078528040323, -0.19509032201613},
|
|
159 {-0.99879545620517, -0.04906767432742},
|
|
160 {-0.99518472667220, 0.09801714032956},
|
|
161 {-0.97003125319454, 0.24298017990326},
|
|
162 {-0.92387953251129, 0.38268343236509},
|
|
163 {-0.85772861000027, 0.51410274419322},
|
|
164 {-0.77301045336274, 0.63439328416365},
|
|
165 {-0.67155895484702, 0.74095112535496},
|
|
166 {-0.55557023301960, 0.83146961230255},
|
|
167 {-0.42755509343028, 0.90398929312344},
|
|
168 {-0.29028467725446, 0.95694033573221},
|
|
169 {-0.14673047445536, 0.98917650996478}};
|
|
170
|
|
171 #define HSQRT2 0.707106781188;
|
|
172
|
|
173 #define TRANSZERO(A0,A4,A8,A12) { \
|
3884
|
174 u_r = wTB[0].real; \
|
|
175 v_i = u_r - wTB[k*2].real; \
|
|
176 u_r += wTB[k*2].real; \
|
|
177 u_i = wTB[0].imag; \
|
|
178 v_r = wTB[k*2].imag - u_i; \
|
|
179 u_i += wTB[k*2].imag; \
|
|
180 a_r = A0.real; \
|
|
181 a_i = A0.imag; \
|
1
|
182 a1_r = a_r; \
|
|
183 a1_r += u_r; \
|
3884
|
184 A0.real = a1_r; \
|
1
|
185 a_r -= u_r; \
|
3884
|
186 A8.real = a_r; \
|
1
|
187 a1_i = a_i; \
|
|
188 a1_i += u_i; \
|
3884
|
189 A0.imag = a1_i; \
|
1
|
190 a_i -= u_i; \
|
3884
|
191 A8.imag = a_i; \
|
|
192 a1_r = A4.real; \
|
|
193 a1_i = A4.imag; \
|
1
|
194 a_r = a1_r; \
|
|
195 a_r -= v_r; \
|
3884
|
196 A4.real = a_r; \
|
1
|
197 a1_r += v_r; \
|
3884
|
198 A12.real = a1_r; \
|
1
|
199 a_i = a1_i; \
|
|
200 a_i -= v_i; \
|
3884
|
201 A4.imag = a_i; \
|
1
|
202 a1_i += v_i; \
|
3884
|
203 A12.imag = a1_i; \
|
1
|
204 }
|
|
205
|
|
206 #define TRANSHALF_16(A2,A6,A10,A14) {\
|
3884
|
207 u_r = wTB[2].real; \
|
1
|
208 a_r = u_r; \
|
3884
|
209 u_i = wTB[2].imag; \
|
1
|
210 u_r += u_i; \
|
|
211 u_i -= a_r; \
|
3884
|
212 a_r = wTB[6].real; \
|
1
|
213 a1_r = a_r; \
|
3884
|
214 a_i = wTB[6].imag; \
|
1
|
215 a_r = a_i - a_r; \
|
|
216 a_i += a1_r; \
|
|
217 v_i = u_r - a_r; \
|
|
218 u_r += a_r; \
|
|
219 v_r = u_i + a_i; \
|
|
220 u_i -= a_i; \
|
|
221 v_i *= HSQRT2; \
|
|
222 v_r *= HSQRT2; \
|
|
223 u_r *= HSQRT2; \
|
|
224 u_i *= HSQRT2; \
|
3884
|
225 a_r = A2.real; \
|
|
226 a_i = A2.imag; \
|
1
|
227 a1_r = a_r; \
|
|
228 a1_r += u_r; \
|
3884
|
229 A2.real = a1_r; \
|
1
|
230 a_r -= u_r; \
|
3884
|
231 A10.real = a_r; \
|
1
|
232 a1_i = a_i; \
|
|
233 a1_i += u_i; \
|
3884
|
234 A2.imag = a1_i; \
|
1
|
235 a_i -= u_i; \
|
3884
|
236 A10.imag = a_i; \
|
|
237 a1_r = A6.real; \
|
|
238 a1_i = A6.imag; \
|
1
|
239 a_r = a1_r; \
|
|
240 a1_r += v_r; \
|
3884
|
241 A6.real = a1_r; \
|
1
|
242 a_r -= v_r; \
|
3884
|
243 A14.real = a_r; \
|
1
|
244 a_i = a1_i; \
|
|
245 a1_i -= v_i; \
|
3884
|
246 A6.imag = a1_i; \
|
1
|
247 a_i += v_i; \
|
3884
|
248 A14.imag = a_i; \
|
1
|
249 }
|
|
250
|
|
251 #define TRANS(A1,A5,A9,A13,WT,WB,D,D3) { \
|
3884
|
252 u_r = WT.real; \
|
1
|
253 a_r = u_r; \
|
3884
|
254 a_r *= D.imag; \
|
|
255 u_r *= D.real; \
|
|
256 a_i = WT.imag; \
|
1
|
257 a1_i = a_i; \
|
3884
|
258 a1_i *= D.real; \
|
|
259 a_i *= D.imag; \
|
1
|
260 u_r -= a_i; \
|
|
261 u_i = a_r; \
|
|
262 u_i += a1_i; \
|
3884
|
263 a_r = WB.real; \
|
1
|
264 a1_r = a_r; \
|
3884
|
265 a1_r *= D3.real; \
|
|
266 a_r *= D3.imag; \
|
|
267 a_i = WB.imag; \
|
1
|
268 a1_i = a_i; \
|
3884
|
269 a_i *= D3.real; \
|
|
270 a1_i *= D3.imag; \
|
1
|
271 a1_r -= a1_i; \
|
|
272 a_r += a_i; \
|
|
273 v_i = u_r - a1_r; \
|
|
274 u_r += a1_r; \
|
|
275 v_r = a_r - u_i; \
|
|
276 u_i += a_r; \
|
3884
|
277 a_r = A1.real; \
|
|
278 a_i = A1.imag; \
|
1
|
279 a1_r = a_r; \
|
|
280 a1_r += u_r; \
|
3884
|
281 A1.real = a1_r; \
|
1
|
282 a_r -= u_r; \
|
3884
|
283 A9.real = a_r; \
|
1
|
284 a1_i = a_i; \
|
|
285 a1_i += u_i; \
|
3884
|
286 A1.imag = a1_i; \
|
1
|
287 a_i -= u_i; \
|
3884
|
288 A9.imag = a_i; \
|
|
289 a1_r = A5.real; \
|
|
290 a1_i = A5.imag; \
|
1
|
291 a_r = a1_r; \
|
|
292 a1_r -= v_r; \
|
3884
|
293 A5.real = a1_r; \
|
1
|
294 a_r += v_r; \
|
3884
|
295 A13.real = a_r; \
|
1
|
296 a_i = a1_i; \
|
|
297 a1_i -= v_i; \
|
3884
|
298 A5.imag = a1_i; \
|
1
|
299 a_i += v_i; \
|
3884
|
300 A13.imag = a_i; \
|
1
|
301 }
|
|
302
|
|
303 #endif
|