Parent Directory | Revision Log
Revision 1.3 - (view) (download)
1 : | Isibaar | 1.1 | ;/************************************************************************** |
2 : | ; * | ||
3 : | ; * XVID MPEG-4 VIDEO CODEC | ||
4 : | ; * mmx cbp calc | ||
5 : | ; * | ||
6 : | ; * This program is an implementation of a part of one or more MPEG-4 | ||
7 : | ; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
8 : | ; * to use this software module in hardware or software products are | ||
9 : | ; * advised that its use may infringe existing patents or copyrights, and | ||
10 : | ; * any such use would be at such party's own risk. The original | ||
11 : | ; * developer of this software module and his/her company, and subsequent | ||
12 : | ; * editors and their companies, will have no liability for use of this | ||
13 : | ; * software or modifications or derivatives thereof. | ||
14 : | ; * | ||
15 : | ; * This program is free software; you can redistribute it and/or modify | ||
16 : | ; * it under the terms of the GNU General Public License as published by | ||
17 : | ; * the Free Software Foundation; either version 2 of the License, or | ||
18 : | ; * (at your option) any later version. | ||
19 : | ; * | ||
20 : | ; * This program is distributed in the hope that it will be useful, | ||
21 : | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 : | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 : | ; * GNU General Public License for more details. | ||
24 : | ; * | ||
25 : | ; * You should have received a copy of the GNU General Public License | ||
26 : | ; * along with this program; if not, write to the Free Software | ||
27 : | ; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 : | ; * | ||
29 : | ; *************************************************************************/ | ||
30 : | |||
31 : | ;/************************************************************************** | ||
32 : | ; * | ||
33 : | ; * History: | ||
34 : | ; * | ||
35 : | h | 1.3 | ; * 17.04.2002 sse2 stuff |
36 : | ; * 22.03.2002 0.01 ; Min Chen <chenm001@163.com> | ||
37 : | ; * ; use 386 cpu's 'BTS' to replace 'cbp |= 1 << (edx-1)' | ||
38 : | Isibaar | 1.1 | ; * 24.11.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
39 : | ; * | ||
40 : | ; *************************************************************************/ | ||
41 : | |||
42 : | |||
43 : | bits 32 | ||
44 : | |||
45 : | section .data | ||
46 : | |||
47 : | %macro cglobal 1 | ||
48 : | %ifdef PREFIX | ||
49 : | global _%1 | ||
50 : | %define %1 _%1 | ||
51 : | %else | ||
52 : | global %1 | ||
53 : | %endif | ||
54 : | %endmacro | ||
55 : | |||
56 : | h | 1.3 | align 16 |
57 : | |||
58 : | ignore_dc dw 0, -1, -1, -1, -1, -1, -1, -1 | ||
59 : | Isibaar | 1.1 | |
60 : | |||
61 : | section .text | ||
62 : | |||
63 : | |||
64 : | ;=========================================================================== | ||
65 : | ; | ||
66 : | ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]); | ||
67 : | ; | ||
68 : | ;=========================================================================== | ||
69 : | |||
70 : | align 16 | ||
71 : | cglobal calc_cbp_mmx | ||
72 : | calc_cbp_mmx | ||
73 : | push ebx | ||
74 : | push ecx | ||
75 : | push edx | ||
76 : | push esi | ||
77 : | |||
78 : | mov esi, [esp + 16 + 4] ; coeff | ||
79 : | movq mm7, [ignore_dc] | ||
80 : | |||
81 : | xor eax, eax ; cbp = 0 | ||
82 : | mov edx, 6 | ||
83 : | .loop | ||
84 : | movq mm0, [esi] | ||
85 : | pand mm0, mm7 | ||
86 : | movq mm1, [esi+8] | ||
87 : | |||
88 : | por mm0, [esi+16] | ||
89 : | por mm1, [esi+24] | ||
90 : | |||
91 : | por mm0, [esi+32] | ||
92 : | por mm1, [esi+40] | ||
93 : | |||
94 : | por mm0, [esi+48] | ||
95 : | por mm1, [esi+56] | ||
96 : | |||
97 : | por mm0, [esi+64] | ||
98 : | por mm1, [esi+72] | ||
99 : | |||
100 : | por mm0, [esi+80] | ||
101 : | por mm1, [esi+88] | ||
102 : | |||
103 : | por mm0, [esi+96] | ||
104 : | por mm1, [esi+104] | ||
105 : | |||
106 : | por mm0, [esi+112] | ||
107 : | por mm1, [esi+120] | ||
108 : | |||
109 : | por mm0, mm1 | ||
110 : | movq mm1, mm0 | ||
111 : | psrlq mm1, 32 | ||
112 : | por mm0, mm1 | ||
113 : | movd ebx, mm0 | ||
114 : | |||
115 : | add esi, 128 | ||
116 : | |||
117 : | or ebx, ebx | ||
118 : | jz .iterate | ||
119 : | |||
120 : | ; cbp |= 1 << (edx-1) | ||
121 : | |||
122 : | chenm001 | 1.2 | ; Change by Chenm001 <chenm001@163.com> |
123 : | ;mov ecx, edx | ||
124 : | ;dec ecx | ||
125 : | ;mov ebx, 1 | ||
126 : | ;shl ebx, cl | ||
127 : | ;or eax, ebx | ||
128 : | lea ebx,[edx-1] | ||
129 : | bts eax,ebx | ||
130 : | Isibaar | 1.1 | |
131 : | .iterate dec edx | ||
132 : | jnz .loop | ||
133 : | |||
134 : | pop esi | ||
135 : | pop edx | ||
136 : | pop ecx | ||
137 : | pop ebx | ||
138 : | |||
139 : | h | 1.3 | ret |
140 : | |||
141 : | |||
142 : | |||
143 : | ;=========================================================================== | ||
144 : | ; | ||
145 : | ; uint32_t calc_cbp_sse2(const int16_t coeff[6][64]); | ||
146 : | ; | ||
147 : | ; not enabled - slower than mmx? | ||
148 : | ; | ||
149 : | ;=========================================================================== | ||
150 : | |||
151 : | align 16 | ||
152 : | cglobal calc_cbp_sse2 | ||
153 : | calc_cbp_sse2 | ||
154 : | push esi | ||
155 : | |||
156 : | mov esi, [esp + 4 + 4] ; coeff | ||
157 : | movdqa xmm7, [ignore_dc] ; mask to ignore dc value | ||
158 : | |||
159 : | xor eax, eax ; cbp = 0 | ||
160 : | pxor xmm6, xmm6 ; zeroes to help psadbw | ||
161 : | |||
162 : | .first movdqa xmm0, [esi] | ||
163 : | pand xmm0, xmm7 | ||
164 : | movdqa xmm1, [esi+16] | ||
165 : | |||
166 : | por xmm0, [esi+32] | ||
167 : | por xmm1, [esi+48] | ||
168 : | por xmm0, [esi+64] | ||
169 : | por xmm1, [esi+80] | ||
170 : | por xmm0, [esi+96] | ||
171 : | por xmm1, [esi+112] | ||
172 : | |||
173 : | por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info | ||
174 : | psadbw xmm0, xmm6 ; contains 2 dwords with sums | ||
175 : | movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1 | ||
176 : | por xmm0, xmm1 ; combine | ||
177 : | movd ecx, xmm0 ; if ecx set, values were found | ||
178 : | |||
179 : | add esi, 128 | ||
180 : | |||
181 : | or ecx, ecx | ||
182 : | jz .second | ||
183 : | |||
184 : | bts eax, 5 | ||
185 : | |||
186 : | .second movdqa xmm0, [esi] | ||
187 : | pand xmm0, xmm7 | ||
188 : | movdqa xmm1, [esi+16] | ||
189 : | |||
190 : | por xmm0, [esi+32] | ||
191 : | por xmm1, [esi+48] | ||
192 : | por xmm0, [esi+64] | ||
193 : | por xmm1, [esi+80] | ||
194 : | por xmm0, [esi+96] | ||
195 : | por xmm1, [esi+112] | ||
196 : | |||
197 : | por xmm0, xmm1 | ||
198 : | psadbw xmm0, xmm6 | ||
199 : | movhlps xmm1, xmm0 | ||
200 : | por xmm0, xmm1 | ||
201 : | movd ecx, xmm0 | ||
202 : | |||
203 : | add esi, 128 | ||
204 : | |||
205 : | or ecx, ecx | ||
206 : | jz .third | ||
207 : | |||
208 : | bts eax, 4 | ||
209 : | |||
210 : | .third movdqa xmm0, [esi] | ||
211 : | pand xmm0, xmm7 | ||
212 : | movdqa xmm1, [esi+16] | ||
213 : | |||
214 : | por xmm0, [esi+32] | ||
215 : | por xmm1, [esi+48] | ||
216 : | por xmm0, [esi+64] | ||
217 : | por xmm1, [esi+80] | ||
218 : | por xmm0, [esi+96] | ||
219 : | por xmm1, [esi+112] | ||
220 : | |||
221 : | por xmm0, xmm1 | ||
222 : | psadbw xmm0, xmm6 | ||
223 : | movhlps xmm1, xmm0 | ||
224 : | por xmm0, xmm1 | ||
225 : | movd ecx, xmm0 | ||
226 : | |||
227 : | add esi, 128 | ||
228 : | |||
229 : | or ecx, ecx | ||
230 : | jz .fourth | ||
231 : | |||
232 : | bts eax, 3 | ||
233 : | |||
234 : | .fourth movdqa xmm0, [esi] | ||
235 : | pand xmm0, xmm7 | ||
236 : | movdqa xmm1, [esi+16] | ||
237 : | |||
238 : | por xmm0, [esi+32] | ||
239 : | por xmm1, [esi+48] | ||
240 : | por xmm0, [esi+64] | ||
241 : | por xmm1, [esi+80] | ||
242 : | por xmm0, [esi+96] | ||
243 : | por xmm1, [esi+112] | ||
244 : | |||
245 : | por xmm0, xmm1 | ||
246 : | psadbw xmm0, xmm6 | ||
247 : | movhlps xmm1, xmm0 | ||
248 : | por xmm0, xmm1 | ||
249 : | movd ecx, xmm0 | ||
250 : | |||
251 : | add esi, 128 | ||
252 : | |||
253 : | or ecx, ecx | ||
254 : | jz .fifth | ||
255 : | |||
256 : | bts eax, 2 | ||
257 : | |||
258 : | .fifth movdqa xmm0, [esi] | ||
259 : | pand xmm0, xmm7 | ||
260 : | movdqa xmm1, [esi+16] | ||
261 : | |||
262 : | por xmm0, [esi+32] | ||
263 : | por xmm1, [esi+48] | ||
264 : | por xmm0, [esi+64] | ||
265 : | por xmm1, [esi+80] | ||
266 : | por xmm0, [esi+96] | ||
267 : | por xmm1, [esi+112] | ||
268 : | |||
269 : | por xmm0, xmm1 | ||
270 : | psadbw xmm0, xmm6 | ||
271 : | movhlps xmm1, xmm0 | ||
272 : | por xmm0, xmm1 | ||
273 : | movd ecx, xmm0 | ||
274 : | |||
275 : | add esi, 128 | ||
276 : | |||
277 : | or ecx, ecx | ||
278 : | jz .sixth | ||
279 : | |||
280 : | bts eax, 1 | ||
281 : | |||
282 : | .sixth movdqa xmm0, [esi] | ||
283 : | pand xmm0, xmm7 | ||
284 : | movdqa xmm1, [esi+16] | ||
285 : | |||
286 : | por xmm0, [esi+32] | ||
287 : | por xmm1, [esi+48] | ||
288 : | por xmm0, [esi+64] | ||
289 : | por xmm1, [esi+80] | ||
290 : | por xmm0, [esi+96] | ||
291 : | por xmm1, [esi+112] | ||
292 : | |||
293 : | por xmm0, xmm1 | ||
294 : | psadbw xmm0, xmm6 | ||
295 : | movhlps xmm1, xmm0 | ||
296 : | por xmm0, xmm1 | ||
297 : | movd ecx, xmm0 | ||
298 : | |||
299 : | or ecx, ecx | ||
300 : | jz .end | ||
301 : | |||
302 : | bts eax, 0 | ||
303 : | |||
304 : | .end pop esi | ||
305 : | |||
306 : | Isibaar | 1.1 | ret |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |