Mercurial > mplayer.hg
comparison mp3lib/tabinit_MMX.c @ 4140:3b8c2f67ab4f
S->C
author | nick |
---|---|
date | Sun, 13 Jan 2002 16:59:18 +0000 |
parents | |
children | ee1687319436 |
comparison
equal
deleted
inserted
replaced
4139:13d6395e8daa | 4140:3b8c2f67ab4f |
---|---|
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 */ | |
6 | |
7 long __attribute__((aligned(8))) decwins [544]; | |
8 | |
9 static long decwin [544]; | |
10 static short intwinbase_MMX[] = | |
11 { | |
12 0, -1, -1, -1, -1, -1, -1, -2, | |
13 -2, -2, -2, -3, -3, -4, -4, -5, | |
14 -5, -6, -7, -7, -8, -9, -10, -11, | |
15 -13, -14, -16, -17, -19, -21, -24, -26, | |
16 -29, -31, -35, -38, -41, -45, -49, -53, | |
17 -58, -63, -68, -73, -79, -85, -91, -97, | |
18 -104, -111, -117, -125, -132, -139, -147, -154, | |
19 -161, -169, -176, -183, -190, -196, -202, -208, | |
20 -213, -218, -222, -225, -227, -228, -228, -227, | |
21 -224, -221, -215, -208, -200, -189, -177, -163, | |
22 -146, -127, -106, -83, -57, -29, 2, 36, | |
23 72, 111, 153, 197, 244, 294, 347, 401, | |
24 459, 519, 581, 645, 711, 779, 848, 919, | |
25 991, 1064, 1137, 1210, 1283, 1356, 1428, 1498, | |
26 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962, | |
27 2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063, | |
28 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, | |
29 1414, 1280, 1131, 970, 794, 605, 402, 185, | |
30 -45, -288, -545, -814, -1095, -1388, -1692, -2006, | |
31 -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788, | |
32 -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, | |
33 -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585, | |
34 -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750, | |
35 -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134, | |
36 -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082, | |
37 -70, 998, 2122, 3300, 4533, 5818, 7154, 8540, | |
38 9975, 11455, 12980, 14548, 16155, 17799, 19478, 21189, | |
39 22929, 24694, 26482, 28289, 30112, 31947,-26209,-24360, | |
40 -22511,-20664,-18824,-16994,-15179,-13383,-11610, -9863, | |
41 -8147, -6466, -4822, -3222, -1667, -162, 1289, 2684, | |
42 4019, 5290, 6494, 7629, 8692, 9679, 10590, 11420, | |
43 12169, 12835, 13415, 13908, 14313, 14630, 14856, 14992, | |
44 15038 | |
45 }; | |
46 | |
47 static long intwindiv = 0x47800000; | |
48 | |
49 void make_decode_tables_MMX(long scaleval) | |
50 { | |
51 long intwinbase_step = 2; | |
52 scaleval =- scaleval; | |
53 __asm __volatile( | |
54 "xorl %%ecx,%%ecx\n\t" | |
55 "xorl %%ebx,%%ebx\n\t" | |
56 "movl $32,%%esi\n\t" | |
57 "movl %0,%%edi\n\t" | |
58 ".L00:\n\t" | |
59 "cmpl $528,%%ecx\n\t" | |
60 "jnc .L02\n\t" | |
61 "movswl (%%edi),%%eax\n\t" | |
62 "cmpl %0+444,%%edi\n\t" | |
63 "jc .L01\n\t" | |
64 "addl $60000,%%eax\n\t" | |
65 ".L01:\n\t" | |
66 "pushl %%eax\n\t" | |
67 "fildl (%%esp)\n\t" | |
68 "fdivs intwindiv\n\t" | |
69 "popl %%eax\n\t" | |
70 "fimull %2\n\t" | |
71 "fsts %1(,%%ecx,4)\n\t" | |
72 "fstps %1+64(,%%ecx,4)\n\t" | |
73 ".L02:\n\t" | |
74 "leal -1(%%esi),%%edx\n\t" | |
75 "and %%ebx,%%edx\n\t" | |
76 "cmp $31,%%edx\n\t" | |
77 "jnz .L03\n\t" | |
78 "addl $-1023,%%ecx\n\t" | |
79 "test %%esi,%%ebx\n\t" | |
80 "jz .L03\n\t" | |
81 "negl %2\n\t" | |
82 ".L03:\n\t" | |
83 "addl %%esi,%%ecx\n\t" | |
84 "addl %3,%%edi\n\t" | |
85 "incl %%ebx\n\t" | |
86 "cmpl %0,%%edi\n\t" | |
87 "jz .L04\n\t" | |
88 "cmp $256,%%ebx\n\t" | |
89 "jnz .L00\n\t" | |
90 "negl %3\n\t" | |
91 "jmp .L00\n\t" | |
92 ".L04:\n\t" | |
93 ::"g"(intwinbase_MMX),"m"(decwin[0]),"m"(scaleval),"m"(intwinbase_step) | |
94 :"memory","%ebx","%esi","%edi"); | |
95 | |
96 __asm __volatile( | |
97 "xorl %%ecx,%%ecx\n\t" | |
98 "xorl %%ebx,%%ebx\n\t" | |
99 ".L05:\n\t" | |
100 "cmpl $528,%%ecx\n\t" | |
101 "jnc .L11\n\t" | |
102 "movswl (%%edi),%%eax\n\t" | |
103 "cmpl %0+444,%%edi\n\t" | |
104 "jc .L06\n\t" | |
105 "addl $60000,%%eax\n\t" | |
106 ".L06:\n\t" | |
107 "cltd\n\t" | |
108 "imull %2\n\t" | |
109 "shrdl $17,%%edx,%%eax\n\t" | |
110 "cmpl $32767,%%eax\n\t" | |
111 "movl $1055,%%edx\n\t" | |
112 "jle .L07\n\t" | |
113 "movl $32767,%%eax\n\t" | |
114 "jmp .L08\n\t" | |
115 ".L07:\n\t" | |
116 "cmpl $-32767,%%eax\n\t" | |
117 "jge .L08\n\t" | |
118 "movl $-32767,%%eax\n\t" | |
119 ".L08:\n\t" | |
120 "cmpl $512,%%ecx\n\t" | |
121 "jnc .L09\n\t" | |
122 "subl %%ecx,%%edx\n\t" | |
123 "movw %%ax,%1(,%%edx,2)\n\t" | |
124 "movw %%ax,%1-32(,%%edx,2)\n\t" | |
125 ".L09:\n\t" | |
126 "testl $1,%%ecx\n\t" | |
127 "jnz .L10\n\t" | |
128 "negl %%eax\n\t" | |
129 ".L10:\n\t" | |
130 "movw %%ax,%1(,%%ecx,2)\n\t" | |
131 "movw %%ax,%1+32(,%%ecx,2)\n\t" | |
132 ".L11:\n\t" | |
133 "leal -1(%%esi),%%edx\n\t" | |
134 "and %%ebx,%%edx\n\t" | |
135 "cmp $31,%%edx\n\t" | |
136 "jnz .L12\n\t" | |
137 "addl $-1023,%%ecx\n\t" | |
138 "test %%esi,%%ebx\n\t" | |
139 "jz .L12\n\t" | |
140 "negl %2\n\t" | |
141 ".L12:\n\t" | |
142 "addl %%esi,%%ecx\n\t" | |
143 "addl %3,%%edi\n\t" | |
144 "incl %%ebx\n\t" | |
145 "cmpl %0,%%edi\n\t" | |
146 "jz .L13\n\t" | |
147 "cmp $256,%%ebx\n\t" | |
148 "jnz .L05\n\t" | |
149 "negl %3\n\t" | |
150 "jmp .L05\n\t" | |
151 ".L13:\n\t" | |
152 ::"g"(intwinbase_MMX),"m"(decwins[0]),"m"(scaleval),"m"(intwinbase_step) | |
153 :"memory","%ebx","%esi","%edi"); | |
154 } |