1 |
;/************************************************************************** |
;/***************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * xmm 8x8 block-based halfpel interpolation |
; * - 3dne pipeline optimized 8x8 block-based halfpel interpolation - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright(C) 2002 Jaan Kalda |
|
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
; * to use this software module in hardware or software products are |
|
|
; * 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. |
|
7 |
; * |
; * |
8 |
; * This program is free software; you can redistribute it and/or modify |
; * This program is free software; you can redistribute it and/or modify |
9 |
; * 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 |
17 |
; * |
; * |
18 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
19 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
20 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
; * |
; * |
22 |
; *************************************************************************/ |
; ****************************************************************************/ |
23 |
|
|
24 |
; these 3dne functions are compatible with iSSE, but are optimized specifically for |
; these 3dne functions are compatible with iSSE, but are optimized specifically |
25 |
; K7 pipelines |
; for K7 pipelines |
|
; |
|
|
;------------------------------------------------------------------------------ |
|
|
; 09.12.2002 Athlon optimizations contributed by Jaan Kalda |
|
|
;------------------------------------------------------------------------------ |
|
26 |
|
|
27 |
bits 32 |
BITS 32 |
28 |
|
|
29 |
%macro cglobal 1 |
%macro cglobal 1 |
30 |
%ifdef PREFIX |
%ifdef PREFIX |
34 |
global %1 |
global %1 |
35 |
%endif |
%endif |
36 |
%endmacro |
%endmacro |
|
%macro nop4 0 |
|
|
DB 08Dh,074h,026h,0 |
|
|
%endmacro |
|
|
%ifdef FORMAT_COFF |
|
|
section .data data |
|
|
%else |
|
|
section .data data align=16 |
|
|
%endif |
|
37 |
|
|
38 |
|
;============================================================================= |
39 |
|
; Read only data |
40 |
|
;============================================================================= |
41 |
|
|
42 |
|
SECTION .rodata |
43 |
|
|
44 |
align 16 |
ALIGN 16 |
45 |
mmx_one |
mmx_one: |
46 |
times 8 db 1 |
times 8 db 1 |
47 |
|
|
48 |
align 8 |
ALIGN 8 |
49 |
mm_minusone: |
mm_minusone: |
50 |
dd -1,-1 |
dd -1,-1 |
51 |
|
|
52 |
section .text |
;============================================================================= |
53 |
|
; Macros |
54 |
|
;============================================================================= |
55 |
|
|
56 |
|
%macro nop4 0 |
57 |
|
DB 08Dh,074h,026h,0 |
58 |
|
%endmacro |
59 |
|
|
60 |
|
;============================================================================= |
61 |
|
; Macros |
62 |
|
;============================================================================= |
63 |
|
|
64 |
|
SECTION .text |
65 |
|
|
66 |
cglobal interpolate8x8_halfpel_h_3dne |
cglobal interpolate8x8_halfpel_h_3dne |
67 |
cglobal interpolate8x8_halfpel_v_3dne |
cglobal interpolate8x8_halfpel_v_3dne |
68 |
cglobal interpolate8x8_halfpel_hv_3dne |
cglobal interpolate8x8_halfpel_hv_3dne |
69 |
|
|
70 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
71 |
; |
; |
72 |
; void interpolate8x8_halfpel_h_3dne(uint8_t * const dst, |
; void interpolate8x8_halfpel_h_3dne(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_SSE_RND0 1 |
%macro COPY_H_SSE_RND0 1 |
80 |
%if (%1) |
%if (%1) |
110 |
movq [ecx+edx], mm1 |
movq [ecx+edx], mm1 |
111 |
%endmacro |
%endmacro |
112 |
|
|
113 |
align 16 |
ALIGN 16 |
114 |
interpolate8x8_halfpel_h_3dne: |
interpolate8x8_halfpel_h_3dne: |
115 |
|
|
116 |
mov eax, [esp+ 8] ; Src |
mov eax, [esp+ 8] ; Src |
142 |
COPY_H_SSE_RND1 |
COPY_H_SSE_RND1 |
143 |
ret |
ret |
144 |
|
|
145 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
146 |
; |
; |
147 |
; void interpolate8x8_halfpel_v_3dne(uint8_t * const dst, |
; void interpolate8x8_halfpel_v_3dne(uint8_t * const dst, |
148 |
; const uint8_t * const src, |
; const uint8_t * const src, |
149 |
; const uint32_t stride, |
; const uint32_t stride, |
150 |
; const uint32_t rounding); |
; const uint32_t rounding); |
151 |
; |
; |
152 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
153 |
|
|
154 |
align 16 |
ALIGN 16 |
155 |
interpolate8x8_halfpel_v_3dne: |
interpolate8x8_halfpel_v_3dne: |
156 |
|
|
157 |
mov eax, [esp+ 8] ; Src |
mov eax, [esp+ 8] ; Src |
199 |
movq [ecx+edx],mm7 |
movq [ecx+edx],mm7 |
200 |
ret |
ret |
201 |
|
|
202 |
align 8 |
ALIGN 8 |
203 |
.rounding1 |
.rounding1 |
204 |
pcmpeqb mm0,mm0 |
pcmpeqb mm0,mm0 |
205 |
psubusb mm0,[eax] |
psubusb mm0,[eax] |
264 |
movq [ecx], mm4 |
movq [ecx], mm4 |
265 |
movq [ecx+edx], mm5 |
movq [ecx+edx], mm5 |
266 |
ret |
ret |
267 |
;=========================================================================== |
|
268 |
|
;----------------------------------------------------------------------------- |
269 |
; |
; |
270 |
; void interpolate8x8_halfpel_hv_3dne(uint8_t * const dst, |
; void interpolate8x8_halfpel_hv_3dne(uint8_t * const dst, |
271 |
; const uint8_t * const src, |
; const uint8_t * const src, |
273 |
; const uint32_t rounding); |
; const uint32_t rounding); |
274 |
; |
; |
275 |
; |
; |
276 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
277 |
|
|
278 |
; The trick is to correct the result of 'pavgb' with some combination of the |
; The trick is to correct the result of 'pavgb' with some combination of the |
279 |
; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgb' (s and t). |
; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgb' (s and t). |
359 |
movq [ecx+edx], mm0 |
movq [ecx+edx], mm0 |
360 |
%endmacro |
%endmacro |
361 |
|
|
362 |
align 16 |
ALIGN 16 |
363 |
interpolate8x8_halfpel_hv_3dne: |
interpolate8x8_halfpel_hv_3dne: |
364 |
mov eax, [esp+ 8] ; Src |
mov eax, [esp+ 8] ; Src |
365 |
mov edx, [esp+12] ; stride |
mov edx, [esp+12] ; stride |
385 |
COPY_HV_SSE_RND0 |
COPY_HV_SSE_RND0 |
386 |
ret |
ret |
387 |
|
|
388 |
align 16 |
ALIGN 16 |
389 |
.rounding1 |
.rounding1 |
390 |
COPY_HV_SSE_RND1 |
COPY_HV_SSE_RND1 |
391 |
lea ecx,[ecx+2*edx] |
lea ecx,[ecx+2*edx] |