[svn] / trunk / xvidcore / src / motion / x86_asm / sad_3dn.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/x86_asm/sad_3dn.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 430, Fri Sep 6 16:59:47 2002 UTC revision 1535, Sun Aug 22 11:46:10 2004 UTC
# Line 1  Line 1 
1  ;/*****************************************************************************  ;/****************************************************************************
2  ; *  ; *
3  ; *  XVID MPEG-4 VIDEO CODEC  ; *  XVID MPEG-4 VIDEO CODEC
4  ; *  3dnow (*but without xmm*) sum of absolute difference  ; *  - 3DNow sad operators w/o XMM instructions -
5  ; *  ; *
6  ; *  Copyright(C) 2002 Peter Ross <pross@xvid.org>  ; *  Copyright(C) 2002 Peter ross <pross@xvid.org>
7  ; *  ; *
8  ; *  This program is an implementation of a part of one or more MPEG-4  ; *  This program is free software; you can redistribute it and/or modify it
9  ; *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  ; *  under the terms of the GNU General Public License as published by
 ; *  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.  
 ; *  
 ; *  This program is free software; you can redistribute it and/or modify  
 ; *  it under the terms of the GNU General Public License as published by  
10  ; *  the Free Software Foundation; either version 2 of the License, or  ; *  the Free Software Foundation; either version 2 of the License, or
11  ; *  (at your option) any later version.  ; *  (at your option) any later version.
12  ; *  ; *
# Line 28  Line 19 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  ; *  ; *
22  , ****************************************************************************/  ; * $Id: sad_3dn.asm,v 1.8 2004-08-22 11:46:10 edgomez Exp $
23    ; *
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
32                            %define %1 _%1:function
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
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  align 16  ;=============================================================================
 mmx_one times 4 dw 1  
49    
50  section .text  %ifdef FORMAT_COFF
51    SECTION .rodata
52  cglobal  sad16bi_3dn  %else
53  cglobal  sad8bi_3dn  SECTION .rodata align=16
54    %endif
 ;===========================================================================  
 ;  
 ; uint32_t sad16bi_3dn(const uint8_t * const cur,  
 ; const uint8_t * const ref1,  
 ; const uint8_t * const ref2,  
 ; const uint32_t stride);  
 ;  
 ;===========================================================================  
55    
56    ALIGN 16
57    mmx_one:
58            times 4 dw 1
59    
60    ;=============================================================================
61    ; Helper macros
62    ;=============================================================================
63  %macro SADBI_16x16_3DN 0  %macro SADBI_16x16_3DN 0
64     movq mm0, [eax] ; src     movq mm0, [eax] ; src
65     movq mm2, [eax+8]     movq mm2, [eax+8]
# Line 96  Line 96 
96     paddusw mm6,mm2     paddusw mm6,mm2
97  %endmacro  %endmacro
98    
99  align 16  %macro SADBI_8x8_3DN 0
100      movq mm0, [eax] ; src
101      movq mm2, [eax+ecx]
102    
103      movq mm1, [edx] ; ref1
104      movq mm3, [edx+ecx]
105      pavgusb mm1, [ebx] ; ref2
106      lea edx, [edx+2*ecx]
107      pavgusb mm3, [ebx+ecx]
108      lea ebx, [ebx+2*ecx]
109    
110      movq mm4, mm0
111      lea eax, [eax+2*ecx]
112      psubusb mm0, mm1
113      movq mm5, mm2
114      psubusb mm2, mm3
115    
116      psubusb mm1, mm4
117      por mm0, mm1
118      psubusb mm3, mm5
119      por mm2, mm3
120    
121      movq mm1, mm0
122      movq mm3, mm2
123    
124      punpcklbw mm0,mm7
125      punpckhbw mm1,mm7
126      punpcklbw mm2,mm7
127      punpckhbw mm3,mm7
128    
129      paddusw mm0,mm1
130      paddusw mm2,mm3
131      paddusw mm6,mm0
132      paddusw mm6,mm2
133    %endmacro
134    
135    ;=============================================================================
136    ; Code
137    ;=============================================================================
138    
139    SECTION .text
140    
141    cglobal  sad16bi_3dn
142    cglobal  sad8bi_3dn
143    
144    ;-----------------------------------------------------------------------------
145    ;
146    ; uint32_t sad16bi_3dn(const uint8_t * const cur,
147    ; const uint8_t * const ref1,
148    ; const uint8_t * const ref2,
149    ; const uint32_t stride);
150    ;
151    ;-----------------------------------------------------------------------------
152    
153    ALIGN 16
154  sad16bi_3dn:  sad16bi_3dn:
155     push ebx     push ebx
156     mov eax, [esp+4+ 4] ; Src     mov eax, [esp+4+ 4] ; Src
# Line 136  Line 190 
190    
191     ret     ret
192    
193    ;-----------------------------------------------------------------------------
   
 ;===========================================================================  
194  ;  ;
195  ; uint32_t sad8bi_3dn(const uint8_t * const cur,  ; uint32_t sad8bi_3dn(const uint8_t * const cur,
196  ; const uint8_t * const ref1,  ; const uint8_t * const ref1,
197  ; const uint8_t * const ref2,  ; const uint8_t * const ref2,
198  ; const uint32_t stride);  ; const uint32_t stride);
199  ;  ;
200  ;===========================================================================  ;-----------------------------------------------------------------------------
   
 %macro SADBI_8x8_3DN 0  
    movq mm0, [eax] ; src  
    movq mm2, [eax+ecx]  
   
    movq mm1, [edx] ; ref1  
    movq mm3, [edx+ecx]  
    pavgusb mm1, [ebx] ; ref2  
    lea edx,[edx+2*ecx]  
    pavgusb mm3, [ebx+ecx]  
    lea ebx,[ebx+2*ecx]  
   
    movq mm4, mm0  
    lea eax,[eax+2*ecx]  
    psubusb mm0, mm1  
    movq mm5, mm2  
    psubusb mm2, mm3  
   
    psubusb mm1, mm4  
    por mm0, mm1  
    psubusb mm3, mm5  
    por mm2, mm3  
   
    movq mm1,mm0  
    movq mm3,mm2  
   
    punpcklbw mm0,mm7  
    punpckhbw mm1,mm7  
    punpcklbw mm2,mm7  
    punpckhbw mm3,mm7  
   
    paddusw mm0,mm1  
    paddusw mm2,mm3  
    paddusw mm6,mm0  
    paddusw mm6,mm2  
 %endmacro  
201    
202  align 16  ALIGN 16
203  sad8bi_3dn:  sad8bi_3dn:
204     push ebx     push ebx
205     mov eax, [esp+4+ 4] ; Src     mov eax, [esp+4+ 4] ; Src

Legend:
Removed from v.430  
changed lines
  Added in v.1535

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