comparison decoders/libmpg123/tabinit_mmx.S @ 562:7e08477b0fc1

MP3 decoder upgrade work. Ripped out SMPEG and mpglib support, replaced it with "mpg123.c" and libmpg123. libmpg123 is a much better version of mpglib, so it should solve all the problems about MP3's not seeking, or most modern MP3's not playing at all, etc. Since you no longer have to make a tradeoff with SMPEG for features, and SMPEG is basically rotting, I removed it from the project. There is still work to be done with libmpg123...there are MMX, 3DNow, SSE, Altivec, etc decoders which we don't have enabled at the moment, and the build system could use some work to make this compile more cleanly, etc. Still: huge win.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 30 Jan 2009 02:44:47 -0500
parents
children
comparison
equal deleted inserted replaced
561:f2985e08589c 562:7e08477b0fc1
1 /*
2 tabinit_mmx: make_decode_tables_mmx
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
9 #include "mangle.h"
10
11 .data
12 ALIGN32
13 .globl ASM_NAME(costab_mmxsse)
14 ASM_NAME(costab_mmxsse):
15 .long 1056974725
16 .long 1057056395
17 .long 1057223771
18 .long 1057485416
19 .long 1057855544
20 .long 1058356026
21 .long 1059019886
22 .long 1059897405
23 .long 1061067246
24 .long 1062657950
25 .long 1064892987
26 .long 1066774581
27 .long 1069414683
28 .long 1073984175
29 .long 1079645762
30 .long 1092815430
31 .long 1057005197
32 .long 1057342072
33 .long 1058087743
34 .long 1059427869
35 .long 1061799040
36 .long 1065862217
37 .long 1071413542
38 .long 1084439708
39 .long 1057128951
40 .long 1058664893
41 .long 1063675095
42 .long 1076102863
43 .long 1057655764
44 .long 1067924853
45 .long 1060439283
46 ALIGN32
47 intwinbase:
48 .value 0, -1, -1, -1, -1, -1, -1, -2
49 .value -2, -2, -2, -3, -3, -4, -4, -5
50 .value -5, -6, -7, -7, -8, -9, -10, -11
51 .value -13, -14, -16, -17, -19, -21, -24, -26
52 .value -29, -31, -35, -38, -41, -45, -49, -53
53 .value -58, -63, -68, -73, -79, -85, -91, -97
54 .value -104, -111, -117, -125, -132, -139, -147, -154
55 .value -161, -169, -176, -183, -190, -196, -202, -208
56 .value -213, -218, -222, -225, -227, -228, -228, -227
57 .value -224, -221, -215, -208, -200, -189, -177, -163
58 .value -146, -127, -106, -83, -57, -29, 2, 36
59 .value 72, 111, 153, 197, 244, 294, 347, 401
60 .value 459, 519, 581, 645, 711, 779, 848, 919
61 .value 991, 1064, 1137, 1210, 1283, 1356, 1428, 1498
62 .value 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962
63 .value 2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063
64 .value 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535
65 .value 1414, 1280, 1131, 970, 794, 605, 402, 185
66 .value -45, -288, -545, -814, -1095, -1388, -1692, -2006
67 .value -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788
68 .value -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597
69 .value -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585
70 .value -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750
71 .value -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134
72 .value -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082
73 .value -70, 998, 2122, 3300, 4533, 5818, 7154, 8540
74 .value 9975, 11455, 12980, 14548, 16155, 17799, 19478, 21189
75 .value 22929, 24694, 26482, 28289, 30112, 31947,-26209,-24360
76 .value -22511,-20664,-18824,-16994,-15179,-13383,-11610, -9863
77 .value -8147, -6466, -4822, -3222, -1667, -162, 1289, 2684
78 .value 4019, 5290, 6494, 7629, 8692, 9679, 10590, 11420
79 .value 12169, 12835, 13415, 13908, 14313, 14630, 14856, 14992
80 .value 15038
81
82 intwindiv:
83 .long 0x47800000 # 65536.0
84 .text
85 ALIGN32
86 /* void make_decode_tables_mmx_asm(long scaleval, float* decwin_mmx, float *decwins); */
87 .globl ASM_NAME(make_decode_tables_mmx_asm)
88 ASM_NAME(make_decode_tables_mmx_asm):
89 pushl %edi
90 pushl %esi
91 pushl %ebx
92 /* stack: 0=ebx, 4=esi, 8=edi, 12=back, 16=scaleval, 20=decwin_mmx, 24=decwins */
93
94 xorl %ecx,%ecx
95 xorl %ebx,%ebx
96 movl $32,%esi
97 movl $intwinbase,%edi
98 negl 16(%esp) /* scaleval */
99 pushl $2 /* intwinbase step */
100 /* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
101 .L00:
102 cmpl $528,%ecx
103 jnc .L02
104 movswl (%edi),%eax
105 cmpl $intwinbase+444,%edi
106 jc .L01
107 addl $60000,%eax
108 .L01:
109 pushl %eax
110 /* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
111 fildl (%esp)
112 fdivs intwindiv
113 fimull 24(%esp) /* scaleval */
114 /* eax used to be popped the line before... I'll just use it here a bit */
115 movl 28(%esp),%eax /* decwin_mmx */
116 fsts (%eax,%ecx,4)
117 fstps 64(%eax,%ecx,4)
118 popl %eax
119 /* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
120 .L02:
121 leal -1(%esi),%edx
122 and %ebx,%edx
123 cmp $31,%edx
124 jnz .L03
125 addl $-1023,%ecx
126 test %esi,%ebx
127 jz .L03
128 negl 20(%esp)
129 .L03:
130 addl %esi,%ecx
131 addl (%esp),%edi
132 incl %ebx
133 cmpl $intwinbase,%edi
134 jz .L04
135 cmp $256,%ebx
136 jnz .L00
137 negl (%esp)
138 jmp .L00
139 .L04:
140 popl %eax
141
142 xorl %ecx,%ecx
143 xorl %ebx,%ebx
144 pushl $2 /* paired with popl above */
145 .L05:
146 cmpl $528,%ecx
147 jnc .L11
148 movswl (%edi),%eax
149 cmpl $intwinbase+444,%edi
150 jc .L06
151 addl $60000,%eax
152 .L06:
153 cltd
154 imull 20(%esp)
155 shrdl $17,%edx,%eax
156 cmpl $32767,%eax
157 movl $1055,%edx
158 jle .L07
159 movl $32767,%eax
160 jmp .L08
161 .L07:
162 cmpl $-32767,%eax
163 jge .L08
164 movl $-32767,%eax
165 .L08:
166 /* going to use ebx for decwins, watch the jumps */
167 pushl %ebx
168 /* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
169 movl 32(%esp),%ebx
170 cmpl $512,%ecx
171 jnc .L09
172 subl %ecx,%edx
173 movw %ax,(%ebx,%edx,2) /* decwins */
174 movw %ax,-32(%ebx,%edx,2)
175 .L09:
176 testl $1,%ecx
177 jnz .L10
178 negl %eax
179 .L10:
180 movw %ax,(%ebx,%ecx,2)
181 movw %ax,32(%ebx,%ecx,2)
182 popl %ebx /* that has to match the pushl before */
183 .L11:
184 leal -1(%esi),%edx
185 and %ebx,%edx
186 cmp $31,%edx
187 jnz .L12
188 addl $-1023,%ecx
189 test %esi,%ebx
190 jz .L12
191 negl 20(%esp)
192 .L12:
193 addl %esi,%ecx
194 addl (%esp),%edi
195 incl %ebx
196 cmpl $intwinbase,%edi
197 jz .L13
198 cmp $256,%ebx
199 jnz .L05
200 negl (%esp)
201 jmp .L05
202 .L13:
203 popl %eax
204
205 popl %ebx
206 popl %esi
207 popl %edi
208 ret
209
210 /* Mark non-executable stack. */
211 #if defined(__linux__) && defined(__ELF__)
212 .section .note.GNU-stack,"",%progbits
213 #endif