annotate mp3lib/tabinit_MMX.c @ 10217:1f3935c55e6f

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