Mercurial > mplayer.hg
annotate mp3lib/decode_i586.c @ 12467:5b1458ea64c9
AUDIO OUTPUT DRIVER section added, VO section extended, small fixes.
author | diego |
---|---|
date | Thu, 13 May 2004 10:51:27 +0000 |
parents | 114f3d149324 |
children | bc760f3f129e |
rev | line source |
---|---|
4147 | 1 /* |
2 * mpg123_synth_1to1 works the same way as the c version of this | |
3 * file. only two types of changes have been made: | |
4 * - reordered floating point instructions to | |
5 * prevent pipline stalls | |
6 * - made WRITE_SAMPLE use integer instead of | |
7 * (slower) floating point | |
8 * all kinds of x86 processors should benefit from these | |
9 * modifications. | |
10 * | |
11 * useful sources of information on optimizing x86 code include: | |
12 * | |
13 * Intel Architecture Optimization Manual | |
14 * http://www.intel.com/design/pentium/manuals/242816.htm | |
15 * | |
16 * Cyrix 6x86 Instruction Set Summary | |
17 * ftp://ftp.cyrix.com/6x86/6x-dbch6.pdf | |
18 * | |
19 * AMD-K5 Processor Software Development | |
20 * http://www.amd.com/products/cpg/techdocs/appnotes/20007e.pdf | |
21 * | |
22 * Stefan Bieschewski <stb@acm.org> | |
23 * | |
24 * $Id$ | |
25 */ | |
12292 | 26 #include "../config.h" |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
27 #include "../mangle.h" |
4147 | 28 #define real float /* ugly - but only way */ |
29 | |
30 static long buffs[1088]; | |
12292 | 31 static long attribute_used bo=1; |
8543 | 32 static long saved_ebp; |
4147 | 33 |
34 int synth_1to1_pent(real *bandPtr, int channel, short *samples) | |
35 { | |
36 real tmp[3]; | |
37 register int retval; | |
38 __asm __volatile( | |
8543 | 39 " movl %%ebp,"MANGLE(saved_ebp)"\n\t" |
4147 | 40 " movl %1,%%eax\n\t"/*bandPtr*/ |
41 " movl %3,%%esi\n\t" | |
42 " xorl %%edi,%%edi\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
43 " movl "MANGLE(bo)",%%ebp\n\t" |
4147 | 44 " cmpl %%edi,%2\n\t" |
45 " jne .L48\n\t" | |
46 " decl %%ebp\n\t" | |
47 " andl $15,%%ebp\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
48 " movl %%ebp,"MANGLE(bo)"\n\t" |
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
49 " movl $"MANGLE(buffs)",%%ecx\n\t" |
4147 | 50 " jmp .L49\n\t" |
51 ".L48:\n\t" | |
52 " addl $2,%%esi\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
53 " movl $"MANGLE(buffs)"+2176,%%ecx\n\t" |
4147 | 54 ".L49:\n\t" |
55 " testl $1,%%ebp\n\t" | |
56 " je .L50\n\t" | |
57 " movl %%ecx,%%ebx\n\t" | |
58 " movl %%ebp,%4\n\t" | |
59 " pushl %%eax\n\t" | |
60 " movl 4+%4,%%edx\n\t" | |
61 " leal (%%ebx,%%edx,4),%%eax\n\t" | |
62 " pushl %%eax\n\t" | |
63 " movl 8+%4,%%eax\n\t" | |
64 " incl %%eax\n\t" | |
65 " andl $15,%%eax\n\t" | |
66 " leal 1088(,%%eax,4),%%eax\n\t" | |
67 " addl %%ebx,%%eax\n\t" | |
68 " jmp .L74\n\t" | |
69 ".L50:\n\t" | |
70 " leal 1088(%%ecx),%%ebx\n\t" | |
71 " leal 1(%%ebp),%%edx\n\t" | |
72 " movl %%edx,%4\n\t" | |
73 " pushl %%eax\n\t" | |
74 " leal 1092(%%ecx,%%ebp,4),%%eax\n\t" | |
75 " pushl %%eax\n\t" | |
76 " leal (%%ecx,%%ebp,4),%%eax\n\t" | |
77 ".L74:\n\t" | |
78 " pushl %%eax\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
79 " call "MANGLE(dct64)"\n\t" |
4147 | 80 " addl $12,%%esp\n\t" |
81 " movl %4,%%edx\n\t" | |
82 " leal 0(,%%edx,4),%%edx\n\t" | |
8560
1320f1b3229d
fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents:
8543
diff
changeset
|
83 " movl $"MANGLE(mp3lib_decwin)"+64,%%eax\n\t" |
4147 | 84 " movl %%eax,%%ecx\n\t" |
85 " subl %%edx,%%ecx\n\t" | |
86 " movl $16,%%ebp\n\t" | |
87 ".L55:\n\t" | |
88 " flds (%%ecx)\n\t" | |
89 " fmuls (%%ebx)\n\t" | |
90 " flds 4(%%ecx)\n\t" | |
91 " fmuls 4(%%ebx)\n\t" | |
92 " fxch %%st(1)\n\t" | |
93 " flds 8(%%ecx)\n\t" | |
94 " fmuls 8(%%ebx)\n\t" | |
95 " fxch %%st(2)\n\t" | |
96 " fsubrp %%st,%%st(1)\n\t" | |
97 " flds 12(%%ecx)\n\t" | |
98 " fmuls 12(%%ebx)\n\t" | |
99 " fxch %%st(2)\n\t" | |
100 " faddp %%st,%%st(1)\n\t" | |
101 " flds 16(%%ecx)\n\t" | |
102 " fmuls 16(%%ebx)\n\t" | |
103 " fxch %%st(2)\n\t" | |
104 " fsubrp %%st,%%st(1)\n\t" | |
105 " flds 20(%%ecx)\n\t" | |
106 " fmuls 20(%%ebx)\n\t" | |
107 " fxch %%st(2)\n\t" | |
108 " faddp %%st,%%st(1)\n\t" | |
109 " flds 24(%%ecx)\n\t" | |
110 " fmuls 24(%%ebx)\n\t" | |
111 " fxch %%st(2)\n\t" | |
112 " fsubrp %%st,%%st(1)\n\t" | |
113 " flds 28(%%ecx)\n\t" | |
114 " fmuls 28(%%ebx)\n\t" | |
115 " fxch %%st(2)\n\t" | |
116 " faddp %%st,%%st(1)\n\t" | |
117 " flds 32(%%ecx)\n\t" | |
118 " fmuls 32(%%ebx)\n\t" | |
119 " fxch %%st(2)\n\t" | |
120 " fsubrp %%st,%%st(1)\n\t" | |
121 " flds 36(%%ecx)\n\t" | |
122 " fmuls 36(%%ebx)\n\t" | |
123 " fxch %%st(2)\n\t" | |
124 " faddp %%st,%%st(1)\n\t" | |
125 " flds 40(%%ecx)\n\t" | |
126 " fmuls 40(%%ebx)\n\t" | |
127 " fxch %%st(2)\n\t" | |
128 " fsubrp %%st,%%st(1)\n\t" | |
129 " flds 44(%%ecx)\n\t" | |
130 " fmuls 44(%%ebx)\n\t" | |
131 " fxch %%st(2)\n\t" | |
132 " faddp %%st,%%st(1)\n\t" | |
133 " flds 48(%%ecx)\n\t" | |
134 " fmuls 48(%%ebx)\n\t" | |
135 " fxch %%st(2)\n\t" | |
136 " fsubrp %%st,%%st(1)\n\t" | |
137 " flds 52(%%ecx)\n\t" | |
138 " fmuls 52(%%ebx)\n\t" | |
139 " fxch %%st(2)\n\t" | |
140 " faddp %%st,%%st(1)\n\t" | |
141 " flds 56(%%ecx)\n\t" | |
142 " fmuls 56(%%ebx)\n\t" | |
143 " fxch %%st(2)\n\t" | |
144 " fsubrp %%st,%%st(1)\n\t" | |
145 " flds 60(%%ecx)\n\t" | |
146 " fmuls 60(%%ebx)\n\t" | |
147 " fxch %%st(2)\n\t" | |
148 " subl $4,%%esp\n\t" | |
149 " faddp %%st,%%st(1)\n\t" | |
150 " fxch %%st(1)\n\t" | |
151 " fsubrp %%st,%%st(1)\n\t" | |
152 " fistpl (%%esp)\n\t" | |
153 " popl %%eax\n\t" | |
154 " cmpl $32767,%%eax\n\t" | |
155 " jg 1f\n\t" | |
156 " cmpl $-32768,%%eax\n\t" | |
157 " jl 2f\n\t" | |
158 " movw %%ax,(%%esi)\n\t" | |
159 " jmp 4f\n\t" | |
160 "1: movw $32767,(%%esi)\n\t" | |
161 " jmp 3f\n\t" | |
162 "2: movw $-32768,(%%esi)\n\t" | |
163 "3: incl %%edi\n\t" | |
164 "4:\n\t" | |
165 ".L54:\n\t" | |
166 " addl $64,%%ebx\n\t" | |
167 " subl $-128,%%ecx\n\t" | |
168 " addl $4,%%esi\n\t" | |
169 " decl %%ebp\n\t" | |
170 " jnz .L55\n\t" | |
171 " flds (%%ecx)\n\t" | |
172 " fmuls (%%ebx)\n\t" | |
173 " flds 8(%%ecx)\n\t" | |
174 " fmuls 8(%%ebx)\n\t" | |
175 " flds 16(%%ecx)\n\t" | |
176 " fmuls 16(%%ebx)\n\t" | |
177 " fxch %%st(2)\n\t" | |
178 " faddp %%st,%%st(1)\n\t" | |
179 " flds 24(%%ecx)\n\t" | |
180 " fmuls 24(%%ebx)\n\t" | |
181 " fxch %%st(2)\n\t" | |
182 " faddp %%st,%%st(1)\n\t" | |
183 " flds 32(%%ecx)\n\t" | |
184 " fmuls 32(%%ebx)\n\t" | |
185 " fxch %%st(2)\n\t" | |
186 " faddp %%st,%%st(1)\n\t" | |
187 " flds 40(%%ecx)\n\t" | |
188 " fmuls 40(%%ebx)\n\t" | |
189 " fxch %%st(2)\n\t" | |
190 " faddp %%st,%%st(1)\n\t" | |
191 " flds 48(%%ecx)\n\t" | |
192 " fmuls 48(%%ebx)\n\t" | |
193 " fxch %%st(2)\n\t" | |
194 " faddp %%st,%%st(1)\n\t" | |
195 " flds 56(%%ecx)\n\t" | |
196 " fmuls 56(%%ebx)\n\t" | |
197 " fxch %%st(2)\n\t" | |
198 " subl $4,%%esp\n\t" | |
199 " faddp %%st,%%st(1)\n\t" | |
200 " fxch %%st(1)\n\t" | |
201 " faddp %%st,%%st(1)\n\t" | |
202 " fistpl (%%esp)\n\t" | |
203 " popl %%eax\n\t" | |
204 " cmpl $32767,%%eax\n\t" | |
205 " jg 1f\n\t" | |
206 " cmpl $-32768,%%eax\n\t" | |
207 " jl 2f\n\t" | |
208 " movw %%ax,(%%esi)\n\t" | |
209 " jmp 4f\n\t" | |
210 "1: movw $32767,(%%esi)\n\t" | |
211 " jmp 3f\n\t" | |
212 "2: movw $-32768,(%%esi)\n\t" | |
213 "3: incl %%edi\n\t" | |
214 "4:\n\t" | |
215 ".L62:\n\t" | |
216 " addl $-64,%%ebx\n\t" | |
217 " addl $4,%%esi\n\t" | |
218 " movl %4,%%edx\n\t" | |
219 " leal -128(%%ecx,%%edx,8),%%ecx\n\t" | |
220 " movl $15,%%ebp\n\t" | |
221 ".L68:\n\t" | |
222 " flds -4(%%ecx)\n\t" | |
223 " fchs\n\t" | |
224 " fmuls (%%ebx)\n\t" | |
225 " flds -8(%%ecx)\n\t" | |
226 " fmuls 4(%%ebx)\n\t" | |
227 " fxch %%st(1)\n\t" | |
228 " flds -12(%%ecx)\n\t" | |
229 " fmuls 8(%%ebx)\n\t" | |
230 " fxch %%st(2)\n\t" | |
231 " fsubrp %%st,%%st(1)\n\t" | |
232 " flds -16(%%ecx)\n\t" | |
233 " fmuls 12(%%ebx)\n\t" | |
234 " fxch %%st(2)\n\t" | |
235 " fsubrp %%st,%%st(1)\n\t" | |
236 " flds -20(%%ecx)\n\t" | |
237 " fmuls 16(%%ebx)\n\t" | |
238 " fxch %%st(2)\n\t" | |
239 " fsubrp %%st,%%st(1)\n\t" | |
240 " flds -24(%%ecx)\n\t" | |
241 " fmuls 20(%%ebx)\n\t" | |
242 " fxch %%st(2)\n\t" | |
243 " fsubrp %%st,%%st(1)\n\t" | |
244 " flds -28(%%ecx)\n\t" | |
245 " fmuls 24(%%ebx)\n\t" | |
246 " fxch %%st(2)\n\t" | |
247 " fsubrp %%st,%%st(1)\n\t" | |
248 " flds -32(%%ecx)\n\t" | |
249 " fmuls 28(%%ebx)\n\t" | |
250 " fxch %%st(2)\n\t" | |
251 " fsubrp %%st,%%st(1)\n\t" | |
252 " flds -36(%%ecx)\n\t" | |
253 " fmuls 32(%%ebx)\n\t" | |
254 " fxch %%st(2)\n\t" | |
255 " fsubrp %%st,%%st(1)\n\t" | |
256 " flds -40(%%ecx)\n\t" | |
257 " fmuls 36(%%ebx)\n\t" | |
258 " fxch %%st(2)\n\t" | |
259 " fsubrp %%st,%%st(1)\n\t" | |
260 " flds -44(%%ecx)\n\t" | |
261 " fmuls 40(%%ebx)\n\t" | |
262 " fxch %%st(2)\n\t" | |
263 " fsubrp %%st,%%st(1)\n\t" | |
264 " flds -48(%%ecx)\n\t" | |
265 " fmuls 44(%%ebx)\n\t" | |
266 " fxch %%st(2)\n\t" | |
267 " fsubrp %%st,%%st(1)\n\t" | |
268 " flds -52(%%ecx)\n\t" | |
269 " fmuls 48(%%ebx)\n\t" | |
270 " fxch %%st(2)\n\t" | |
271 " fsubrp %%st,%%st(1)\n\t" | |
272 " flds -56(%%ecx)\n\t" | |
273 " fmuls 52(%%ebx)\n\t" | |
274 " fxch %%st(2)\n\t" | |
275 " fsubrp %%st,%%st(1)\n\t" | |
276 " flds -60(%%ecx)\n\t" | |
277 " fmuls 56(%%ebx)\n\t" | |
278 " fxch %%st(2)\n\t" | |
279 " fsubrp %%st,%%st(1)\n\t" | |
280 " flds (%%ecx)\n\t" | |
281 " fmuls 60(%%ebx)\n\t" | |
282 " fxch %%st(2)\n\t" | |
283 " subl $4,%%esp\n\t" | |
284 " fsubrp %%st,%%st(1)\n\t" | |
285 " fxch %%st(1)\n\t" | |
286 " fsubrp %%st,%%st(1)\n\t" | |
287 " fistpl (%%esp)\n\t" | |
288 " popl %%eax\n\t" | |
289 " cmpl $32767,%%eax\n\t" | |
290 " jg 1f\n\t" | |
291 " cmpl $-32768,%%eax\n\t" | |
292 " jl 2f\n\t" | |
293 " movw %%ax,(%%esi)\n\t" | |
294 " jmp 4f\n\t" | |
295 "1: movw $32767,(%%esi)\n\t" | |
296 " jmp 3f\n\t" | |
297 "2: movw $-32768,(%%esi)\n\t" | |
298 "3: incl %%edi\n\t" | |
299 "4:\n\t" | |
300 ".L67:\n\t" | |
301 " addl $-64,%%ebx\n\t" | |
302 " addl $-128,%%ecx\n\t" | |
303 " addl $4,%%esi\n\t" | |
304 " decl %%ebp\n\t" | |
305 " jnz .L68\n\t" | |
306 " movl %%edi,%%eax\n\t" | |
8543 | 307 " movl "MANGLE(saved_ebp)",%%ebp\n\t" |
4147 | 308 :"=a"(retval) |
309 :"m"(bandPtr),"m"(channel),"m"(samples),"m"(tmp[0]) | |
8543 | 310 :"memory","%edi","%esi","%ebx"); |
4147 | 311 return retval; |
312 } |