annotate mp3lib/decode_MMX.c @ 22445:f2bdb74fc3e7

Remove subcp_open/subcp_close from mkv demuxer, they are useless since a long time.
author reimar
date Mon, 05 Mar 2007 12:02:57 +0000
parents 8092494fc92c
children e070d7f61e9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4142
nick
parents:
diff changeset
1 /*
nick
parents:
diff changeset
2 * this code comes under GPL
nick
parents:
diff changeset
3 * This code was taken from http://www.mpg123.org
nick
parents:
diff changeset
4 * See ChangeLog of mpg123-0.59s-pre.1 for detail
nick
parents:
diff changeset
5 * Applied to mplayer by Nick Kurshev <nickols_k@mail.ru>
nick
parents:
diff changeset
6 *
nick
parents:
diff changeset
7 * Local ChangeLog:
nick
parents:
diff changeset
8 * - Partial loops unrolling and removing MOVW insn from loops
nick
parents:
diff changeset
9 */
16989
e7a129082fda Unify include paths, -I.. is in CFLAGS.
diego
parents: 12292
diff changeset
10 #include "config.h"
e7a129082fda Unify include paths, -I.. is in CFLAGS.
diego
parents: 12292
diff changeset
11 #include "mangle.h"
4142
nick
parents:
diff changeset
12 #define real float /* ugly - but only way */
nick
parents:
diff changeset
13
12292
114f3d149324 attribute_used for gcc3.4
alex
parents: 11266
diff changeset
14 static unsigned long long attribute_used __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL;
114f3d149324 attribute_used for gcc3.4
alex
parents: 11266
diff changeset
15 static unsigned long long attribute_used __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL;
18932
69c665e91946 Add dct64_sse, a replacement for dct64_MMX. About 60% faster on its author's Pentium III
gpoirier
parents: 16989
diff changeset
16 unsigned long __attribute__((aligned(16))) costab_mmx[] =
4142
nick
parents:
diff changeset
17 {
nick
parents:
diff changeset
18 1056974725,
nick
parents:
diff changeset
19 1057056395,
nick
parents:
diff changeset
20 1057223771,
nick
parents:
diff changeset
21 1057485416,
nick
parents:
diff changeset
22 1057855544,
nick
parents:
diff changeset
23 1058356026,
nick
parents:
diff changeset
24 1059019886,
nick
parents:
diff changeset
25 1059897405,
nick
parents:
diff changeset
26 1061067246,
nick
parents:
diff changeset
27 1062657950,
nick
parents:
diff changeset
28 1064892987,
nick
parents:
diff changeset
29 1066774581,
nick
parents:
diff changeset
30 1069414683,
nick
parents:
diff changeset
31 1073984175,
nick
parents:
diff changeset
32 1079645762,
nick
parents:
diff changeset
33 1092815430,
nick
parents:
diff changeset
34 1057005197,
nick
parents:
diff changeset
35 1057342072,
nick
parents:
diff changeset
36 1058087743,
nick
parents:
diff changeset
37 1059427869,
nick
parents:
diff changeset
38 1061799040,
nick
parents:
diff changeset
39 1065862217,
nick
parents:
diff changeset
40 1071413542,
nick
parents:
diff changeset
41 1084439708,
nick
parents:
diff changeset
42 1057128951,
nick
parents:
diff changeset
43 1058664893,
nick
parents:
diff changeset
44 1063675095,
nick
parents:
diff changeset
45 1076102863,
nick
parents:
diff changeset
46 1057655764,
nick
parents:
diff changeset
47 1067924853,
nick
parents:
diff changeset
48 1060439283,
nick
parents:
diff changeset
49 };
nick
parents:
diff changeset
50
11266
6beea1683618 reverting my last change as buggy gcc 3.x fails with it :(
alex
parents: 11244
diff changeset
51 static int temp; // buggy gcc 3.x fails if this is moved into the function :(
4142
nick
parents:
diff changeset
52 void synth_1to1_MMX_s(real *bandPtr, int channel, short *samples,
nick
parents:
diff changeset
53 short *buffs, int *bo)
nick
parents:
diff changeset
54 {
11244
b91bd88dafea 100l to Nick
alex
parents: 11240
diff changeset
55
4142
nick
parents:
diff changeset
56 __asm __volatile(
nick
parents:
diff changeset
57 "movl %1,%%ecx\n\t"
nick
parents:
diff changeset
58 "movl %2,%%edi\n\t"
nick
parents:
diff changeset
59 "movl $15,%%ebx\n\t"
nick
parents:
diff changeset
60 "movl %4,%%edx\n\t"
nick
parents:
diff changeset
61 "leal (%%edi,%%ecx,2),%%edi\n\t"
nick
parents:
diff changeset
62 "decl %%ecx\n\t"
nick
parents:
diff changeset
63 "movl %3,%%esi\n\t"
nick
parents:
diff changeset
64 "movl (%%edx),%%eax\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
65 "jecxz .L01\n\t"
4142
nick
parents:
diff changeset
66 "decl %%eax\n\t"
nick
parents:
diff changeset
67 "andl %%ebx,%%eax\n\t"
nick
parents:
diff changeset
68 "leal 1088(%%esi),%%esi\n\t"
nick
parents:
diff changeset
69 "movl %%eax,(%%edx)\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
70 ".L01:\n\t"
4142
nick
parents:
diff changeset
71 "leal (%%esi,%%eax,2),%%edx\n\t"
4322
2935211e4f9b Fixing compilation on non-MMX but x86 systems
nick
parents: 4246
diff changeset
72 "movl %%eax,%5\n\t"
4142
nick
parents:
diff changeset
73 "incl %%eax\n\t"
nick
parents:
diff changeset
74 "andl %%ebx,%%eax\n\t"
nick
parents:
diff changeset
75 "leal 544(%%esi,%%eax,2),%%ecx\n\t"
nick
parents:
diff changeset
76 "incl %%ebx\n\t"
nick
parents:
diff changeset
77 "testl $1, %%eax\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
78 "jnz .L02\n\t"
4142
nick
parents:
diff changeset
79 "xchgl %%edx,%%ecx\n\t"
4322
2935211e4f9b Fixing compilation on non-MMX but x86 systems
nick
parents: 4246
diff changeset
80 "incl %5\n\t"
4142
nick
parents:
diff changeset
81 "leal 544(%%esi),%%esi\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
82 ".L02:\n\t"
4142
nick
parents:
diff changeset
83 "emms\n\t"
11240
5403367c7032 removed the stdcall convention
alex
parents: 8560
diff changeset
84 "pushl %0\n\t"
4142
nick
parents:
diff changeset
85 "pushl %%edx\n\t"
nick
parents:
diff changeset
86 "pushl %%ecx\n\t"
4246
3f677202418b mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents: 4142
diff changeset
87 "call *"MANGLE(dct64_MMX_func)"\n\t"
11240
5403367c7032 removed the stdcall convention
alex
parents: 8560
diff changeset
88 "addl $12, %%esp\n\t"
4142
nick
parents:
diff changeset
89 "leal 1(%%ebx), %%ecx\n\t"
4322
2935211e4f9b Fixing compilation on non-MMX but x86 systems
nick
parents: 4246
diff changeset
90 "subl %5,%%ebx\n\t"
4142
nick
parents:
diff changeset
91 "pushl %%ecx\n\t"
8560
1320f1b3229d fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents: 5290
diff changeset
92 "leal "MANGLE(mp3lib_decwins)"(%%ebx,%%ebx,1), %%edx\n\t"
4142
nick
parents:
diff changeset
93 "shrl $1, %%ecx\n\t"
21046
ba5087cb0bd4 Use ASMALIGN macro for better compatibility and remove SYS_DARWIN
reimar
parents: 21040
diff changeset
94 ASMALIGN(4)
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
95 ".L03:\n\t"
4142
nick
parents:
diff changeset
96 "movq (%%edx),%%mm0\n\t"
nick
parents:
diff changeset
97 "movq 64(%%edx),%%mm4\n\t"
nick
parents:
diff changeset
98 "pmaddwd (%%esi),%%mm0\n\t"
nick
parents:
diff changeset
99 "pmaddwd 32(%%esi),%%mm4\n\t"
nick
parents:
diff changeset
100 "movq 8(%%edx),%%mm1\n\t"
nick
parents:
diff changeset
101 "movq 72(%%edx),%%mm5\n\t"
nick
parents:
diff changeset
102 "pmaddwd 8(%%esi),%%mm1\n\t"
nick
parents:
diff changeset
103 "pmaddwd 40(%%esi),%%mm5\n\t"
nick
parents:
diff changeset
104 "movq 16(%%edx),%%mm2\n\t"
nick
parents:
diff changeset
105 "movq 80(%%edx),%%mm6\n\t"
nick
parents:
diff changeset
106 "pmaddwd 16(%%esi),%%mm2\n\t"
nick
parents:
diff changeset
107 "pmaddwd 48(%%esi),%%mm6\n\t"
nick
parents:
diff changeset
108 "movq 24(%%edx),%%mm3\n\t"
nick
parents:
diff changeset
109 "movq 88(%%edx),%%mm7\n\t"
nick
parents:
diff changeset
110 "pmaddwd 24(%%esi),%%mm3\n\t"
nick
parents:
diff changeset
111 "pmaddwd 56(%%esi),%%mm7\n\t"
nick
parents:
diff changeset
112 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
113 "paddd %%mm5,%%mm4\n\t"
nick
parents:
diff changeset
114 "paddd %%mm2,%%mm0\n\t"
nick
parents:
diff changeset
115 "paddd %%mm6,%%mm4\n\t"
nick
parents:
diff changeset
116 "paddd %%mm3,%%mm0\n\t"
nick
parents:
diff changeset
117 "paddd %%mm7,%%mm4\n\t"
nick
parents:
diff changeset
118 "movq %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
119 "movq %%mm4,%%mm5\n\t"
nick
parents:
diff changeset
120 "psrlq $32,%%mm1\n\t"
nick
parents:
diff changeset
121 "psrlq $32,%%mm5\n\t"
nick
parents:
diff changeset
122 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
123 "paddd %%mm5,%%mm4\n\t"
nick
parents:
diff changeset
124 "psrad $13,%%mm0\n\t"
nick
parents:
diff changeset
125 "psrad $13,%%mm4\n\t"
nick
parents:
diff changeset
126 "packssdw %%mm0,%%mm0\n\t"
nick
parents:
diff changeset
127 "packssdw %%mm4,%%mm4\n\t"
nick
parents:
diff changeset
128
nick
parents:
diff changeset
129 "movq (%%edi), %%mm1\n\t"
nick
parents:
diff changeset
130 "punpckldq %%mm4, %%mm0\n\t"
4246
3f677202418b mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents: 4142
diff changeset
131 "pand "MANGLE(one_null)", %%mm1\n\t"
3f677202418b mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents: 4142
diff changeset
132 "pand "MANGLE(null_one)", %%mm0\n\t"
4142
nick
parents:
diff changeset
133 "por %%mm0, %%mm1\n\t"
nick
parents:
diff changeset
134 "movq %%mm1,(%%edi)\n\t"
nick
parents:
diff changeset
135
nick
parents:
diff changeset
136 "leal 64(%%esi),%%esi\n\t"
nick
parents:
diff changeset
137 "leal 128(%%edx),%%edx\n\t"
nick
parents:
diff changeset
138 "leal 8(%%edi),%%edi\n\t"
nick
parents:
diff changeset
139
nick
parents:
diff changeset
140 "decl %%ecx\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
141 "jnz .L03\n\t"
4142
nick
parents:
diff changeset
142
nick
parents:
diff changeset
143 "popl %%ecx\n\t"
nick
parents:
diff changeset
144 "andl $1, %%ecx\n\t"
nick
parents:
diff changeset
145 "jecxz .next_loop\n\t"
nick
parents:
diff changeset
146
nick
parents:
diff changeset
147 "movq (%%edx),%%mm0\n\t"
nick
parents:
diff changeset
148 "pmaddwd (%%esi),%%mm0\n\t"
nick
parents:
diff changeset
149 "movq 8(%%edx),%%mm1\n\t"
nick
parents:
diff changeset
150 "pmaddwd 8(%%esi),%%mm1\n\t"
nick
parents:
diff changeset
151 "movq 16(%%edx),%%mm2\n\t"
nick
parents:
diff changeset
152 "pmaddwd 16(%%esi),%%mm2\n\t"
nick
parents:
diff changeset
153 "movq 24(%%edx),%%mm3\n\t"
nick
parents:
diff changeset
154 "pmaddwd 24(%%esi),%%mm3\n\t"
nick
parents:
diff changeset
155 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
156 "paddd %%mm2,%%mm0\n\t"
nick
parents:
diff changeset
157 "paddd %%mm3,%%mm0\n\t"
nick
parents:
diff changeset
158 "movq %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
159 "psrlq $32,%%mm1\n\t"
nick
parents:
diff changeset
160 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
161 "psrad $13,%%mm0\n\t"
nick
parents:
diff changeset
162 "packssdw %%mm0,%%mm0\n\t"
nick
parents:
diff changeset
163 "movd %%mm0,%%eax\n\t"
nick
parents:
diff changeset
164 "movw %%ax, (%%edi)\n\t"
nick
parents:
diff changeset
165 "leal 32(%%esi),%%esi\n\t"
nick
parents:
diff changeset
166 "leal 64(%%edx),%%edx\n\t"
nick
parents:
diff changeset
167 "leal 4(%%edi),%%edi\n\t"
nick
parents:
diff changeset
168
nick
parents:
diff changeset
169 ".next_loop:\n\t"
nick
parents:
diff changeset
170 "subl $64,%%esi\n\t"
nick
parents:
diff changeset
171 "movl $7,%%ecx\n\t"
21046
ba5087cb0bd4 Use ASMALIGN macro for better compatibility and remove SYS_DARWIN
reimar
parents: 21040
diff changeset
172 ASMALIGN(4)
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
173 ".L04:\n\t"
4142
nick
parents:
diff changeset
174 "movq (%%edx),%%mm0\n\t"
nick
parents:
diff changeset
175 "movq 64(%%edx),%%mm4\n\t"
nick
parents:
diff changeset
176 "pmaddwd (%%esi),%%mm0\n\t"
nick
parents:
diff changeset
177 "pmaddwd -32(%%esi),%%mm4\n\t"
nick
parents:
diff changeset
178 "movq 8(%%edx),%%mm1\n\t"
nick
parents:
diff changeset
179 "movq 72(%%edx),%%mm5\n\t"
nick
parents:
diff changeset
180 "pmaddwd 8(%%esi),%%mm1\n\t"
nick
parents:
diff changeset
181 "pmaddwd -24(%%esi),%%mm5\n\t"
nick
parents:
diff changeset
182 "movq 16(%%edx),%%mm2\n\t"
nick
parents:
diff changeset
183 "movq 80(%%edx),%%mm6\n\t"
nick
parents:
diff changeset
184 "pmaddwd 16(%%esi),%%mm2\n\t"
nick
parents:
diff changeset
185 "pmaddwd -16(%%esi),%%mm6\n\t"
nick
parents:
diff changeset
186 "movq 24(%%edx),%%mm3\n\t"
nick
parents:
diff changeset
187 "movq 88(%%edx),%%mm7\n\t"
nick
parents:
diff changeset
188 "pmaddwd 24(%%esi),%%mm3\n\t"
nick
parents:
diff changeset
189 "pmaddwd -8(%%esi),%%mm7\n\t"
nick
parents:
diff changeset
190 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
191 "paddd %%mm5,%%mm4\n\t"
nick
parents:
diff changeset
192 "paddd %%mm2,%%mm0\n\t"
nick
parents:
diff changeset
193 "paddd %%mm6,%%mm4\n\t"
nick
parents:
diff changeset
194 "paddd %%mm3,%%mm0\n\t"
nick
parents:
diff changeset
195 "paddd %%mm7,%%mm4\n\t"
nick
parents:
diff changeset
196 "movq %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
197 "movq %%mm4,%%mm5\n\t"
nick
parents:
diff changeset
198 "psrlq $32,%%mm1\n\t"
nick
parents:
diff changeset
199 "psrlq $32,%%mm5\n\t"
nick
parents:
diff changeset
200 "paddd %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
201 "paddd %%mm4,%%mm5\n\t"
nick
parents:
diff changeset
202 "psrad $13,%%mm1\n\t"
nick
parents:
diff changeset
203 "psrad $13,%%mm5\n\t"
nick
parents:
diff changeset
204 "packssdw %%mm1,%%mm1\n\t"
nick
parents:
diff changeset
205 "packssdw %%mm5,%%mm5\n\t"
nick
parents:
diff changeset
206 "psubd %%mm0,%%mm0\n\t"
nick
parents:
diff changeset
207 "psubd %%mm4,%%mm4\n\t"
nick
parents:
diff changeset
208 "psubsw %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
209 "psubsw %%mm5,%%mm4\n\t"
nick
parents:
diff changeset
210
nick
parents:
diff changeset
211 "movq (%%edi), %%mm1\n\t"
nick
parents:
diff changeset
212 "punpckldq %%mm4, %%mm0\n\t"
4246
3f677202418b mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents: 4142
diff changeset
213 "pand "MANGLE(one_null)", %%mm1\n\t"
3f677202418b mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents: 4142
diff changeset
214 "pand "MANGLE(null_one)", %%mm0\n\t"
4142
nick
parents:
diff changeset
215 "por %%mm0, %%mm1\n\t"
nick
parents:
diff changeset
216 "movq %%mm1,(%%edi)\n\t"
nick
parents:
diff changeset
217
nick
parents:
diff changeset
218 "subl $64,%%esi\n\t"
nick
parents:
diff changeset
219 "addl $128,%%edx\n\t"
nick
parents:
diff changeset
220 "leal 8(%%edi),%%edi\n\t"
nick
parents:
diff changeset
221 "decl %%ecx\n\t"
4608
b9c19fe73850 Fix according to strange bugreport
nick
parents: 4322
diff changeset
222 "jnz .L04\n\t"
4142
nick
parents:
diff changeset
223
nick
parents:
diff changeset
224 "movq (%%edx),%%mm0\n\t"
nick
parents:
diff changeset
225 "pmaddwd (%%esi),%%mm0\n\t"
nick
parents:
diff changeset
226 "movq 8(%%edx),%%mm1\n\t"
nick
parents:
diff changeset
227 "pmaddwd 8(%%esi),%%mm1\n\t"
nick
parents:
diff changeset
228 "movq 16(%%edx),%%mm2\n\t"
nick
parents:
diff changeset
229 "pmaddwd 16(%%esi),%%mm2\n\t"
nick
parents:
diff changeset
230 "movq 24(%%edx),%%mm3\n\t"
nick
parents:
diff changeset
231 "pmaddwd 24(%%esi),%%mm3\n\t"
nick
parents:
diff changeset
232 "paddd %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
233 "paddd %%mm2,%%mm0\n\t"
nick
parents:
diff changeset
234 "paddd %%mm3,%%mm0\n\t"
nick
parents:
diff changeset
235 "movq %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
236 "psrlq $32,%%mm1\n\t"
nick
parents:
diff changeset
237 "paddd %%mm0,%%mm1\n\t"
nick
parents:
diff changeset
238 "psrad $13,%%mm1\n\t"
nick
parents:
diff changeset
239 "packssdw %%mm1,%%mm1\n\t"
nick
parents:
diff changeset
240 "psubd %%mm0,%%mm0\n\t"
nick
parents:
diff changeset
241 "psubsw %%mm1,%%mm0\n\t"
nick
parents:
diff changeset
242 "movd %%mm0,%%eax\n\t"
nick
parents:
diff changeset
243 "movw %%ax,(%%edi)\n\t"
nick
parents:
diff changeset
244 "emms\n\t"
nick
parents:
diff changeset
245 :
4322
2935211e4f9b Fixing compilation on non-MMX but x86 systems
nick
parents: 4246
diff changeset
246 :"m"(bandPtr),"m"(channel),"m"(samples),"m"(buffs),"m"(bo), "m"(temp)
22375
8092494fc92c Add missing registers to asm code in mp3lib
reimar
parents: 21046
diff changeset
247 :"memory","%edi","%esi","%eax","%ebx","%ecx","%edx","%esp");
4142
nick
parents:
diff changeset
248 }