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) 2002 Peter Ross <pross@xvid.org> |
; * Copyright(C) 2001 Peter Ross <pross@xvid.org> |
7 |
; * Copyright(C) 2002 Michael Militzer <michael@xvid.org> |
; * 2002 Michael Militzer <isibaar@xvid.org> |
8 |
|
; * 2002 Pascal Massimino <skal@planet-d.net> |
9 |
; * |
; * |
10 |
; * This file is part of XviD, a free MPEG-4 video encoder/decoder |
; * 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 |
|
; * XviD is free software; you can redistribute it and/or modify it |
|
|
; * under the terms of the GNU General Public License as published by |
|
12 |
; * the Free Software Foundation; either version 2 of the License, or |
; * the Free Software Foundation; either version 2 of the License, or |
13 |
; * (at your option) any later version. |
; * (at your option) any later version. |
14 |
; * |
; * |
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
; * |
; * |
|
; * Under section 8 of the GNU General Public License, the copyright |
|
|
; * holders of XVID explicitly forbid distribution in the following |
|
|
; * countries: |
|
|
; * |
|
|
; * - Japan |
|
|
; * - United States of America |
|
|
; * |
|
|
; * Linking XviD statically or dynamically with other modules is making a |
|
|
; * combined work based on XviD. Thus, the terms and conditions of the |
|
|
; * GNU General Public License cover the whole combination. |
|
|
; * |
|
|
; * As a special exception, the copyright holders of XviD give you |
|
|
; * permission to link XviD with independent modules that communicate with |
|
|
; * XviD solely through the VFW1.1 and DShow interfaces, regardless of the |
|
|
; * license terms of these independent modules, and to copy and distribute |
|
|
; * the resulting combined work under terms of your choice, provided that |
|
|
; * every copy of the combined work is accompanied by a complete copy of |
|
|
; * the source code of XviD (the version of XviD used to produce the |
|
|
; * combined work), being distributed under the terms of the GNU General |
|
|
; * Public License plus this exception. An independent module is a module |
|
|
; * which is not derived from or based on XviD. |
|
|
; * |
|
|
; * Note that people who make modified versions of XviD are not obligated |
|
|
; * to grant this special exception for their modified versions; it is |
|
|
; * their choice whether to do so. The GNU General Public License gives |
|
|
; * permission to release a modified version without this exception; this |
|
|
; * exception also makes it possible to release a modified version which |
|
|
; * carries forward this exception. |
|
|
; * |
|
|
; * $Id: interpolate8x8_3dn.asm,v 1.3 2002-11-17 00:20:30 edgomez Exp $ |
|
|
; * |
|
24 |
; ****************************************************************************/ |
; ****************************************************************************/ |
25 |
|
|
26 |
bits 32 |
BITS 32 |
27 |
|
|
28 |
%macro cglobal 1 |
%macro cglobal 1 |
29 |
%ifdef PREFIX |
%ifdef PREFIX |
30 |
|
%ifdef MARK_FUNCS |
31 |
|
global _%1:function %1.endfunc-%1 |
32 |
|
%define %1 _%1:function %1.endfunc-%1 |
33 |
|
%else |
34 |
global _%1 |
global _%1 |
35 |
%define %1 _%1 |
%define %1 _%1 |
36 |
|
%endif |
37 |
|
%else |
38 |
|
%ifdef MARK_FUNCS |
39 |
|
global %1:function %1.endfunc-%1 |
40 |
%else |
%else |
41 |
global %1 |
global %1 |
42 |
%endif |
%endif |
43 |
|
%endif |
44 |
%endmacro |
%endmacro |
45 |
|
|
46 |
section .data |
;============================================================================= |
47 |
|
; Read Only data |
48 |
|
;============================================================================= |
49 |
|
|
50 |
|
%ifdef FORMAT_COFF |
51 |
|
SECTION .rodata |
52 |
|
%else |
53 |
|
SECTION .rodata align=16 |
54 |
|
%endif |
55 |
|
|
56 |
align 16 |
ALIGN 16 |
57 |
|
mmx_one: |
|
mmx_one |
|
58 |
times 8 db 1 |
times 8 db 1 |
59 |
|
|
60 |
section .text |
;============================================================================= |
61 |
|
; Code |
62 |
|
;============================================================================= |
63 |
|
|
64 |
|
SECTION .text |
65 |
|
|
66 |
cglobal interpolate8x8_halfpel_h_3dn |
cglobal interpolate8x8_halfpel_h_3dn |
67 |
cglobal interpolate8x8_halfpel_v_3dn |
cglobal interpolate8x8_halfpel_v_3dn |
68 |
cglobal interpolate8x8_halfpel_hv_3dn |
cglobal interpolate8x8_halfpel_hv_3dn |
69 |
|
|
70 |
|
;----------------------------------------------------------------------------- |
|
;=========================================================================== |
|
71 |
; |
; |
72 |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
73 |
; const uint8_t * const src, |
; const uint8_t * const src, |
74 |
; const uint32_t stride, |
; const uint32_t stride, |
75 |
; const uint32_t rounding); |
; const uint32_t rounding); |
76 |
; |
; |
77 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
78 |
|
|
79 |
%macro COPY_H_3DN_RND0 0 |
%macro COPY_H_3DN_RND0 0 |
80 |
movq mm0, [eax] |
movq mm0, [eax] |
106 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
107 |
%endmacro |
%endmacro |
108 |
|
|
109 |
align 16 |
ALIGN 16 |
110 |
interpolate8x8_halfpel_h_3dn: |
interpolate8x8_halfpel_h_3dn: |
111 |
|
|
112 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
137 |
lea ecx,[ecx+2*edx] |
lea ecx,[ecx+2*edx] |
138 |
COPY_H_3DN_RND1 |
COPY_H_3DN_RND1 |
139 |
ret |
ret |
140 |
|
.endfunc |
141 |
|
|
142 |
|
|
143 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
144 |
; |
; |
145 |
; void interpolate8x8_halfpel_v_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_v_3dn(uint8_t * const dst, |
146 |
; const uint8_t * const src, |
; const uint8_t * const src, |
147 |
; const uint32_t stride, |
; const uint32_t stride, |
148 |
; const uint32_t rounding); |
; const uint32_t rounding); |
149 |
; |
; |
150 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
151 |
|
|
152 |
%macro COPY_V_3DN_RND0 0 |
%macro COPY_V_3DN_RND0 0 |
153 |
movq mm0, [eax] |
movq mm0, [eax] |
178 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
179 |
%endmacro |
%endmacro |
180 |
|
|
181 |
align 16 |
ALIGN 16 |
182 |
interpolate8x8_halfpel_v_3dn: |
interpolate8x8_halfpel_v_3dn: |
183 |
|
|
184 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
214 |
lea ecx,[ecx+2*edx] |
lea ecx,[ecx+2*edx] |
215 |
COPY_V_3DN_RND1 |
COPY_V_3DN_RND1 |
216 |
ret |
ret |
217 |
|
.endfunc |
218 |
|
|
219 |
|
|
220 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
221 |
; |
; |
222 |
; void interpolate8x8_halfpel_hv_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_hv_3dn(uint8_t * const dst, |
223 |
; const uint8_t * const src, |
; const uint8_t * const src, |
225 |
; const uint32_t rounding); |
; const uint32_t rounding); |
226 |
; |
; |
227 |
; |
; |
228 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
229 |
|
|
230 |
; 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 |
231 |
; 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). |
317 |
movq [ecx], mm0 |
movq [ecx], mm0 |
318 |
%endmacro |
%endmacro |
319 |
|
|
320 |
align 16 |
ALIGN 16 |
321 |
interpolate8x8_halfpel_hv_3dn |
interpolate8x8_halfpel_hv_3dn |
322 |
mov eax, [esp+16] ; rounding |
mov eax, [esp+16] ; rounding |
323 |
mov ecx, [esp+ 4] ; Dst |
mov ecx, [esp+ 4] ; Dst |
354 |
add ecx, edx |
add ecx, edx |
355 |
COPY_HV_3DN_RND1 |
COPY_HV_3DN_RND1 |
356 |
ret |
ret |
357 |
|
.endfunc |
358 |
|
|