1 |
;/************************************************************************** |
;/***************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * 3dnow 8x8 block-based halfpel interpolation |
; * - 3dnow 8x8 block-based halfpel interpolation - |
5 |
|
; * |
6 |
|
; * Copyright(C) 2001 Peter Ross <pross@xvid.org> |
7 |
|
; * 2002 Michael Militzer <isibaar@xvid.org> |
8 |
|
; * 2002 Pascal Massimino <skal@planet-d.net> |
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 |
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
|
; * |
|
|
; * 06.07.2002 applied Skal's XMM changes to the 3dnow code (Isibaar) |
|
|
; * 04.02.2002 additional 3dnow optimizations (Isibaar) |
|
|
; * 22.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
|
23 |
; * |
; * |
24 |
; *************************************************************************/ |
; ****************************************************************************/ |
25 |
|
|
26 |
|
BITS 32 |
|
bits 32 |
|
27 |
|
|
28 |
%macro cglobal 1 |
%macro cglobal 1 |
29 |
%ifdef PREFIX |
%ifdef PREFIX |
34 |
%endif |
%endif |
35 |
%endmacro |
%endmacro |
36 |
|
|
37 |
section .data |
;============================================================================= |
38 |
|
; Read Only data |
39 |
|
;============================================================================= |
40 |
|
|
41 |
align 16 |
SECTION .rodata |
42 |
|
|
43 |
mmx_one |
ALIGN 16 |
44 |
|
mmx_one: |
45 |
times 8 db 1 |
times 8 db 1 |
46 |
|
|
47 |
section .text |
;============================================================================= |
48 |
|
; Code |
49 |
|
;============================================================================= |
50 |
|
|
51 |
|
SECTION .text |
52 |
|
|
53 |
cglobal interpolate8x8_halfpel_h_3dn |
cglobal interpolate8x8_halfpel_h_3dn |
54 |
cglobal interpolate8x8_halfpel_v_3dn |
cglobal interpolate8x8_halfpel_v_3dn |
55 |
cglobal interpolate8x8_halfpel_hv_3dn |
cglobal interpolate8x8_halfpel_hv_3dn |
56 |
|
|
57 |
|
;----------------------------------------------------------------------------- |
|
;=========================================================================== |
|
58 |
; |
; |
59 |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
60 |
; const uint8_t * const src, |
; const uint8_t * const src, |
61 |
; const uint32_t stride, |
; const uint32_t stride, |
62 |
; const uint32_t rounding); |
; const uint32_t rounding); |
63 |
; |
; |
64 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
65 |
|
|
66 |
%macro COPY_H_3DN_RND0 0 |
%macro COPY_H_3DN_RND0 0 |
67 |
movq mm0, [eax] |
movq mm0, [eax] |
93 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
94 |
%endmacro |
%endmacro |
95 |
|
|
96 |
align 16 |
ALIGN 16 |
97 |
interpolate8x8_halfpel_h_3dn: |
interpolate8x8_halfpel_h_3dn: |
98 |
|
|
99 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
126 |
ret |
ret |
127 |
|
|
128 |
|
|
129 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
130 |
; |
; |
131 |
; void interpolate8x8_halfpel_v_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_v_3dn(uint8_t * const dst, |
132 |
; const uint8_t * const src, |
; const uint8_t * const src, |
133 |
; const uint32_t stride, |
; const uint32_t stride, |
134 |
; const uint32_t rounding); |
; const uint32_t rounding); |
135 |
; |
; |
136 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
137 |
|
|
138 |
%macro COPY_V_3DN_RND0 0 |
%macro COPY_V_3DN_RND0 0 |
139 |
movq mm0, [eax] |
movq mm0, [eax] |
164 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
165 |
%endmacro |
%endmacro |
166 |
|
|
167 |
align 16 |
ALIGN 16 |
168 |
interpolate8x8_halfpel_v_3dn: |
interpolate8x8_halfpel_v_3dn: |
169 |
|
|
170 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
202 |
ret |
ret |
203 |
|
|
204 |
|
|
205 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
206 |
; |
; |
207 |
; void interpolate8x8_halfpel_hv_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_hv_3dn(uint8_t * const dst, |
208 |
; const uint8_t * const src, |
; const uint8_t * const src, |
210 |
; const uint32_t rounding); |
; const uint32_t rounding); |
211 |
; |
; |
212 |
; |
; |
213 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
214 |
|
|
215 |
; The trick is to correct the result of 'pavgusb' with some combination of the |
; The trick is to correct the result of 'pavgusb' with some combination of the |
216 |
; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgusb' (s and t). |
; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgusb' (s and t). |
302 |
movq [ecx], mm0 |
movq [ecx], mm0 |
303 |
%endmacro |
%endmacro |
304 |
|
|
305 |
align 16 |
ALIGN 16 |
306 |
interpolate8x8_halfpel_hv_3dn |
interpolate8x8_halfpel_hv_3dn |
307 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
308 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |