[svn] / trunk / xvidcore / src / utils / x86_asm / mem_transfer_mmx.asm Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/utils/x86_asm/mem_transfer_mmx.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (view) (download)

1 : Isibaar 3 ;/**************************************************************************
2 :     ; *
3 :     ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * mmx 8bit<->16bit transfers
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 :     ; * 07.01.2002 merge functions from compensate_mmx; rename functions
36 :     ; * 07.11.2001 initial version; (c)2001 peter ross <pross@cs.rmit.edu.au>
37 :     ; *
38 :     ; *************************************************************************/
39 :    
40 :    
41 :     bits 32
42 :    
43 :     %macro cglobal 1
44 :     %ifdef PREFIX
45 :     global _%1
46 :     %define %1 _%1
47 :     %else
48 :     global %1
49 :     %endif
50 :     %endmacro
51 :    
52 :    
53 :     section .text
54 :    
55 :    
56 :     ;===========================================================================
57 :     ;
58 :     ; void transfer_8to16copy_mmx(int16_t * const dst,
59 :     ; const uint8_t * const src,
60 :     ; uint32_t stride);
61 :     ;
62 :     ;===========================================================================
63 :    
64 :     align 16
65 :     cglobal transfer_8to16copy_mmx
66 :     transfer_8to16copy_mmx
67 :    
68 :     push esi
69 :     push edi
70 :    
71 :     mov edi, [esp + 8 + 4] ; dst
72 :     mov esi, [esp + 8 + 8] ; src
73 :     mov ecx, [esp + 8 + 12] ; stride
74 :    
75 :     pxor mm7, mm7 ; mm7 = zero
76 :    
77 :     mov eax, 8
78 :    
79 :     .loop
80 :     movq mm0, [esi]
81 :     movq mm1, mm0
82 :     punpcklbw mm0, mm7 ; mm01 = unpack([src])
83 :     punpckhbw mm1, mm7
84 :    
85 :     movq [edi], mm0 ; [dst] = mm01
86 :     movq [edi + 8], mm1
87 :    
88 :     add edi, 16
89 :     add esi, ecx
90 :     dec eax
91 :     jnz .loop
92 :    
93 :     pop edi
94 :     pop esi
95 :    
96 :     ret
97 :    
98 :    
99 :    
100 :     ;===========================================================================
101 :     ;
102 :     ; void transfer_16to8copy_mmx(uint8_t * const dst,
103 :     ; const int16_t * const src,
104 :     ; uint32_t stride);
105 :     ;
106 :     ;===========================================================================
107 :    
108 :     align 16
109 :     cglobal transfer_16to8copy_mmx
110 :     transfer_16to8copy_mmx
111 :    
112 :     push esi
113 :     push edi
114 :    
115 :     mov edi, [esp + 8 + 4] ; dst
116 :     mov esi, [esp + 8 + 8] ; src
117 :     mov ecx, [esp + 8 + 12] ; stride
118 :    
119 :     mov eax, 8
120 :    
121 :     .loop
122 :     movq mm0, [esi]
123 :     packuswb mm0, [esi + 8] ; mm0 = pack([src])
124 :    
125 :     movq [edi], mm0 ; [dst] = mm0
126 :    
127 :     add esi, 16
128 :     add edi, ecx
129 :     dec eax
130 :     jnz .loop
131 :    
132 :     pop edi
133 :     pop esi
134 :    
135 :     ret
136 :    
137 :    
138 :     ;===========================================================================
139 :     ;
140 :     ; void transfer_8to16sub_mmx(int16_t * const dct,
141 :     ; uint8_t * const cur,
142 :     ; const uint8_t * const ref,
143 :     ; const uint32_t stride);
144 :     ;
145 :     ;===========================================================================
146 :     ;/**************************************************************************
147 :     ; *
148 :     ; * History:
149 :     ; *
150 :     ; * 27.12.2001 renamed from 'compensate' to 'transfer_8to16sub'
151 :     ; * 02.12.2001 loop unrolled, code runs 10% faster now (Isibaar)
152 :     ; * 30.11.2001 16 pixels are processed per iteration (Isibaar)
153 :     ; * 30.11.2001 .text missing
154 :     ; * 06.11.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>
155 :     ; *
156 :     ; *************************************************************************/
157 :    
158 :     align 16
159 :     cglobal transfer_8to16sub_mmx
160 :     transfer_8to16sub_mmx
161 :     push esi
162 :     push edi
163 :     push ebx
164 :    
165 :     mov edi, [esp + 12 + 4] ; dct [out]
166 :     mov edx, [esp + 12 + 8] ; cur [in/out]
167 :     mov esi, [esp + 12 + 12] ; ref [in]
168 :     mov ecx, [esp + 12 + 16] ; stride [in]
169 :    
170 :     mov eax, edx ; cur -> eax
171 :     mov ebx, esi ; ref -> ebx
172 :     add eax, ecx ; cur + stride
173 :     add ebx, ecx ; ref + stride
174 :    
175 :     shl ecx, 1
176 :    
177 :     pxor mm7, mm7 ; mm7 = zero
178 :    
179 :     movq mm0, [edx] ; mm01 = [cur]
180 :     movq mm1, mm0
181 :    
182 :     punpcklbw mm0, mm7
183 :     punpckhbw mm1, mm7
184 :    
185 :     movq mm4, [eax]
186 :     movq mm5, mm4
187 :    
188 :     punpcklbw mm4, mm7
189 :     punpckhbw mm5, mm7
190 :    
191 :     movq mm2, [esi] ; mm23 = [ref]
192 :     movq mm3, mm2
193 :    
194 :     movq mm6, [ebx]
195 :    
196 :     movq [edx], mm2 ; [cur] = [ref]
197 :     movq [eax], mm6
198 :    
199 :     punpcklbw mm2, mm7
200 :     punpckhbw mm3, mm7
201 :    
202 :     psubsw mm0, mm2 ; mm01 -= mm23
203 :    
204 :     movq mm2, mm6
205 :    
206 :     punpcklbw mm2, mm7
207 :     punpckhbw mm6, mm7
208 :    
209 :     psubsw mm1, mm3
210 :    
211 :     psubsw mm4, mm2
212 :     psubsw mm5, mm6
213 :    
214 :     movq [edi], mm0 ; dct[] = mm01
215 :     movq [edi + 8], mm1
216 :     movq [edi + 16], mm4
217 :     movq [edi + 24], mm5
218 :    
219 :     add edx, ecx
220 :     add esi, ecx
221 :     add eax, ecx
222 :     add ebx, ecx
223 :    
224 :     movq mm0, [edx] ; mm01 = [cur]
225 :     movq mm1, mm0
226 :    
227 :     punpcklbw mm0, mm7
228 :     punpckhbw mm1, mm7
229 :    
230 :     movq mm4, [eax]
231 :     movq mm5, mm4
232 :    
233 :     punpcklbw mm4, mm7
234 :     punpckhbw mm5, mm7
235 :    
236 :     movq mm2, [esi] ; mm23 = [ref]
237 :     movq mm3, mm2
238 :    
239 :     movq mm6, [ebx]
240 :    
241 :     movq [edx], mm2 ; [cur] = [ref]
242 :     movq [eax], mm6
243 :    
244 :     punpcklbw mm2, mm7
245 :     punpckhbw mm3, mm7
246 :    
247 :     psubsw mm0, mm2 ; mm01 -= mm23
248 :    
249 :     movq mm2, mm6
250 :    
251 :     punpcklbw mm2, mm7
252 :     punpckhbw mm6, mm7
253 :    
254 :     psubsw mm1, mm3
255 :    
256 :     psubsw mm4, mm2
257 :     psubsw mm5, mm6
258 :    
259 :     movq [edi + 32], mm0 ; dct[] = mm01
260 :     movq [edi + 40], mm1
261 :     movq [edi + 48], mm4
262 :     movq [edi + 56], mm5
263 :    
264 :     add edx, ecx
265 :     add esi, ecx
266 :     add eax, ecx
267 :     add ebx, ecx
268 :    
269 :     movq mm0, [edx] ; mm01 = [cur]
270 :     movq mm1, mm0
271 :    
272 :     punpcklbw mm0, mm7
273 :     punpckhbw mm1, mm7
274 :    
275 :     movq mm4, [eax]
276 :     movq mm5, mm4
277 :    
278 :     punpcklbw mm4, mm7
279 :     punpckhbw mm5, mm7
280 :    
281 :     movq mm2, [esi] ; mm23 = [ref]
282 :     movq mm3, mm2
283 :    
284 :     movq mm6, [ebx]
285 :    
286 :     movq [edx], mm2 ; [cur] = [ref]
287 :     movq [eax], mm6
288 :    
289 :     punpcklbw mm2, mm7
290 :     punpckhbw mm3, mm7
291 :    
292 :     psubsw mm0, mm2 ; mm01 -= mm23
293 :    
294 :     movq mm2, mm6
295 :    
296 :     punpcklbw mm2, mm7
297 :     punpckhbw mm6, mm7
298 :    
299 :     psubsw mm1, mm3
300 :    
301 :     psubsw mm4, mm2
302 :     psubsw mm5, mm6
303 :    
304 :     movq [edi + 64], mm0 ; dct[] = mm01
305 :     movq [edi + 72], mm1
306 :     movq [edi + 80], mm4
307 :     movq [edi + 88], mm5
308 :    
309 :     add edx, ecx
310 :     add esi, ecx
311 :     add eax, ecx
312 :     add ebx, ecx
313 :    
314 :     movq mm0, [edx] ; mm01 = [cur]
315 :     movq mm1, mm0
316 :    
317 :     punpcklbw mm0, mm7
318 :     punpckhbw mm1, mm7
319 :    
320 :     movq mm4, [eax]
321 :     movq mm5, mm4
322 :    
323 :     punpcklbw mm4, mm7
324 :     punpckhbw mm5, mm7
325 :    
326 :     movq mm2, [esi] ; mm23 = [ref]
327 :     movq mm3, mm2
328 :    
329 :     movq mm6, [ebx]
330 :    
331 :     movq [edx], mm2 ; [cur] = [ref]
332 :     movq [eax], mm6
333 :    
334 :     punpcklbw mm2, mm7
335 :     punpckhbw mm3, mm7
336 :    
337 :     psubsw mm0, mm2 ; mm01 -= mm23
338 :    
339 :     movq mm2, mm6
340 :    
341 :     punpcklbw mm2, mm7
342 :     punpckhbw mm6, mm7
343 :    
344 :     psubsw mm1, mm3
345 :    
346 :     psubsw mm4, mm2
347 :     psubsw mm5, mm6
348 :    
349 :     movq [edi + 96], mm0 ; dct[] = mm01
350 :     movq [edi + 104], mm1
351 :     movq [edi + 112], mm4
352 :     movq [edi + 120], mm5
353 :    
354 :     pop ebx
355 :     pop edi
356 :     pop esi
357 :    
358 :     ret
359 :    
360 :    
361 :    
362 :     ;===========================================================================
363 :     ;
364 :     ; void transfer_16to8add_mmx(uint8_t * const dst,
365 :     ; const int16_t * const src,
366 :     ; uint32_t stride);
367 :     ;
368 :     ;===========================================================================
369 :    
370 :     align 16
371 :     cglobal transfer_16to8add_mmx
372 :     transfer_16to8add_mmx
373 :    
374 :     push esi
375 :     push edi
376 :    
377 :     mov edi, [esp + 8 + 4] ; dst
378 :     mov esi, [esp + 8 + 8] ; src
379 :     mov ecx, [esp + 8 + 12] ; stride
380 :    
381 :     pxor mm7, mm7
382 :    
383 :     mov eax, 8
384 :    
385 :     .loop
386 :     movq mm0, [edi]
387 :     movq mm1, mm0
388 :     punpcklbw mm0, mm7 ; mm23 = unpack([dst])
389 :     punpckhbw mm1, mm7
390 :    
391 :     movq mm2, [esi] ; mm01 = [src]
392 :     movq mm3, [esi + 8]
393 :    
394 :     paddsw mm0, mm2 ; mm01 += mm23
395 :     paddsw mm1, mm3
396 :    
397 :     packuswb mm0, mm1 ; [dst] = pack(mm01)
398 :     movq [edi], mm0
399 :    
400 :     add esi, 16
401 :     add edi, ecx
402 :     dec eax
403 :     jnz .loop
404 :    
405 :     pop edi
406 :     pop esi
407 :    
408 :     ret
409 :    
410 :    
411 :     ;===========================================================================
412 :     ;
413 :     ; void transfer8x8_copy_mmx(uint8_t * const dst,
414 :     ; const uint8_t * const src,
415 :     ; const uint32_t stride);
416 :     ;
417 :     ;
418 :     ;===========================================================================
419 :    
420 :     align 16
421 :     cglobal transfer8x8_copy_mmx
422 :     transfer8x8_copy_mmx
423 :     push esi
424 :     push edi
425 :    
426 :     mov edi, [esp + 8 + 4] ; dst [out]
427 :     mov esi, [esp + 8 + 8] ; src [in]
428 :     mov eax, [esp + 8 + 12] ; stride [in]
429 :    
430 :     movq mm0, [esi]
431 :     movq mm1, [esi+eax]
432 :     movq [edi], mm0
433 :     movq [edi+eax], mm1
434 :    
435 :     add esi, eax
436 :     add edi, eax
437 :     add esi, eax
438 :     add edi, eax
439 :    
440 :     movq mm0, [esi]
441 :     movq mm1, [esi+eax]
442 :     movq [edi], mm0
443 :     movq [edi+eax], mm1
444 :    
445 :     add esi, eax
446 :     add edi, eax
447 :     add esi, eax
448 :     add edi, eax
449 :    
450 :     movq mm0, [esi]
451 :     movq mm1, [esi+eax]
452 :     movq [edi], mm0
453 :     movq [edi+eax], mm1
454 :    
455 :     add esi, eax
456 :     add edi, eax
457 :     add esi, eax
458 :     add edi, eax
459 :    
460 :     movq mm0, [esi]
461 :     movq mm1, [esi+eax]
462 :     movq [edi], mm0
463 :     movq [edi+eax], mm1
464 :    
465 :     add esi, eax
466 :     add edi, eax
467 :     add esi, eax
468 :     add edi, eax
469 :    
470 :     pop edi
471 :     pop esi
472 :    
473 :     ret

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4