Add explanatory comments to the #endif part of multiple inclusion guards.
[mplayer/greg.git] / liba52 / srfftp.h
blob869bd5194f83ae32894fa11fe661d66615906aa6
2 /*
3 * srfftp.h
5 * Copyright (C) Yuqing Deng <Yuqing_Deng@brown.edu> - April 2000
7 * 64 and 128 point split radix fft for ac3dec
9 * The algorithm is desribed in the book:
10 * "Computational Frameworks of the Fast Fourier Transform".
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.
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.
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.
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.
32 #ifndef SRFFTP_H__
33 #define SRFFTP_H__
35 static complex_t delta16[4] __attribute__((aligned(16))) =
36 { {1.00000000000000, 0.00000000000000},
37 {0.92387953251129, -0.38268343236509},
38 {0.70710678118655, -0.70710678118655},
39 {0.38268343236509, -0.92387953251129}};
41 static complex_t delta16_3[4] __attribute__((aligned(16))) =
42 { {1.00000000000000, 0.00000000000000},
43 {0.38268343236509, -0.92387953251129},
44 {-0.70710678118655, -0.70710678118655},
45 {-0.92387953251129, 0.38268343236509}};
47 static complex_t delta32[8] __attribute__((aligned(16))) =
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}};
57 static complex_t delta32_3[8] __attribute__((aligned(16))) =
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}};
67 static complex_t delta64[16] __attribute__((aligned(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}};
85 static complex_t delta64_3[16] __attribute__((aligned(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}};
103 static complex_t delta128[32] __attribute__((aligned(16))) =
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}};
137 static complex_t delta128_3[32] __attribute__((aligned(16))) =
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}};
171 #define HSQRT2 0.707106781188;
173 #define TRANSZERO(A0,A4,A8,A12) { \
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; \
182 a1_r = a_r; \
183 a1_r += u_r; \
184 A0.real = a1_r; \
185 a_r -= u_r; \
186 A8.real = a_r; \
187 a1_i = a_i; \
188 a1_i += u_i; \
189 A0.imag = a1_i; \
190 a_i -= u_i; \
191 A8.imag = a_i; \
192 a1_r = A4.real; \
193 a1_i = A4.imag; \
194 a_r = a1_r; \
195 a_r -= v_r; \
196 A4.real = a_r; \
197 a1_r += v_r; \
198 A12.real = a1_r; \
199 a_i = a1_i; \
200 a_i -= v_i; \
201 A4.imag = a_i; \
202 a1_i += v_i; \
203 A12.imag = a1_i; \
206 #define TRANSHALF_16(A2,A6,A10,A14) {\
207 u_r = wTB[2].real; \
208 a_r = u_r; \
209 u_i = wTB[2].imag; \
210 u_r += u_i; \
211 u_i -= a_r; \
212 a_r = wTB[6].real; \
213 a1_r = a_r; \
214 a_i = wTB[6].imag; \
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.real; \
226 a_i = A2.imag; \
227 a1_r = a_r; \
228 a1_r += u_r; \
229 A2.real = a1_r; \
230 a_r -= u_r; \
231 A10.real = a_r; \
232 a1_i = a_i; \
233 a1_i += u_i; \
234 A2.imag = a1_i; \
235 a_i -= u_i; \
236 A10.imag = a_i; \
237 a1_r = A6.real; \
238 a1_i = A6.imag; \
239 a_r = a1_r; \
240 a1_r += v_r; \
241 A6.real = a1_r; \
242 a_r -= v_r; \
243 A14.real = a_r; \
244 a_i = a1_i; \
245 a1_i -= v_i; \
246 A6.imag = a1_i; \
247 a_i += v_i; \
248 A14.imag = a_i; \
251 #define TRANS(A1,A5,A9,A13,WT,WB,D,D3) { \
252 u_r = WT.real; \
253 a_r = u_r; \
254 a_r *= D.imag; \
255 u_r *= D.real; \
256 a_i = WT.imag; \
257 a1_i = a_i; \
258 a1_i *= D.real; \
259 a_i *= D.imag; \
260 u_r -= a_i; \
261 u_i = a_r; \
262 u_i += a1_i; \
263 a_r = WB.real; \
264 a1_r = a_r; \
265 a1_r *= D3.real; \
266 a_r *= D3.imag; \
267 a_i = WB.imag; \
268 a1_i = a_i; \
269 a_i *= D3.real; \
270 a1_i *= D3.imag; \
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.real; \
278 a_i = A1.imag; \
279 a1_r = a_r; \
280 a1_r += u_r; \
281 A1.real = a1_r; \
282 a_r -= u_r; \
283 A9.real = a_r; \
284 a1_i = a_i; \
285 a1_i += u_i; \
286 A1.imag = a1_i; \
287 a_i -= u_i; \
288 A9.imag = a_i; \
289 a1_r = A5.real; \
290 a1_i = A5.imag; \
291 a_r = a1_r; \
292 a1_r -= v_r; \
293 A5.real = a1_r; \
294 a_r += v_r; \
295 A13.real = a_r; \
296 a_i = a1_i; \
297 a1_i -= v_i; \
298 A5.imag = a1_i; \
299 a_i += v_i; \
300 A13.imag = a_i; \
303 #endif