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

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

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

revision 262, Sun Jul 7 09:45:40 2002 UTC revision 458, Tue Sep 10 19:28:01 2002 UTC
# Line 1  Line 1 
1  ;/**************************************************************************  ;/*****************************************************************************
2  ; *  ; *
3  ; *     XVID MPEG-4 VIDEO CODEC  ; *     XVID MPEG-4 VIDEO CODEC
4  ; *     xmm sum of absolute difference  ; *  xmm (extended mmx) sum of absolute difference
5    ; *
6    ; *  Copyright(C) 2002 Peter Ross <pross@xvid.org>
7    ; *  Copyright(C) 2002 Michael Militzer <michael@xvid.org>
8    ; *  Copyright(C) 2002 Pascal Massimino <skal@planet-d.net>
9    ; *
10    ; *  This program is an implementation of a part of one or more MPEG-4
11    ; *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
12    ; *  to use this software module in hardware or software products are
13    ; *  advised that its use may infringe existing patents or copyrights, and
14    ; *  any such use would be at such party's own risk.  The original
15    ; *  developer of this software module and his/her company, and subsequent
16    ; *  editors and their companies, will have no liability for use of this
17    ; *  software or modifications or derivatives thereof.
18  ; *  ; *
19  ; *     This program is free software; you can redistribute it and/or modify  ; *     This program is free software; you can redistribute it and/or modify
20  ; *     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
# Line 15  Line 28 
28  ; *  ; *
29  ; *     You should have received a copy of the GNU General Public License  ; *     You should have received a copy of the GNU General Public License
30  ; *     along with this program; if not, write to the Free Software  ; *     along with this program; if not, write to the Free Software
31  ; *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 ; *  
 ; *************************************************************************/  
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
 ; *  
 ; * 23.07.2002  sad8bi_xmm; <pross@xvid.org>  
 ; * 04.06.2002  rewrote some funcs (XMM mainly)     -Skal-  
 ; * 17.11.2001  bugfix and small improvement for dev16_xmm,  
 ; *             removed terminate early in sad16_xmm (Isibaar)  
 ; *     12.11.2001      inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>  
32  ; *  ; *
33  ; *************************************************************************/  ; *************************************************************************/
34    
35  bits 32  bits 32
36    
37  %macro cglobal 1  %macro cglobal 1
38          %ifdef PREFIX          %ifdef PREFIX
39                  global _%1                  global _%1
# Line 58  Line 60 
60  ;  ;
61  ; uint32_t sad16_xmm(const uint8_t * const cur,  ; uint32_t sad16_xmm(const uint8_t * const cur,
62  ;                                       const uint8_t * const ref,  ;                                       const uint8_t * const ref,
63    ;                                       const uint32_t stride,
64  ;                                       const uint32_t best_sad);  ;                                       const uint32_t best_sad);
65  cglobal  sad8_xmm  ;
66  ;===========================================================================  ;===========================================================================
67    
68  %macro SAD_16x16_SSE 0  %macro SAD_16x16_SSE 0
# Line 114  Line 117 
117  ;  ;
118  ;===========================================================================  ;===========================================================================
119    
120    %macro SAD_8x8_SSE 0
121        movq mm0, [eax]
122        movq mm1, [eax+ecx]
123    
124        psadbw mm0, [edx]
125        psadbw mm1, [edx+ecx]
126        add eax, ebx
127        add edx, ebx
128    
129        paddusw mm5,mm0
130        paddusw mm6,mm1
131    %endmacro
132    
133    align 16
134    sad8_xmm:
135    
136        mov eax, [esp+ 4] ; Src1
137        mov edx, [esp+ 8] ; Src2
138        mov ecx, [esp+12] ; Stride
139        push ebx
140        lea ebx, [ecx+ecx]
141    
142        pxor mm5, mm5 ; accum1
143        pxor mm6, mm6 ; accum2
144    
145        SAD_8x8_SSE
146        SAD_8x8_SSE
147        SAD_8x8_SSE
148    
149        movq mm0, [eax]
150        movq mm1, [eax+ecx]
151        psadbw mm0, [edx]
152        psadbw mm1, [edx+ecx]
153    
154        pop ebx
155    
156        paddusw mm5,mm0
157        paddusw mm6,mm1
158    
159        paddusw mm6,mm5
160        movd eax, mm6
161    
162        ret
163    
164    
165    ;===========================================================================
166    ;
167    ; uint32_t sad16bi_xmm(const uint8_t * const cur,
168    ;                                       const uint8_t * const ref1,
169    ;                                       const uint8_t * const ref2,
170    ;                                       const uint32_t stride);
171    ;
172    ;===========================================================================
173    
174  %macro SADBI_16x16_SSE 0  %macro SADBI_16x16_SSE 0
175      movq mm0, [eax]      movq mm0, [eax]
176      movq mm1, [eax+8]      movq mm1, [eax+8]
# Line 179  Line 236 
236  ;  ;
237  ;===========================================================================  ;===========================================================================
238    
239  ;===========================================================================  %macro SADBI_8x8_XMM 0
 ;  
 ; uint32_t sad8_xmm(const uint8_t * const cur,  
 ;                                       const uint8_t * const ref,  
 ;                                       const uint32_t stride);  
 ;  
 ;===========================================================================  
   
 %macro SAD_8x8_SSE 0  
