Debian Codegraph @

src/libmpg123/synth_mmx.S

raw
1 /*
2 synth_mmx: MMX optimized synth
3
4 copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by the mysterious higway (apparently)
7
8 Thomas' notes about the LGPL transition:
9
10 Initially, I found the note "this code comes under GPL" in this file.
11 After asking Michael Hipp about legal status of the MMX files, he said
12 that he received them without any comment and thus I believe that the GPL
13 comment was made by Michael, since he made mpg123 GPL at some time - and
14 marked some files that way, but not all. The contributer accepted the
15 license terms of mpg123 back then, which included Michael deciding on
16 license issues.
17
18 Based on that thought, I now consider this file along with the other parts
19 of higway's MMX optimisation to be licensed under LGPL 2.1 by Michael's
20 decision.
21 */
22
23 #include "mangle.h"
24
25 .text
26
27 .globl ASM_NAME(INT123_synth_1to1_MMX)
28 /* int synth_1to1_MMX(real *bandPtr, int channel, short *out, short *buffs, int *bo, float *decwins); */
29 ASM_NAME(INT123_synth_1to1_MMX):
30 pushl %ebp
31 pushl %edi
32 pushl %esi
33 pushl %ebx
34 /* stack: 0=ebx, 4=esi, 8=edi, 12=ebp, 16=back, 20=bandPtr, 24=channel, 28=out, 32=buffs, 36=bo, 40=decwins */
35 movl 24(%esp),%ecx
36 movl 28(%esp),%edi
37 movl $15,%ebx
38 movl 36(%esp),%edx
39 leal (%edi,%ecx,2),%edi
40 decl %ecx
41 movl 32(%esp),%esi
42 movl (%edx),%eax
43 jecxz 1f
44 decl %eax
45 andl %ebx,%eax
46 leal 1088(%esi),%esi
47 movl %eax,(%edx)
48 1:
49 leal (%esi,%eax,2),%edx
50 movl %eax,%ebp
51 incl %eax
52 pushl 20(%esp)
53 andl %ebx,%eax
54 leal 544(%esi,%eax,2),%ecx
55 incl %ebx
56 testl $1, %eax
57 jnz 2f
58 xchgl %edx,%ecx
59 incl %ebp
60 leal 544(%esi),%esi
61 2:
62 pushl %edx
63 pushl %ecx
64 call FUNC(INT123_dct64_MMX)
65 addl $12,%esp
66 /* stack like before, pushed 3, incremented again */
67 leal 1(%ebx), %ecx
68 subl %ebp,%ebx
69 pushl %eax
70 movl 44(%esp),%eax /* decwins */
71 leal (%eax,%ebx,2), %edx
72 popl %eax
73 3:
74 movq (%edx),%mm0
75 pmaddwd (%esi),%mm0
76 movq 8(%edx),%mm1
77 pmaddwd 8(%esi),%mm1
78 movq 16(%edx),%mm2
79 pmaddwd 16(%esi),%mm2
80 movq 24(%edx),%mm3
81 pmaddwd 24(%esi),%mm3
82 paddd %mm1,%mm0
83 paddd %mm2,%mm0
84 paddd %mm3,%mm0
85 movq %mm0,%mm1
86 psrlq $32,%mm1
87 paddd %mm1,%mm0
88 psrad $13,%mm0
89 packssdw %mm0,%mm0
90 movd %mm0,%eax
91 movw %ax, (%edi)
92
93 leal 32(%esi),%esi
94 leal 64(%edx),%edx
95 leal 4(%edi),%edi
96 loop 3b
97
98
99 subl $64,%esi
100 movl $15,%ecx
101 4:
102 movq (%edx),%mm0
103 pmaddwd (%esi),%mm0
104 movq 8(%edx),%mm1
105 pmaddwd 8(%esi),%mm1
106 movq 16(%edx),%mm2
107 pmaddwd 16(%esi),%mm2
108 movq 24(%edx),%mm3
109 pmaddwd 24(%esi),%mm3
110 paddd %mm1,%mm0
111 paddd %mm2,%mm0
112 paddd %mm3,%mm0
113 movq %mm0,%mm1
114 psrlq $32,%mm1
115 paddd %mm0,%mm1
116 psrad $13,%mm1
117 packssdw %mm1,%mm1
118 psubd %mm0,%mm0
119 psubsw %mm1,%mm0
120 movd %mm0,%eax
121 movw %ax,(%edi)
122
123 subl $32,%esi
124 addl $64,%edx
125 leal 4(%edi),%edi
126 loop 4b
127 emms
128 popl %ebx
129 popl %esi
130 popl %edi
131 popl %ebp
132 ret
133
134 #if defined(PIC) && defined(__APPLE__)
135 .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
136 FUNC(INT123_dct64_MMX):
137 .indirect_symbol ASM_NAME(INT123_dct64_MMX)
138 hlt ; hlt ; hlt ; hlt ; hlt
139 #endif
140
141 NONEXEC_STACK