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
|
|
35 static complex_t delta16[4] =
|
|
36 { {1.00000000000000, 0.00000000000000},
|
|
37 {0.92387953251129, -0.38268343236509},
|
|
38 {0.70710678118655, -0.70710678118655},
|
|
39 {0.38268343236509, -0.92387953251129}};
|
|
40
|
|
41 static complex_t delta16_3[4] =
|
|
42 { {1.00000000000000, 0.00000000000000},
|
|
43 {0.38268343236509, -0.92387953251129},
|
|
44 {-0.70710678118655, -0.70710678118655},
|
|
45 {-0.92387953251129, 0.38268343236509}};
|
|
46
|
|
47 static complex_t delta32[8] =
|
|
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
|
|
57 static complex_t delta32_3[8] =
|
|
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
|
|
67 static complex_t delta64[16] =
|
|
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
|
|
85 static complex_t delta64_3[16] =
|
|
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
|
|
103 static complex_t delta128[32] =
|
|
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
|
|
137 static complex_t delta128_3[32] =
|
|
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) { \
|
|
174 u_r = wTB[0].re; \
|
|
175 v_i = u_r - wTB[k*2].re; \
|
|
176 u_r += wTB[k*2].re; \
|
|
177 u_i = wTB[0].im; \
|
|
178 v_r = wTB[k*2].im - u_i; \
|
|
179 u_i += wTB[k*2].im; \
|
|
180 a_r = A0.re; \
|
|
181 a_i = A0.im; \
|
|
182 a1_r = a_r; \
|
|
183 a1_r += u_r; \
|
|
184 A0.re = a1_r; \
|
|
185 a_r -= u_r; \
|
|
186 A8.re = a_r; \
|
|
187 a1_i = a_i; \
|
|
188 a1_i += u_i; \
|
|
189 A0.im = a1_i; \
|
|
190 a_i -= u_i; \
|
|
191 A8.im = a_i; \
|
|
192 a1_r = A4.re; \
|
|
193 a1_i = A4.im; \
|
|
194 a_r = a1_r; \
|
|
195 a_r -= v_r; \
|
|
196 A4.re = a_r; \
|
|
197 a1_r += v_r; \
|
|
198 A12.re = a1_r; \
|
|
199 a_i = a1_i; \
|
|
200 a_i -= v_i; \
|
|
201 A4.im = a_i; \
|
|
202 a1_i += v_i; \
|
|
203 A12.im = a1_i; \
|
|
204 }
|
|
205
|
|
206 #define TRANSHALF_16(A2,A6,A10,A14) {\
|
|
207 u_r = wTB[2].re; \
|
|
208 a_r = u_r; \
|
|
209 u_i = wTB[2].im; \
|
|
210 u_r += u_i; \
|
|
211 u_i -= a_r; \
|
|
212 a_r = wTB[6].re; \
|
|
213 a1_r = a_r; \
|
|
214 a_i = wTB[6].im; \
|
|
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; \
|
|
225 a_r = A2.re; \
|
|
226 a_i = A2.im; \
|
|
227 a1_r = a_r; \
|
|
228 a1_r += u_r; \
|
|
229 A2.re = a1_r; \
|
|
230 a_r -= u_r; \
|
|
231 A10.re = a_r; \
|
|
232 a1_i = a_i; \
|
|
233 a1_i += u_i; \
|
|
234 A2.im = a1_i; \
|
|
235 a_i -= u_i; \
|
|
236 A10.im = a_i; \
|
|
237 a1_r = A6.re; \
|
|
238 a1_i = A6.im; \
|
|
239 a_r = a1_r; \
|
|
240 a1_r += v_r; \
|
|
241 A6.re = a1_r; \
|
|
242 a_r -= v_r; \
|
|
243 A14.re = a_r; \
|
|
244 a_i = a1_i; \
|
|
245 a1_i -= v_i; \
|
|
246 A6.im = a1_i; \
|
|
247 a_i += v_i; \
|
|
248 A14.im = a_i; \
|
|
249 }
|
|
250
|
|
251 #define TRANS(A1,A5,A9,A13,WT,WB,D,D3) { \
|
|
252 u_r = WT.re; \
|
|
253 a_r = u_r; \
|
|
254 a_r *= D.im; \
|
|
255 u_r *= D.re; \
|
|
256 a_i = WT.im; \
|
|
257 a1_i = a_i; \
|
|
258 a1_i *= D.re; \
|
|
259 a_i *= D.im; \
|
|
260 u_r -= a_i; \
|
|
261 u_i = a_r; \
|
|
262 u_i += a1_i; \
|
|
263 a_r = WB.re; \
|
|
264 a1_r = a_r; \
|
|
265 a1_r *= D3.re; \
|
|
266 a_r *= D3.im; \
|
|
267 a_i = WB.im; \
|
|
268 a1_i = a_i; \
|
|
269 a_i *= D3.re; \
|
|
270 a1_i *= D3.im; \
|
|
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; \
|
|
277 a_r = A1.re; \
|
|
278 a_i = A1.im; \
|
|
279 a1_r = a_r; \
|
|
280 a1_r += u_r; \
|
|
281 A1.re = a1_r; \
|
|
282 a_r -= u_r; \
|
|
283 A9.re = a_r; \
|
|
284 a1_i = a_i; \
|
|
285 a1_i += u_i; \
|
|
286 A1.im = a1_i; \
|
|
287 a_i -= u_i; \
|
|
288 A9.im = a_i; \
|
|
289 a1_r = A5.re; \
|
|
290 a1_i = A5.im; \
|
|
291 a_r = a1_r; \
|
|
292 a1_r -= v_r; \
|
|
293 A5.re = a1_r; \
|
|
294 a_r += v_r; \
|
|
295 A13.re = a_r; \
|
|
296 a_i = a1_i; \
|
|
297 a1_i -= v_i; \
|
|
298 A5.im = a1_i; \
|
|
299 a_i += v_i; \
|
|
300 A13.im = a_i; \
|
|
301 }
|
|
302
|
|
303 #endif
|