Mercurial > mplayer.hg
annotate mp3lib/dct64.c @ 14322:e0f63bf677c0
synced to 1.74 (typo fix)
author | gabrov |
---|---|
date | Mon, 03 Jan 2005 10:19:48 +0000 |
parents | d155623271e3 |
children | 07e7a572bd84 |
rev | line source |
---|---|
1 | 1 |
2 /* | |
3 * Discrete Cosine Tansform (DCT) for subband synthesis | |
4 * optimized for machines with no auto-increment. | |
5 * The performance is highly compiler dependend. Maybe | |
6 * the dct64.c version for 'normal' processor may be faster | |
7 * even for Intel processors. | |
8 */ | |
9 | |
10 static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples) | |
11 { | |
12 | |
13 { | |
12131
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
14 register real *costab = mp3lib_pnts[0]; |
1 | 15 |
16 b1[0x00] = samples[0x00] + samples[0x1F]; | |
17 b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0]; | |
18 | |
19 b1[0x01] = samples[0x01] + samples[0x1E]; | |
20 b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1]; | |
21 | |
22 b1[0x02] = samples[0x02] + samples[0x1D]; | |
23 b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2]; | |
24 | |
25 b1[0x03] = samples[0x03] + samples[0x1C]; | |
26 b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3]; | |
27 | |
28 b1[0x04] = samples[0x04] + samples[0x1B]; | |
29 b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4]; | |
30 | |
31 b1[0x05] = samples[0x05] + samples[0x1A]; | |
32 b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5]; | |
33 | |
34 b1[0x06] = samples[0x06] + samples[0x19]; | |
35 b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6]; | |
36 | |
37 b1[0x07] = samples[0x07] + samples[0x18]; | |
38 b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7]; | |
39 | |
40 b1[0x08] = samples[0x08] + samples[0x17]; | |
41 b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8]; | |
42 | |
43 b1[0x09] = samples[0x09] + samples[0x16]; | |
44 b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9]; | |
45 | |
46 b1[0x0A] = samples[0x0A] + samples[0x15]; | |
47 b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA]; | |
48 | |
49 b1[0x0B] = samples[0x0B] + samples[0x14]; | |
50 b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB]; | |
51 | |
52 b1[0x0C] = samples[0x0C] + samples[0x13]; | |
53 b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC]; | |
54 | |
55 b1[0x0D] = samples[0x0D] + samples[0x12]; | |
56 b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD]; | |
57 | |
58 b1[0x0E] = samples[0x0E] + samples[0x11]; | |
59 b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE]; | |
60 | |
61 b1[0x0F] = samples[0x0F] + samples[0x10]; | |
62 b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF]; | |
63 } | |
64 | |
65 | |
66 { | |
12131
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
67 register real *costab = mp3lib_pnts[1]; |
1 | 68 |
69 b2[0x00] = b1[0x00] + b1[0x0F]; | |
70 b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0]; | |
71 b2[0x01] = b1[0x01] + b1[0x0E]; | |
72 b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1]; | |
73 b2[0x02] = b1[0x02] + b1[0x0D]; | |
74 b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2]; | |
75 b2[0x03] = b1[0x03] + b1[0x0C]; | |
76 b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3]; | |
77 b2[0x04] = b1[0x04] + b1[0x0B]; | |
78 b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4]; | |
79 b2[0x05] = b1[0x05] + b1[0x0A]; | |
80 b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5]; | |
81 b2[0x06] = b1[0x06] + b1[0x09]; | |
82 b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6]; | |
83 b2[0x07] = b1[0x07] + b1[0x08]; | |
84 b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7]; | |
85 | |
86 b2[0x10] = b1[0x10] + b1[0x1F]; | |
87 b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0]; | |
88 b2[0x11] = b1[0x11] + b1[0x1E]; | |
89 b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1]; | |
90 b2[0x12] = b1[0x12] + b1[0x1D]; | |
91 b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2]; | |
92 b2[0x13] = b1[0x13] + b1[0x1C]; | |
93 b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3]; | |
94 b2[0x14] = b1[0x14] + b1[0x1B]; | |
95 b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4]; | |
96 b2[0x15] = b1[0x15] + b1[0x1A]; | |
97 b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5]; | |
98 b2[0x16] = b1[0x16] + b1[0x19]; | |
99 b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6]; | |
100 b2[0x17] = b1[0x17] + b1[0x18]; | |
101 b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7]; | |
102 } | |
103 | |
104 { | |
12131
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
105 register real *costab = mp3lib_pnts[2]; |
1 | 106 |
107 b1[0x00] = b2[0x00] + b2[0x07]; | |
108 b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0]; | |
109 b1[0x01] = b2[0x01] + b2[0x06]; | |
110 b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1]; | |
111 b1[0x02] = b2[0x02] + b2[0x05]; | |
112 b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2]; | |
113 b1[0x03] = b2[0x03] + b2[0x04]; | |
114 b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3]; | |
115 | |
116 b1[0x08] = b2[0x08] + b2[0x0F]; | |
117 b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0]; | |
118 b1[0x09] = b2[0x09] + b2[0x0E]; | |
119 b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1]; | |
120 b1[0x0A] = b2[0x0A] + b2[0x0D]; | |
121 b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2]; | |
122 b1[0x0B] = b2[0x0B] + b2[0x0C]; | |
123 b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3]; | |
124 | |
125 b1[0x10] = b2[0x10] + b2[0x17]; | |
126 b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0]; | |
127 b1[0x11] = b2[0x11] + b2[0x16]; | |
128 b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1]; | |
129 b1[0x12] = b2[0x12] + b2[0x15]; | |
130 b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2]; | |
131 b1[0x13] = b2[0x13] + b2[0x14]; | |
132 b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3]; | |
133 | |
134 b1[0x18] = b2[0x18] + b2[0x1F]; | |
135 b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0]; | |
136 b1[0x19] = b2[0x19] + b2[0x1E]; | |
137 b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1]; | |
138 b1[0x1A] = b2[0x1A] + b2[0x1D]; | |
139 b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2]; | |
140 b1[0x1B] = b2[0x1B] + b2[0x1C]; | |
141 b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3]; | |
142 } | |
143 | |
144 { | |
12131
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
145 register real const cos0 = mp3lib_pnts[3][0]; |
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
146 register real const cos1 = mp3lib_pnts[3][1]; |
1 | 147 |
148 b2[0x00] = b1[0x00] + b1[0x03]; | |
149 b2[0x03] = (b1[0x00] - b1[0x03]) * cos0; | |
150 b2[0x01] = b1[0x01] + b1[0x02]; | |
151 b2[0x02] = (b1[0x01] - b1[0x02]) * cos1; | |
152 | |
153 b2[0x04] = b1[0x04] + b1[0x07]; | |
154 b2[0x07] = (b1[0x07] - b1[0x04]) * cos0; | |
155 b2[0x05] = b1[0x05] + b1[0x06]; | |
156 b2[0x06] = (b1[0x06] - b1[0x05]) * cos1; | |
157 | |
158 b2[0x08] = b1[0x08] + b1[0x0B]; | |
159 b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0; | |
160 b2[0x09] = b1[0x09] + b1[0x0A]; | |
161 b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1; | |
162 | |
163 b2[0x0C] = b1[0x0C] + b1[0x0F]; | |
164 b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0; | |
165 b2[0x0D] = b1[0x0D] + b1[0x0E]; | |
166 b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1; | |
167 | |
168 b2[0x10] = b1[0x10] + b1[0x13]; | |
169 b2[0x13] = (b1[0x10] - b1[0x13]) * cos0; | |
170 b2[0x11] = b1[0x11] + b1[0x12]; | |
171 b2[0x12] = (b1[0x11] - b1[0x12]) * cos1; | |
172 | |
173 b2[0x14] = b1[0x14] + b1[0x17]; | |
174 b2[0x17] = (b1[0x17] - b1[0x14]) * cos0; | |
175 b2[0x15] = b1[0x15] + b1[0x16]; | |
176 b2[0x16] = (b1[0x16] - b1[0x15]) * cos1; | |
177 | |
178 b2[0x18] = b1[0x18] + b1[0x1B]; | |
179 b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0; | |
180 b2[0x19] = b1[0x19] + b1[0x1A]; | |
181 b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1; | |
182 | |
183 b2[0x1C] = b1[0x1C] + b1[0x1F]; | |
184 b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0; | |
185 b2[0x1D] = b1[0x1D] + b1[0x1E]; | |
186 b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1; | |
187 } | |
188 | |
189 { | |
12131
d155623271e3
fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents:
1
diff
changeset
|
190 register real const cos0 = mp3lib_pnts[4][0]; |
1 | 191 |
192 b1[0x00] = b2[0x00] + b2[0x01]; | |
193 b1[0x01] = (b2[0x00] - b2[0x01]) * cos0; | |
194 b1[0x02] = b2[0x02] + b2[0x03]; | |
195 b1[0x03] = (b2[0x03] - b2[0x02]) * cos0; | |
196 b1[0x02] += b1[0x03]; | |
197 | |
198 b1[0x04] = b2[0x04] + b2[0x05]; | |
199 b1[0x05] = (b2[0x04] - b2[0x05]) * cos0; | |
200 b1[0x06] = b2[0x06] + b2[0x07]; | |
201 b1[0x07] = (b2[0x07] - b2[0x06]) * cos0; | |
202 b1[0x06] += b1[0x07]; | |
203 b1[0x04] += b1[0x06]; | |
204 b1[0x06] += b1[0x05]; | |
205 b1[0x05] += b1[0x07]; | |
206 | |
207 b1[0x08] = b2[0x08] + b2[0x09]; | |
208 b1[0x09] = (b2[0x08] - b2[0x09]) * cos0; | |
209 b1[0x0A] = b2[0x0A] + b2[0x0B]; | |
210 b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0; | |
211 b1[0x0A] += b1[0x0B]; | |
212 | |
213 b1[0x0C] = b2[0x0C] + b2[0x0D]; | |
214 b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0; | |
215 b1[0x0E] = b2[0x0E] + b2[0x0F]; | |
216 b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0; | |
217 b1[0x0E] += b1[0x0F]; | |
218 b1[0x0C] += b1[0x0E]; | |
219 b1[0x0E] += b1[0x0D]; | |
220 b1[0x0D] += b1[0x0F]; | |
221 | |
222 b1[0x10] = b2[0x10] + b2[0x11]; | |
223 b1[0x11] = (b2[0x10] - b2[0x11]) * cos0; | |
224 b1[0x12] = b2[0x12] + b2[0x13]; | |
225 b1[0x13] = (b2[0x13] - b2[0x12]) * cos0; | |
226 b1[0x12] += b1[0x13]; | |
227 | |
228 b1[0x14] = b2[0x14] + b2[0x15]; | |
229 b1[0x15] = (b2[0x14] - b2[0x15]) * cos0; | |
230 b1[0x16] = b2[0x16] + b2[0x17]; | |
231 b1[0x17] = (b2[0x17] - b2[0x16]) * cos0; | |
232 b1[0x16] += b1[0x17]; | |
233 b1[0x14] += b1[0x16]; | |
234 b1[0x16] += b1[0x15]; | |
235 b1[0x15] += b1[0x17]; | |
236 | |
237 b1[0x18] = b2[0x18] + b2[0x19]; | |
238 b1[0x19] = (b2[0x18] - b2[0x19]) * cos0; | |
239 b1[0x1A] = b2[0x1A] + b2[0x1B]; | |
240 b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0; | |
241 b1[0x1A] += b1[0x1B]; | |
242 | |
243 b1[0x1C] = b2[0x1C] + b2[0x1D]; | |
244 b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0; | |
245 b1[0x1E] = b2[0x1E] + b2[0x1F]; | |
246 b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0; | |
247 b1[0x1E] += b1[0x1F]; | |
248 b1[0x1C] += b1[0x1E]; | |
249 b1[0x1E] += b1[0x1D]; | |
250 b1[0x1D] += b1[0x1F]; | |
251 } | |
252 | |
253 out0[0x10*16] = b1[0x00]; | |
254 out0[0x10*12] = b1[0x04]; | |
255 out0[0x10* 8] = b1[0x02]; | |
256 out0[0x10* 4] = b1[0x06]; | |
257 out0[0x10* 0] = b1[0x01]; | |
258 out1[0x10* 0] = b1[0x01]; | |
259 out1[0x10* 4] = b1[0x05]; | |
260 out1[0x10* 8] = b1[0x03]; | |
261 out1[0x10*12] = b1[0x07]; | |
262 | |
263 b1[0x08] += b1[0x0C]; | |
264 out0[0x10*14] = b1[0x08]; | |
265 b1[0x0C] += b1[0x0a]; | |
266 out0[0x10*10] = b1[0x0C]; | |
267 b1[0x0A] += b1[0x0E]; | |
268 out0[0x10* 6] = b1[0x0A]; | |
269 b1[0x0E] += b1[0x09]; | |
270 out0[0x10* 2] = b1[0x0E]; | |
271 b1[0x09] += b1[0x0D]; | |
272 out1[0x10* 2] = b1[0x09]; | |
273 b1[0x0D] += b1[0x0B]; | |
274 out1[0x10* 6] = b1[0x0D]; | |
275 b1[0x0B] += b1[0x0F]; | |
276 out1[0x10*10] = b1[0x0B]; | |
277 out1[0x10*14] = b1[0x0F]; | |
278 | |
279 b1[0x18] += b1[0x1C]; | |
280 out0[0x10*15] = b1[0x10] + b1[0x18]; | |
281 out0[0x10*13] = b1[0x18] + b1[0x14]; | |
282 b1[0x1C] += b1[0x1a]; | |
283 out0[0x10*11] = b1[0x14] + b1[0x1C]; | |
284 out0[0x10* 9] = b1[0x1C] + b1[0x12]; | |
285 b1[0x1A] += b1[0x1E]; | |
286 out0[0x10* 7] = b1[0x12] + b1[0x1A]; | |
287 out0[0x10* 5] = b1[0x1A] + b1[0x16]; | |
288 b1[0x1E] += b1[0x19]; | |
289 out0[0x10* 3] = b1[0x16] + b1[0x1E]; | |
290 out0[0x10* 1] = b1[0x1E] + b1[0x11]; | |
291 b1[0x19] += b1[0x1D]; | |
292 out1[0x10* 1] = b1[0x11] + b1[0x19]; | |
293 out1[0x10* 3] = b1[0x19] + b1[0x15]; | |
294 b1[0x1D] += b1[0x1B]; | |
295 out1[0x10* 5] = b1[0x15] + b1[0x1D]; | |
296 out1[0x10* 7] = b1[0x1D] + b1[0x13]; | |
297 b1[0x1B] += b1[0x1F]; | |
298 out1[0x10* 9] = b1[0x13] + b1[0x1B]; | |
299 out1[0x10*11] = b1[0x1B] + b1[0x17]; | |
300 out1[0x10*13] = b1[0x17] + b1[0x1F]; | |
301 out1[0x10*15] = b1[0x1F]; | |
302 } | |
303 | |
304 /* | |
305 * the call via dct64 is a trick to force GCC to use | |
306 * (new) registers for the b1,b2 pointer to the bufs[xx] field | |
307 */ | |
308 void dct64(real *a,real *b,real *c) | |
309 { | |
310 real bufs[0x40]; | |
311 dct64_1(a,b,bufs,bufs+0x20,c); | |
312 } | |
313 |