1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * mmx 8bit<->16bit transfers |
; * - 8<->16 bit transfer functions - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright (C) 2001 Peter Ross <pross@xvid.org> |
7 |
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
; * 2001 Michael Militzer <isibaar@xvid.org> |
8 |
; * to use this software module in hardware or software products are |
; * 2002 Pascal Massimino <skal@planet-d.net> |
|
; * advised that its use may infringe existing patents or copyrights, and |
|
|
; * any such use would be at such party's own risk. The original |
|
|
; * developer of this software module and his/her company, and subsequent |
|
|
; * editors and their companies, will have no liability for use of this |
|
|
; * software or modifications or derivatives thereof. |
|
9 |
; * |
; * |
10 |
; * This program is free software; you can redistribute it and/or modify |
; * This program is free software; you can redistribute it and/or modify |
11 |
; * it under the terms of the GNU General Public License as published by |
; * it under the terms of the GNU General Public License as published by |
19 |
; * |
; * |
20 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
21 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
22 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
; * |
; * |
24 |
; *************************************************************************/ |
; * $Id$ |
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
25 |
; * |
; * |
26 |
; * 04.06.2002 speed enhancement (unroll+overlap). -Skal- |
; ***************************************************************************/ |
|
; * + added transfer_8to16sub2_mmx/xmm |
|
|
; * 07.01.2002 merge functions from compensate_mmx; rename functions |
|
|
; * 07.11.2001 initial version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
|
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
27 |
|
|
28 |
bits 32 |
BITS 32 |
29 |
|
|
30 |
%macro cglobal 1 |
%macro cglobal 1 |
31 |
%ifdef PREFIX |
%ifdef PREFIX |
36 |
%endif |
%endif |
37 |
%endmacro |
%endmacro |
38 |
|
|
39 |
|
;============================================================================= |
40 |
|
; Code |
41 |
|
;============================================================================= |
42 |
|
|
43 |
section .text |
SECTION .text |
44 |
|
|
45 |
cglobal transfer_8to16copy_mmx |
cglobal transfer_8to16copy_mmx |
46 |
cglobal transfer_16to8copy_mmx |
cglobal transfer_16to8copy_mmx |
51 |
cglobal transfer_16to8add_mmx |
cglobal transfer_16to8add_mmx |
52 |
cglobal transfer8x8_copy_mmx |
cglobal transfer8x8_copy_mmx |
53 |
|
|
54 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
55 |
; |
; |
56 |
; void transfer_8to16copy_mmx(int16_t * const dst, |
; void transfer_8to16copy_mmx(int16_t * const dst, |
57 |
; const uint8_t * const src, |
; const uint8_t * const src, |
58 |
; uint32_t stride); |
; uint32_t stride); |
59 |
; |
; |
60 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
61 |
|
|
62 |
%macro COPY_8_TO_16 1 |
%macro COPY_8_TO_16 1 |
63 |
movq mm0, [eax] |
movq mm0, [eax] |
75 |
movq [ecx+%1*32+24], mm3 |
movq [ecx+%1*32+24], mm3 |
76 |
%endmacro |
%endmacro |
77 |
|
|
78 |
align 16 |
ALIGN 16 |
79 |
transfer_8to16copy_mmx: |
transfer_8to16copy_mmx: |
80 |
|
|
81 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |
89 |
COPY_8_TO_16 3 |
COPY_8_TO_16 3 |
90 |
ret |
ret |
91 |
|
|
92 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
93 |
; |
; |
94 |
; void transfer_16to8copy_mmx(uint8_t * const dst, |
; void transfer_16to8copy_mmx(uint8_t * const dst, |
95 |
; const int16_t * const src, |
; const int16_t * const src, |
96 |
; uint32_t stride); |
; uint32_t stride); |
97 |
; |
; |
98 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
99 |
|
|
100 |
%macro COPY_16_TO_8 1 |
%macro COPY_16_TO_8 1 |
101 |
movq mm0, [eax+%1*32] |
movq mm0, [eax+%1*32] |
108 |
movq [ecx+edx], mm2 |
movq [ecx+edx], mm2 |
109 |
%endmacro |
%endmacro |
110 |
|
|
111 |
align 16 |
ALIGN 16 |
112 |
transfer_16to8copy_mmx: |
transfer_16to8copy_mmx: |
113 |
|
|
114 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |
124 |
COPY_16_TO_8 3 |
COPY_16_TO_8 3 |
125 |
ret |
ret |
126 |
|
|
127 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
128 |
; |
; |
129 |
; void transfer_8to16sub_mmx(int16_t * const dct, |
; void transfer_8to16sub_mmx(int16_t * const dct, |
130 |
; uint8_t * const cur, |
; uint8_t * const cur, |
131 |
; const uint8_t * const ref, |
; const uint8_t * const ref, |
132 |
; const uint32_t stride); |
; const uint32_t stride); |
133 |
; |
; |
134 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
|
; * |
|
|
; * 27.12.2001 renamed from 'compensate' to 'transfer_8to16sub' |
|
|
; * 02.12.2001 loop unrolled, code runs 10% faster now (Isibaar) |
|
|
; * 30.11.2001 16 pixels are processed per iteration (Isibaar) |
|
|
; * 30.11.2001 .text missing |
|
|
; * 06.11.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
|
|
; * |
|
|
; *************************************************************************/ |
|
135 |
|
|
136 |
; when second argument == 1, reference (ebx) block is to current (eax) |
; when second argument == 1, reference (ebx) block is to current (eax) |
137 |
%macro COPY_8_TO_16_SUB 2 |
%macro COPY_8_TO_16_SUB 2 |
170 |
movq [ecx+%1*32+24], mm3 |
movq [ecx+%1*32+24], mm3 |
171 |
%endmacro |
%endmacro |
172 |
|
|
173 |
align 16 |
ALIGN 16 |
174 |
transfer_8to16sub_mmx: |
transfer_8to16sub_mmx: |
175 |
mov ecx, [esp + 4] ; Dst |
mov ecx, [esp + 4] ; Dst |
176 |
mov eax, [esp + 8] ; Cur |
mov eax, [esp + 8] ; Cur |
188 |
ret |
ret |
189 |
|
|
190 |
|
|
191 |
align 16 |
ALIGN 16 |
192 |
transfer_8to16subro_mmx: |
transfer_8to16subro_mmx: |
193 |
mov ecx, [esp + 4] ; Dst |
mov ecx, [esp + 4] ; Dst |
194 |
mov eax, [esp + 8] ; Cur |
mov eax, [esp + 8] ; Cur |
206 |
ret |
ret |
207 |
|
|
208 |
|
|
209 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
210 |
; |
; |
211 |
; void transfer_8to16sub2_mmx(int16_t * const dct, |
; void transfer_8to16sub2_mmx(int16_t * const dct, |
212 |
; uint8_t * const cur, |
; uint8_t * const cur, |
214 |
; const uint8_t * ref2, |
; const uint8_t * ref2, |
215 |
; const uint32_t stride) |
; const uint32_t stride) |
216 |
; |
; |
217 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
218 |
|
|
219 |
%macro COPY_8_TO_16_SUB2_MMX 1 |
%macro COPY_8_TO_16_SUB2_MMX 1 |
220 |
movq mm0, [eax] ; cur |
movq mm0, [eax] ; cur |
278 |
movq [ecx+%1*32+24], mm3 |
movq [ecx+%1*32+24], mm3 |
279 |
%endmacro |
%endmacro |
280 |
|
|
281 |
align 16 |
ALIGN 16 |
282 |
transfer_8to16sub2_mmx: |
transfer_8to16sub2_mmx: |
283 |
mov ecx, [esp + 4] ; Dst |
mov ecx, [esp + 4] ; Dst |
284 |
mov eax, [esp + 8] ; Cur |
mov eax, [esp + 8] ; Cur |
298 |
pop ebx |
pop ebx |
299 |
ret |
ret |
300 |
|
|
301 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
302 |
; |
; |
303 |
; void transfer_8to16sub2_xmm(int16_t * const dct, |
; void transfer_8to16sub2_xmm(int16_t * const dct, |
304 |
; uint8_t * const cur, |
; uint8_t * const cur, |
306 |
; const uint8_t * ref2, |
; const uint8_t * ref2, |
307 |
; const uint32_t stride) |
; const uint32_t stride) |
308 |
; |
; |
309 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
310 |
|
|
311 |
%macro COPY_8_TO_16_SUB2_SSE 1 |
%macro COPY_8_TO_16_SUB2_SSE 1 |
312 |
movq mm0, [eax] ; cur |
movq mm0, [eax] ; cur |
343 |
movq [ecx+%1*32+24], mm3 |
movq [ecx+%1*32+24], mm3 |
344 |
%endmacro |
%endmacro |
345 |
|
|
346 |
align 16 |
ALIGN 16 |
347 |
transfer_8to16sub2_xmm: |
transfer_8to16sub2_xmm: |
348 |
mov ecx, [esp + 4] ; Dst |
mov ecx, [esp + 4] ; Dst |
349 |
mov eax, [esp + 8] ; Cur |
mov eax, [esp + 8] ; Cur |
363 |
pop ebx |
pop ebx |
364 |
ret |
ret |
365 |
|
|
366 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
367 |
; |
; |
368 |
; void transfer_16to8add_mmx(uint8_t * const dst, |
; void transfer_16to8add_mmx(uint8_t * const dst, |
369 |
; const int16_t * const src, |
; const int16_t * const src, |
370 |
; uint32_t stride); |
; uint32_t stride); |
371 |
; |
; |
372 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
373 |
|
|
374 |
%macro COPY_16_TO_8_ADD 1 |
%macro COPY_16_TO_8_ADD 1 |
375 |
movq mm0, [ecx] |
movq mm0, [ecx] |
391 |
%endmacro |
%endmacro |
392 |
|
|
393 |
|
|
394 |
align 16 |
ALIGN 16 |
395 |
transfer_16to8add_mmx: |
transfer_16to8add_mmx: |
396 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |
397 |
mov eax, [esp+ 8] ; Src |
mov eax, [esp+ 8] ; Src |
407 |
COPY_16_TO_8_ADD 3 |
COPY_16_TO_8_ADD 3 |
408 |
ret |
ret |
409 |
|
|
410 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
411 |
; |
; |
412 |
; void transfer8x8_copy_mmx(uint8_t * const dst, |
; void transfer8x8_copy_mmx(uint8_t * const dst, |
413 |
; const uint8_t * const src, |
; const uint8_t * const src, |
414 |
; const uint32_t stride); |
; const uint32_t stride); |
415 |
; |
; |
416 |
; |
; |
417 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
418 |
|
|
419 |
%macro COPY_8_TO_8 0 |
%macro COPY_8_TO_8 0 |
420 |
movq mm0, [eax] |
movq mm0, [eax] |
424 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
425 |
%endmacro |
%endmacro |
426 |
|
|
427 |
align 16 |
ALIGN 16 |
428 |
transfer8x8_copy_mmx: |
transfer8x8_copy_mmx: |
429 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |
430 |
mov eax, [esp+ 8] ; Src |
mov eax, [esp+ 8] ; Src |