240      movq mm0, [eax]      movq mm0, [eax]
241      movq mm1, [eax+ecx]      movq mm1, [eax+ecx]
 %macro MEAN_16x16_SSE 0  
     psadbw mm0, [edx]  
     psadbw mm1, [edx+ecx]  
     add eax, ebx  
     add edx, ebx  
242    
243       movq mm2, [edx]
244       movq mm3, [edx+ecx]
245    
246       pavgb mm2, [ebx]
247       lea edx, [edx+2*ecx]
248    
249       pavgb mm3, [ebx+ecx]
250       lea ebx, [ebx+2*ecx]
251    
252       psadbw mm0, mm2
253       lea eax, [eax+2*ecx]
254    
255       psadbw mm1, mm3
256      paddusw mm5,mm0      paddusw mm5,mm0
257    
258      paddusw mm6,mm1      paddusw mm6,mm1
259  %endmacro  %endmacro
260    
261  align 16  align 16
262  sad8_xmm:  sad8bi_xmm:
   
     mov eax, [esp+ 4] ; Src1  
     mov edx, [esp+ 8] ; Src2  
     mov ecx, [esp+12] ; Stride  
263      push ebx      push ebx
264      lea ebx, [ecx+ecx]     mov eax, [esp+4+ 4] ; Src
265       mov edx, [esp+4+ 8] ; Ref1
266       mov ebx, [esp+4+12] ; Ref2
267       mov ecx, [esp+4+16] ; Stride
268    
269      pxor mm5, mm5 ; accum1      pxor mm5, mm5 ; accum1
270      pxor mm6, mm6 ; accum2      pxor mm6, mm6 ; accum2
271    .Loop
272       SADBI_8x8_XMM
273       SADBI_8x8_XMM
274       SADBI_8x8_XMM
275       SADBI_8x8_XMM
276    
277      SAD_8x8_SSE     paddusw mm6,mm5
278      SAD_8x8_SSE     movd eax, mm6
     SAD_8x8_SSE  
   
     movq mm0, [eax]  
     movq mm1, [eax+ecx]  
     psadbw mm0, [edx]  
     psadbw mm1, [edx+ecx]  
   
279      pop ebx      pop ebx
280       ret
281    
     paddusw mm5,mm0  
     paddusw mm6,mm1  
282    
283      paddusw mm6,mm5  ;===========================================================================
284      movd eax, mm6  ;
285    ; uint32_t dev16_xmm(const uint8_t * const cur,
286    ;                                       const uint32_t stride);
287    ;
288    ;===========================================================================
289    
290      ret  %macro MEAN_16x16_SSE 0
291      movq mm0, [eax]      movq mm0, [eax]
292      movq mm1, [eax+8]      movq mm1, [eax+8]
293      psadbw mm0, mm7      psadbw mm0, mm7

Legend:
Removed from v.262  
changed lines
  Added in v.458

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