Mercurial > mplayer.hg
annotate mp3lib/tabinit_MMX.c @ 21100:6bc989360c8b
check we aren't short of sh_videos before allocating another one
and fail if the allocation doesn't succeed;
added support for video stream switching
author | nicodvb |
---|---|
date | Mon, 20 Nov 2006 23:31:01 +0000 |
parents | d6e342ac2363 |
children |
rev | line source |
---|---|
4140 | 1 /* |
2 * This code was taken from http://www.mpg123.org | |
3 * See ChangeLog of mpg123-0.59s-pre.1 for detail | |
4 * Applied to mplayer by Nick Kurshev <nickols_k@mail.ru> | |
5 */ | |
16989 | 6 #include "config.h" |
7 #include "mangle.h" | |
4140 | 8 |
8560
1320f1b3229d
fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents:
8544
diff
changeset
|
9 long __attribute__((aligned(8))) mp3lib_decwins [544]; |
4140 | 10 |
8544 | 11 #define real float |
8560
1320f1b3229d
fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents:
8544
diff
changeset
|
12 extern real mp3lib_decwin[(512+32)]; |
8544 | 13 // static long decwin [544]; |
14 | |
12292 | 15 static short attribute_used intwinbase_MMX[] = |
4140 | 16 { |
17 0, -1, -1, -1, -1, -1, -1, -2, | |
18 -2, -2, -2, -3, -3, -4, -4, -5, | |
19 -5, -6, -7, -7, -8, -9, -10, -11, | |
20 -13, -14, -16, -17, -19, -21, -24, -26, | |
21 -29, -31, -35, -38, -41, -45, -49, -53, | |
22 -58, -63, -68, -73, -79, -85, -91, -97, | |
23 -104, -111, -117, -125, -132, -139, -147, -154, | |
24 -161, -169, -176, -183, -190, -196, -202, -208, | |
25 -213, -218, -222, -225, -227, -228, -228, -227, | |
26 -224, -221, -215, -208, -200, -189, -177, -163, | |
27 -146, -127, -106, -83, -57, -29, 2, 36, | |
28 72, 111, 153, 197, 244, 294, 347, 401, | |
29 459, 519, 581, 645, 711, 779, 848, 919, | |
30 991, 1064, 1137, 1210, 1283, 1356, 1428, 1498, | |
31 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962, | |
32 2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063, | |
33 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, | |
34 1414, 1280, 1131, 970, 794, 605, 402, 185, | |
35 -45, -288, -545, -814, -1095, -1388, -1692, -2006, | |
36 -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788, | |
37 -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, | |
38 -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585, | |
39 -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750, | |
40 -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134, | |
41 -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082, | |
42 -70, 998, 2122, 3300, 4533, 5818, 7154, 8540, | |
43 9975, 11455, 12980, 14548, 16155, 17799, 19478, 21189, | |
44 22929, 24694, 26482, 28289, 30112, 31947,-26209,-24360, | |
45 -22511,-20664,-18824,-16994,-15179,-13383,-11610, -9863, | |
46 -8147, -6466, -4822, -3222, -1667, -162, 1289, 2684, | |
47 4019, 5290, 6494, 7629, 8692, 9679, 10590, 11420, | |
48 12169, 12835, 13415, 13908, 14313, 14630, 14856, 14992, | |
49 15038 | |
50 }; | |
51 | |
12303
f881c918739b
attribute_used patch by (VMiklos <mamajom at axelero dot hu>)
michael
parents:
12292
diff
changeset
|
52 static long attribute_used intwindiv = 0x47800000; |
4140 | 53 |
54 void make_decode_tables_MMX(long scaleval) | |
55 { | |
4141 | 56 long intwinbase_step; |
57 intwinbase_step=2; | |
4140 | 58 scaleval =- scaleval; |
59 __asm __volatile( | |
60 "xorl %%ecx,%%ecx\n\t" | |
61 "xorl %%ebx,%%ebx\n\t" | |
62 "movl $32,%%esi\n\t" | |
63 "movl %0,%%edi\n\t" | |
64 ".L00:\n\t" | |
65 "cmpl $528,%%ecx\n\t" | |
66 "jnc .L02\n\t" | |
67 "movswl (%%edi),%%eax\n\t" | |
68 "cmpl %0+444,%%edi\n\t" | |
69 "jc .L01\n\t" | |
70 "addl $60000,%%eax\n\t" | |
71 ".L01:\n\t" | |
72 "pushl %%eax\n\t" | |
73 "fildl (%%esp)\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4141
diff
changeset
|
74 "fdivs "MANGLE(intwindiv)"\n\t" |
4140 | 75 "popl %%eax\n\t" |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
76 "fimull %1\n\t" |
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
77 "fsts "MANGLE(mp3lib_decwin)"(,%%ecx,4)\n\t" |
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
78 "fstps "MANGLE(mp3lib_decwin)"+64(,%%ecx,4)\n\t" |
4140 | 79 ".L02:\n\t" |
80 "leal -1(%%esi),%%edx\n\t" | |
81 "and %%ebx,%%edx\n\t" | |
82 "cmp $31,%%edx\n\t" | |
83 "jnz .L03\n\t" | |
84 "addl $-1023,%%ecx\n\t" | |
85 "test %%esi,%%ebx\n\t" | |
86 "jz .L03\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
87 "negl %1\n\t" |
4140 | 88 ".L03:\n\t" |
89 "addl %%esi,%%ecx\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
90 "addl %2,%%edi\n\t" |
4140 | 91 "incl %%ebx\n\t" |
92 "cmpl %0,%%edi\n\t" | |
93 "jz .L04\n\t" | |
94 "cmp $256,%%ebx\n\t" | |
95 "jnz .L00\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
96 "negl %2\n\t" |
4140 | 97 "jmp .L00\n\t" |
98 ".L04:\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
99 ::"g"(intwinbase_MMX),"m"(scaleval),"m"(intwinbase_step) |
21027
c26154fca245
Fix clobber list, half of the modified registers were missing.
reimar
parents:
16989
diff
changeset
|
100 :"memory","%eax","%ebx","%ecx","%edx","%esi","%edi"); |
4141 | 101 intwinbase_step=2; |
4140 | 102 __asm __volatile( |
103 "xorl %%ecx,%%ecx\n\t" | |
104 "xorl %%ebx,%%ebx\n\t" | |
105 ".L05:\n\t" | |
106 "cmpl $528,%%ecx\n\t" | |
107 "jnc .L11\n\t" | |
108 "movswl (%%edi),%%eax\n\t" | |
109 "cmpl %0+444,%%edi\n\t" | |
110 "jc .L06\n\t" | |
111 "addl $60000,%%eax\n\t" | |
112 ".L06:\n\t" | |
113 "cltd\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
114 "imull %1\n\t" |
4140 | 115 "shrdl $17,%%edx,%%eax\n\t" |
116 "cmpl $32767,%%eax\n\t" | |
117 "movl $1055,%%edx\n\t" | |
118 "jle .L07\n\t" | |
119 "movl $32767,%%eax\n\t" | |
120 "jmp .L08\n\t" | |
121 ".L07:\n\t" | |
122 "cmpl $-32767,%%eax\n\t" | |
123 "jge .L08\n\t" | |
124 "movl $-32767,%%eax\n\t" | |
125 ".L08:\n\t" | |
126 "cmpl $512,%%ecx\n\t" | |
127 "jnc .L09\n\t" | |
128 "subl %%ecx,%%edx\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
129 "movw %%ax,"MANGLE(mp3lib_decwins)"(,%%edx,2)\n\t" |
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
130 "movw %%ax,"MANGLE(mp3lib_decwins)"-32(,%%edx,2)\n\t" |
4140 | 131 ".L09:\n\t" |
132 "testl $1,%%ecx\n\t" | |
133 "jnz .L10\n\t" | |
134 "negl %%eax\n\t" | |
135 ".L10:\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
136 "movw %%ax,"MANGLE(mp3lib_decwins)"(,%%ecx,2)\n\t" |
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
137 "movw %%ax,"MANGLE(mp3lib_decwins)"+32(,%%ecx,2)\n\t" |
4140 | 138 ".L11:\n\t" |
139 "leal -1(%%esi),%%edx\n\t" | |
140 "and %%ebx,%%edx\n\t" | |
141 "cmp $31,%%edx\n\t" | |
142 "jnz .L12\n\t" | |
143 "addl $-1023,%%ecx\n\t" | |
144 "test %%esi,%%ebx\n\t" | |
145 "jz .L12\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
146 "negl %1\n\t" |
4140 | 147 ".L12:\n\t" |
148 "addl %%esi,%%ecx\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
149 "addl %2,%%edi\n\t" |
4140 | 150 "incl %%ebx\n\t" |
151 "cmpl %0,%%edi\n\t" | |
152 "jz .L13\n\t" | |
153 "cmp $256,%%ebx\n\t" | |
154 "jnz .L05\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
155 "negl %2\n\t" |
4140 | 156 "jmp .L05\n\t" |
157 ".L13:\n\t" | |
21044
d6e342ac2363
Avoid code like "fstps %1+64(,%%ecx,4)\n\t", it might end up as
reimar
parents:
21027
diff
changeset
|
158 ::"g"(intwinbase_MMX),"m"(scaleval),"m"(intwinbase_step) |
21027
c26154fca245
Fix clobber list, half of the modified registers were missing.
reimar
parents:
16989
diff
changeset
|
159 :"memory","%eax","%ebx","%ecx","%edx","%esi","%edi"); |
4140 | 160 } |