Mercurial > mplayer.hg
annotate mp3lib/decode_MMX.c @ 6733:3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
author | michael |
---|---|
date | Sun, 14 Jul 2002 19:44:40 +0000 |
parents | d4367189b2ff |
children | 1320f1b3229d |
rev | line source |
---|---|
4142 | 1 /* |
2 * this code comes under GPL | |
3 * This code was taken from http://www.mpg123.org | |
4 * See ChangeLog of mpg123-0.59s-pre.1 for detail | |
5 * Applied to mplayer by Nick Kurshev <nickols_k@mail.ru> | |
6 * | |
7 * Local ChangeLog: | |
8 * - Partial loops unrolling and removing MOVW insn from loops | |
9 */ | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
10 #include "../mangle.h" |
4142 | 11 #define real float /* ugly - but only way */ |
12 | |
13 static unsigned long long __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL; | |
14 static unsigned long long __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL; | |
15 unsigned long __attribute__((aligned(8))) costab_mmx[] = | |
16 { | |
17 1056974725, | |
18 1057056395, | |
19 1057223771, | |
20 1057485416, | |
21 1057855544, | |
22 1058356026, | |
23 1059019886, | |
24 1059897405, | |
25 1061067246, | |
26 1062657950, | |
27 1064892987, | |
28 1066774581, | |
29 1069414683, | |
30 1073984175, | |
31 1079645762, | |
32 1092815430, | |
33 1057005197, | |
34 1057342072, | |
35 1058087743, | |
36 1059427869, | |
37 1061799040, | |
38 1065862217, | |
39 1071413542, | |
40 1084439708, | |
41 1057128951, | |
42 1058664893, | |
43 1063675095, | |
44 1076102863, | |
45 1057655764, | |
46 1067924853, | |
47 1060439283, | |
48 }; | |
49 | |
4322 | 50 static int temp; |
4142 | 51 void synth_1to1_MMX_s(real *bandPtr, int channel, short *samples, |
52 short *buffs, int *bo) | |
53 { | |
54 __asm __volatile( | |
55 "movl %1,%%ecx\n\t" | |
56 "movl %2,%%edi\n\t" | |
57 "movl $15,%%ebx\n\t" | |
58 "movl %4,%%edx\n\t" | |
59 "leal (%%edi,%%ecx,2),%%edi\n\t" | |
60 "decl %%ecx\n\t" | |
61 "movl %3,%%esi\n\t" | |
62 "movl (%%edx),%%eax\n\t" | |
4608 | 63 "jecxz .L01\n\t" |
4142 | 64 "decl %%eax\n\t" |
65 "andl %%ebx,%%eax\n\t" | |
66 "leal 1088(%%esi),%%esi\n\t" | |
67 "movl %%eax,(%%edx)\n\t" | |
4608 | 68 ".L01:\n\t" |
4142 | 69 "leal (%%esi,%%eax,2),%%edx\n\t" |
4322 | 70 "movl %%eax,%5\n\t" |
4142 | 71 "incl %%eax\n\t" |
72 "pushl %0\n\t" | |
73 "andl %%ebx,%%eax\n\t" | |
74 "leal 544(%%esi,%%eax,2),%%ecx\n\t" | |
75 "incl %%ebx\n\t" | |
76 "testl $1, %%eax\n\t" | |
4608 | 77 "jnz .L02\n\t" |
4142 | 78 "xchgl %%edx,%%ecx\n\t" |
4322 | 79 "incl %5\n\t" |
4142 | 80 "leal 544(%%esi),%%esi\n\t" |
4608 | 81 ".L02:\n\t" |
4142 | 82 "emms\n\t" |
83 "pushl %%edx\n\t" | |
84 "pushl %%ecx\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
85 "call *"MANGLE(dct64_MMX_func)"\n\t" |
4142 | 86 "leal 1(%%ebx), %%ecx\n\t" |
4322 | 87 "subl %5,%%ebx\n\t" |
4142 | 88 "pushl %%ecx\n\t" |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
89 "leal "MANGLE(decwins)"(%%ebx,%%ebx,1), %%edx\n\t" |
4142 | 90 "shrl $1, %%ecx\n\t" |
5290 | 91 ".balign 16\n\t" |
4608 | 92 ".L03:\n\t" |
4142 | 93 "movq (%%edx),%%mm0\n\t" |
94 "movq 64(%%edx),%%mm4\n\t" | |
95 "pmaddwd (%%esi),%%mm0\n\t" | |
96 "pmaddwd 32(%%esi),%%mm4\n\t" | |
97 "movq 8(%%edx),%%mm1\n\t" | |
98 "movq 72(%%edx),%%mm5\n\t" | |
99 "pmaddwd 8(%%esi),%%mm1\n\t" | |
100 "pmaddwd 40(%%esi),%%mm5\n\t" | |
101 "movq 16(%%edx),%%mm2\n\t" | |
102 "movq 80(%%edx),%%mm6\n\t" | |
103 "pmaddwd 16(%%esi),%%mm2\n\t" | |
104 "pmaddwd 48(%%esi),%%mm6\n\t" | |
105 "movq 24(%%edx),%%mm3\n\t" | |
106 "movq 88(%%edx),%%mm7\n\t" | |
107 "pmaddwd 24(%%esi),%%mm3\n\t" | |
108 "pmaddwd 56(%%esi),%%mm7\n\t" | |
109 "paddd %%mm1,%%mm0\n\t" | |
110 "paddd %%mm5,%%mm4\n\t" | |
111 "paddd %%mm2,%%mm0\n\t" | |
112 "paddd %%mm6,%%mm4\n\t" | |
113 "paddd %%mm3,%%mm0\n\t" | |
114 "paddd %%mm7,%%mm4\n\t" | |
115 "movq %%mm0,%%mm1\n\t" | |
116 "movq %%mm4,%%mm5\n\t" | |
117 "psrlq $32,%%mm1\n\t" | |
118 "psrlq $32,%%mm5\n\t" | |
119 "paddd %%mm1,%%mm0\n\t" | |
120 "paddd %%mm5,%%mm4\n\t" | |
121 "psrad $13,%%mm0\n\t" | |
122 "psrad $13,%%mm4\n\t" | |
123 "packssdw %%mm0,%%mm0\n\t" | |
124 "packssdw %%mm4,%%mm4\n\t" | |
125 | |
126 "movq (%%edi), %%mm1\n\t" | |
127 "punpckldq %%mm4, %%mm0\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
128 "pand "MANGLE(one_null)", %%mm1\n\t" |
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
129 "pand "MANGLE(null_one)", %%mm0\n\t" |
4142 | 130 "por %%mm0, %%mm1\n\t" |
131 "movq %%mm1,(%%edi)\n\t" | |
132 | |
133 "leal 64(%%esi),%%esi\n\t" | |
134 "leal 128(%%edx),%%edx\n\t" | |
135 "leal 8(%%edi),%%edi\n\t" | |
136 | |
137 "decl %%ecx\n\t" | |
4608 | 138 "jnz .L03\n\t" |
4142 | 139 |
140 "popl %%ecx\n\t" | |
141 "andl $1, %%ecx\n\t" | |
142 "jecxz .next_loop\n\t" | |
143 | |
144 "movq (%%edx),%%mm0\n\t" | |
145 "pmaddwd (%%esi),%%mm0\n\t" | |
146 "movq 8(%%edx),%%mm1\n\t" | |
147 "pmaddwd 8(%%esi),%%mm1\n\t" | |
148 "movq 16(%%edx),%%mm2\n\t" | |
149 "pmaddwd 16(%%esi),%%mm2\n\t" | |
150 "movq 24(%%edx),%%mm3\n\t" | |
151 "pmaddwd 24(%%esi),%%mm3\n\t" | |
152 "paddd %%mm1,%%mm0\n\t" | |
153 "paddd %%mm2,%%mm0\n\t" | |
154 "paddd %%mm3,%%mm0\n\t" | |
155 "movq %%mm0,%%mm1\n\t" | |
156 "psrlq $32,%%mm1\n\t" | |
157 "paddd %%mm1,%%mm0\n\t" | |
158 "psrad $13,%%mm0\n\t" | |
159 "packssdw %%mm0,%%mm0\n\t" | |
160 "movd %%mm0,%%eax\n\t" | |
161 "movw %%ax, (%%edi)\n\t" | |
162 "leal 32(%%esi),%%esi\n\t" | |
163 "leal 64(%%edx),%%edx\n\t" | |
164 "leal 4(%%edi),%%edi\n\t" | |
165 | |
166 ".next_loop:\n\t" | |
167 "subl $64,%%esi\n\t" | |
168 "movl $7,%%ecx\n\t" | |
5290 | 169 ".balign 16\n\t" |
4608 | 170 ".L04:\n\t" |
4142 | 171 "movq (%%edx),%%mm0\n\t" |
172 "movq 64(%%edx),%%mm4\n\t" | |
173 "pmaddwd (%%esi),%%mm0\n\t" | |
174 "pmaddwd -32(%%esi),%%mm4\n\t" | |
175 "movq 8(%%edx),%%mm1\n\t" | |
176 "movq 72(%%edx),%%mm5\n\t" | |
177 "pmaddwd 8(%%esi),%%mm1\n\t" | |
178 "pmaddwd -24(%%esi),%%mm5\n\t" | |
179 "movq 16(%%edx),%%mm2\n\t" | |
180 "movq 80(%%edx),%%mm6\n\t" | |
181 "pmaddwd 16(%%esi),%%mm2\n\t" | |
182 "pmaddwd -16(%%esi),%%mm6\n\t" | |
183 "movq 24(%%edx),%%mm3\n\t" | |
184 "movq 88(%%edx),%%mm7\n\t" | |
185 "pmaddwd 24(%%esi),%%mm3\n\t" | |
186 "pmaddwd -8(%%esi),%%mm7\n\t" | |
187 "paddd %%mm1,%%mm0\n\t" | |
188 "paddd %%mm5,%%mm4\n\t" | |
189 "paddd %%mm2,%%mm0\n\t" | |
190 "paddd %%mm6,%%mm4\n\t" | |
191 "paddd %%mm3,%%mm0\n\t" | |
192 "paddd %%mm7,%%mm4\n\t" | |
193 "movq %%mm0,%%mm1\n\t" | |
194 "movq %%mm4,%%mm5\n\t" | |
195 "psrlq $32,%%mm1\n\t" | |
196 "psrlq $32,%%mm5\n\t" | |
197 "paddd %%mm0,%%mm1\n\t" | |
198 "paddd %%mm4,%%mm5\n\t" | |
199 "psrad $13,%%mm1\n\t" | |
200 "psrad $13,%%mm5\n\t" | |
201 "packssdw %%mm1,%%mm1\n\t" | |
202 "packssdw %%mm5,%%mm5\n\t" | |
203 "psubd %%mm0,%%mm0\n\t" | |
204 "psubd %%mm4,%%mm4\n\t" | |
205 "psubsw %%mm1,%%mm0\n\t" | |
206 "psubsw %%mm5,%%mm4\n\t" | |
207 | |
208 "movq (%%edi), %%mm1\n\t" | |
209 "punpckldq %%mm4, %%mm0\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
210 "pand "MANGLE(one_null)", %%mm1\n\t" |
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4142
diff
changeset
|
211 "pand "MANGLE(null_one)", %%mm0\n\t" |
4142 | 212 "por %%mm0, %%mm1\n\t" |
213 "movq %%mm1,(%%edi)\n\t" | |
214 | |
215 "subl $64,%%esi\n\t" | |
216 "addl $128,%%edx\n\t" | |
217 "leal 8(%%edi),%%edi\n\t" | |
218 "decl %%ecx\n\t" | |
4608 | 219 "jnz .L04\n\t" |
4142 | 220 |
221 "movq (%%edx),%%mm0\n\t" | |
222 "pmaddwd (%%esi),%%mm0\n\t" | |
223 "movq 8(%%edx),%%mm1\n\t" | |
224 "pmaddwd 8(%%esi),%%mm1\n\t" | |
225 "movq 16(%%edx),%%mm2\n\t" | |
226 "pmaddwd 16(%%esi),%%mm2\n\t" | |
227 "movq 24(%%edx),%%mm3\n\t" | |
228 "pmaddwd 24(%%esi),%%mm3\n\t" | |
229 "paddd %%mm1,%%mm0\n\t" | |
230 "paddd %%mm2,%%mm0\n\t" | |
231 "paddd %%mm3,%%mm0\n\t" | |
232 "movq %%mm0,%%mm1\n\t" | |
233 "psrlq $32,%%mm1\n\t" | |
234 "paddd %%mm0,%%mm1\n\t" | |
235 "psrad $13,%%mm1\n\t" | |
236 "packssdw %%mm1,%%mm1\n\t" | |
237 "psubd %%mm0,%%mm0\n\t" | |
238 "psubsw %%mm1,%%mm0\n\t" | |
239 "movd %%mm0,%%eax\n\t" | |
240 "movw %%ax,(%%edi)\n\t" | |
241 "emms\n\t" | |
242 : | |
4322 | 243 :"m"(bandPtr),"m"(channel),"m"(samples),"m"(buffs),"m"(bo), "m"(temp) |
244 :"memory","%edi","%esi","%ebx"); | |
4142 | 245 } |