[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 652, Sun Nov 17 00:35:33 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  ; *     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  ; *  Copyright(C) 2002 Michael Militzer <michael@xvid.org>
8    ; *  Copyright(C) 2002 Pascal Massimino <skal@planet-d.net>
9    ; *
10    ; *  This file is part of XviD, a free MPEG-4 video encoder/decoder
11    ; *
12    ; *  XviD is free software; you can redistribute it and/or modify it
13    ; *  under the terms of the GNU General Public License as published by
14  ; *     the Free Software Foundation; either version 2 of the License, or  ; *     the Free Software Foundation; either version 2 of the License, or
15  ; *     (at your option) any later version.  ; *     (at your option) any later version.
16  ; *  ; *
# Line 15  Line 21 
21  ; *  ; *
22  ; *     You should have received a copy of the GNU General Public License  ; *     You should have received a copy of the GNU General Public License
23  ; *     along with this program; if not, write to the Free Software  ; *     along with this program; if not, write to the Free Software
24  ; *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
25  ; *  ; *
26  ; *************************************************************************/  ; *  Under section 8 of the GNU General Public License, the copyright
27    ; *  holders of XVID explicitly forbid distribution in the following
28  ;/**************************************************************************  ; *  countries:
29  ; *  ; *
30  ; *     History:  ; *    - Japan
31    ; *    - United States of America
32  ; *  ; *
33  ; * 23.07.2002  sad8bi_xmm; <pross@xvid.org>  ; *  Linking XviD statically or dynamically with other modules is making a
34  ; * 04.06.2002  rewrote some funcs (XMM mainly)     -Skal-  ; *  combined work based on XviD.  Thus, the terms and conditions of the
35  ; * 17.11.2001  bugfix and small improvement for dev16_xmm,  ; *  GNU General Public License cover the whole combination.
36  ; *             removed terminate early in sad16_xmm (Isibaar)  ; *
37  ; *     12.11.2001      inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>  ; *  As a special exception, the copyright holders of XviD give you
38    ; *  permission to link XviD with independent modules that communicate with
39    ; *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
40    ; *  license terms of these independent modules, and to copy and distribute
41    ; *  the resulting combined work under terms of your choice, provided that
42    ; *  every copy of the combined work is accompanied by a complete copy of
43    ; *  the source code of XviD (the version of XviD used to produce the
44    ; *  combined work), being distributed under the terms of the GNU General
45    ; *  Public License plus this exception.  An independent module is a module
46    ; *  which is not derived from or based on XviD.
47    ; *
48    ; *  Note that people who make modified versions of XviD are not obligated
49    ; *  to grant this special exception for their modified versions; it is
50    ; *  their choice whether to do so.  The GNU General Public License gives
51    ; *  permission to release a modified version without this exception; this
52    ; *  exception also makes it possible to release a modified version which
53    ; *  carries forward this exception.
54    ; *
55    ; * $Id: sad_xmm.asm,v 1.5 2002-11-17 00:32:06 edgomez Exp $
56  ; *  ; *
57  ; *************************************************************************/  ; *************************************************************************/
58    
59  bits 32  bits 32
60    
61  %macro cglobal 1  %macro cglobal 1
62          %ifdef PREFIX          %ifdef PREFIX
63                  global _%1                  global _%1
# Line 58  Line 84 
84  ;  ;
85  ; uint32_t sad16_xmm(const uint8_t * const cur,  ; uint32_t sad16_xmm(const uint8_t * const cur,
86  ;                                       const uint8_t * const ref,  ;                                       const uint8_t * const ref,
87    ;                                       const uint32_t stride,
88  ;                                       const uint32_t best_sad);  ;                                       const uint32_t best_sad);
89  cglobal  sad8_xmm  ;
90  ;===========================================================================  ;===========================================================================
91    
92  %macro SAD_16x16_SSE 0  %macro SAD_16x16_SSE 0
# Line 114  Line 141 
141  ;  ;
142  ;===========================================================================  ;===========================================================================
143    
144    %macro SAD_8x8_SSE 0
145        movq mm0, [eax]
146        movq mm1, [eax+ecx]
147    
148        psadbw mm0, [edx]
149        psadbw mm1, [edx+ecx]
150        add eax, ebx
151        add edx, ebx
152    
153        paddusw mm5,mm0
154        paddusw mm6,mm1
155    %endmacro
156    
157    align 16
158    sad8_xmm:
159    
160        mov eax, [esp+ 4] ; Src1
161        mov edx, [esp+ 8] ; Src2
162        mov ecx, [esp+12] ; Stride
163        push ebx
164        lea ebx, [ecx+ecx]
165    
166        pxor mm5, mm5 ; accum1
167        pxor mm6, mm6 ; accum2
168    
169        SAD_8x8_SSE
170        SAD_8x8_SSE
171        SAD_8x8_SSE
172    
173        movq mm0, [eax]
174        movq mm1, [eax+ecx]
175        psadbw mm0, [edx]
176        psadbw mm1, [edx+ecx]
177    
178        pop ebx
179    
180        paddusw mm5,mm0
181        paddusw mm6,mm1
182    
183        paddusw mm6,mm5
184        movd eax, mm6
185    
186        ret
187    
188    
189    ;===========================================================================
190    ;
191    ; uint32_t sad16bi_xmm(const uint8_t * const cur,
192    ;                                       const uint8_t * const ref1,
193    ;                                       const uint8_t * const ref2,
194    ;                                       const uint32_t stride);
195    ;
196    ;===========================================================================
197    
198  %macro SADBI_16x16_SSE 0  %macro SADBI_16x16_SSE 0
199      movq mm0, [eax]      movq mm0, [eax]
200      movq mm1, [eax+8]      movq mm1, [eax+8]
# Line 179  Line 260 
260  ;  ;
261  ;===========================================================================  ;===========================================================================
262    
263  ;===========================================================================  %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  
264      movq mm0, [eax]      movq mm0, [eax]
265      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  
266    
267       movq mm2, [edx]
268       movq mm3, [edx+ecx]
269    
270       pavgb mm2, [ebx]
271       lea edx, [edx+2*ecx]
272    
273       pavgb mm3, [ebx+ecx]
274       lea ebx, [ebx+2*ecx]
275    
276       psadbw mm0, mm2
277       lea eax, [eax+2*ecx]
278    
279       psadbw mm1, mm3
280      paddusw mm5,mm0      paddusw mm5,mm0
281    
282      paddusw mm6,mm1      paddusw mm6,mm1
283  %endmacro  %endmacro
284    
285  align 16  align 16
286  sad8_xmm:  sad8bi_xmm:
   
     mov eax, [esp+ 4] ; Src1  
     mov edx, [esp+ 8] ; Src2  
     mov ecx, [esp+12] ; Stride  
287      push ebx      push ebx
288      lea ebx, [ecx+ecx]     mov eax, [esp+4+ 4] ; Src
289       mov edx, [esp+4+ 8] ; Ref1
290       mov ebx, [esp+4+12] ; Ref2
291       mov ecx, [esp+4+16] ; Stride
292    
293      pxor mm5, mm5 ; accum1      pxor mm5, mm5 ; accum1
294      pxor mm6, mm6 ; accum2      pxor mm6, mm6 ; accum2
295    .Loop
296       SADBI_8x8_XMM
297       SADBI_8x8_XMM
298       SADBI_8x8_XMM
299       SADBI_8x8_XMM
300    
301      SAD_8x8_SSE     paddusw mm6,mm5
302      SAD_8x8_SSE     movd eax, mm6
     SAD_8x8_SSE  
   
     movq mm0, [eax]  
     movq mm1, [eax+ecx]  
     psadbw mm0, [edx]  
     psadbw mm1, [edx+ecx]  
   
303      pop ebx      pop ebx
304       ret
305    
     paddusw mm5,mm0  
     paddusw mm6,mm1  
306    
307      paddusw mm6,mm5  ;===========================================================================
308      movd eax, mm6  ;
309    ; uint32_t dev16_xmm(const uint8_t * const cur,
310    ;                                       const uint32_t stride);
311    ;
312    ;===========================================================================
313    
314      ret  %macro MEAN_16x16_SSE 0
315      movq mm0, [eax]      movq mm0, [eax]
316      movq mm1, [eax+8]      movq mm1, [eax+8]
317      psadbw mm0, mm7      psadbw mm0, mm7

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

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