[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 851, Sat Feb 15 15:22:19 2003 UTC revision 1790, Tue Aug 19 09:06:48 2008 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  ; *     This program is free software; you can redistribute it and/or modify  ; *  Copyright(C) 2002 Peter ross <pross@xvid.org>
7  ; *     it under the terms of the GNU General Public License as published by  ; *
8    ; *  This program is free software; you can redistribute it and/or modify it
9    ; *  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 15  Line 17 
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
 ; *  
 ; *************************************************************************/  
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
21  ; *  ; *
22  ; * 23.07.2002  sad[16,8]bi_3dn; <pross@xvid.org>  ; * $Id: sad_3dn.asm,v 1.10 2008-08-19 09:06:48 Isibaar 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 %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  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 93  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 132  Line 189 
189     pop ebx     pop ebx
190    
191     ret     ret
192    .endfunc
193    
194    ;-----------------------------------------------------------------------------
   
 ;===========================================================================  
195  ;  ;
196  ; uint32_t sad8bi_3dn(const uint8_t * const cur,  ; uint32_t sad8bi_3dn(const uint8_t * const cur,
197  ; const uint8_t * const ref1,  ; const uint8_t * const ref1,
198  ; const uint8_t * const ref2,  ; const uint8_t * const ref2,
199  ; const uint32_t stride);  ; const uint32_t stride);
200  ;  ;
201  ;===========================================================================  ;-----------------------------------------------------------------------------
   
 %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]  
202    
203     movq mm4, mm0  ALIGN 16
    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  
   
 align 16  
204  sad8bi_3dn:  sad8bi_3dn:
205     push ebx     push ebx
206     mov eax, [esp+4+ 4] ; Src     mov eax, [esp+4+ 4] ; Src
# Line 206  Line 226 
226     pop ebx     pop ebx
227    
228     ret     ret
229    .endfunc
230    
231    
232    %ifidn __OUTPUT_FORMAT__,elf
233    section ".note.GNU-stack" noalloc noexec nowrite progbits
234    %endif
235    

Legend:
Removed from v.851  
changed lines
  Added in v.1790

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