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

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

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

revision 1794, Fri Nov 14 15:43:28 2008 UTC revision 1795, Wed Nov 26 01:04:34 2008 UTC
# Line 20  Line 20 
20  ; *  along with this program; if not, write to the Free Software  ; *  along with this program; if not, write to the Free Software
21  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22  ; *  ; *
23  ; * $Id: sad_sse2.asm,v 1.15 2008-11-11 20:46:24 Isibaar Exp $  ; * $Id: sad_sse2.asm,v 1.16 2008-11-26 01:04:34 Isibaar Exp $
24  ; *  ; *
25  ; ***************************************************************************/  ; ***************************************************************************/
26    
27  BITS 32  %include "nasm.inc"
   
 %macro cglobal 1  
         %ifdef PREFIX  
                 %ifdef MARK_FUNCS  
                         global _%1:function %1.endfunc-%1  
                         %define %1 _%1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global _%1  
                         %define %1 _%1  
                         %define ENDFUNC  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global %1  
                         %define ENDFUNC  
                 %endif  
         %endif  
 %endmacro  
28    
29  ;=============================================================================  ;=============================================================================
30  ; Read only data  ; Read only data
31  ;=============================================================================  ;=============================================================================
32    
33  %ifdef FORMAT_COFF  DATA
 SECTION .rodata  
 %else  
 SECTION .rodata align=16  
 %endif  
34    
35  ALIGN 64  ALIGN SECTION_ALIGN
36  zero    times 4   dd 0  zero    times 4   dd 0
37    
38  ;=============================================================================  ;=============================================================================
39  ; Code  ; Code
40  ;=============================================================================  ;=============================================================================
41    
42  SECTION .text  SECTION .rotext align=SECTION_ALIGN
43    
44  cglobal  sad16_sse2  cglobal  sad16_sse2
45  cglobal  dev16_sse2  cglobal  dev16_sse2
# Line 82  Line 56 
56    
57    
58  %macro SAD_16x16_SSE2 1  %macro SAD_16x16_SSE2 1
59    %1  xmm0, [edx]    %1  xmm0, [TMP1]
60    %1  xmm1, [edx+ecx]    %1  xmm1, [TMP1+TMP0]
61    lea edx,[edx+2*ecx]    lea TMP1,[TMP1+2*TMP0]
62    movdqa  xmm2, [eax]    movdqa  xmm2, [_EAX]
63    movdqa  xmm3, [eax+ecx]    movdqa  xmm3, [_EAX+TMP0]
64    lea eax,[eax+2*ecx]    lea _EAX,[_EAX+2*TMP0]
65    psadbw  xmm0, xmm2    psadbw  xmm0, xmm2
66    paddusw xmm6,xmm0    paddusw xmm6,xmm0
67    psadbw  xmm1, xmm3    psadbw  xmm1, xmm3
# Line 95  Line 69 
69  %endmacro  %endmacro
70    
71  %macro SAD16_SSE2_SSE3 1  %macro SAD16_SSE2_SSE3 1
72    mov eax, [esp+ 4] ; cur (assumed aligned)    mov _EAX, prm1 ; cur (assumed aligned)
73    mov edx, [esp+ 8] ; ref    mov TMP1, prm2 ; ref
74    mov ecx, [esp+12] ; stride    mov TMP0, prm3 ; stride
75    
76    pxor xmm6, xmm6 ; accum    pxor xmm6, xmm6 ; accum
77    
# Line 116  Line 90 
90    ret    ret
91  %endmacro  %endmacro
92    
93  ALIGN 16  ALIGN SECTION_ALIGN
94  sad16_sse2:  sad16_sse2:
95    SAD16_SSE2_SSE3 movdqu    SAD16_SSE2_SSE3 movdqu
96  ENDFUNC  ENDFUNC
97    
98    
99  ALIGN 16  ALIGN SECTION_ALIGN
100  sad16_sse3:  sad16_sse3:
101    SAD16_SSE2_SSE3 lddqu    SAD16_SSE2_SSE3 lddqu
102  ENDFUNC  ENDFUNC
# Line 132  Line 106 
106  ; uint32_t dev16_sse2(const uint8_t * const cur, const uint32_t stride);  ; uint32_t dev16_sse2(const uint8_t * const cur, const uint32_t stride);
107  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
108    
109  %macro MEAN_16x16_SSE2 1  ; eax: src, ecx:stride, mm7: zero or mean => mm6: result  %macro MEAN_16x16_SSE2 1  ; _EAX: src, TMP0:stride, mm7: zero or mean => mm6: result
110    %1 xmm0, [eax]    %1 xmm0, [_EAX]
111    %1 xmm1, [eax+ecx]    %1 xmm1, [_EAX+TMP0]
112    lea eax, [eax+2*ecx]    ; + 2*stride    lea _EAX, [_EAX+2*TMP0]    ; + 2*stride
113    psadbw xmm0, xmm7    psadbw xmm0, xmm7
114    paddusw xmm6, xmm0    paddusw xmm6, xmm0
115    psadbw xmm1, xmm7    psadbw xmm1, xmm7
# Line 144  Line 118 
118    
119    
120  %macro MEAN16_SSE2_SSE3 1  %macro MEAN16_SSE2_SSE3 1
121    mov eax, [esp+ 4]   ; src    mov _EAX, prm1   ; src
122    mov ecx, [esp+ 8]   ; stride    mov TMP0, prm2   ; stride
123    
124    pxor xmm6, xmm6     ; accum    pxor xmm6, xmm6     ; accum
125    pxor xmm7, xmm7     ; zero    pxor xmm7, xmm7     ; zero
# Line 160  Line 134 
134    MEAN_16x16_SSE2 %1    MEAN_16x16_SSE2 %1
135    MEAN_16x16_SSE2 %1    MEAN_16x16_SSE2 %1
136    
137    mov eax, [esp+ 4]       ; src again    mov _EAX, prm1       ; src again
138    
139    pshufd   xmm7, xmm6, 10b    pshufd   xmm7, xmm6, 10b
140    paddusw  xmm7, xmm6    paddusw  xmm7, xmm6
# Line 186  Line 160 
160    ret    ret
161  %endmacro  %endmacro
162    
163  ALIGN 16  ALIGN SECTION_ALIGN
164  dev16_sse2:  dev16_sse2:
165    MEAN16_SSE2_SSE3 movdqu    MEAN16_SSE2_SSE3 movdqu
166  ENDFUNC  ENDFUNC
167    
168  ALIGN 16  ALIGN SECTION_ALIGN
169  dev16_sse3:  dev16_sse3:
170    MEAN16_SSE2_SSE3 lddqu    MEAN16_SSE2_SSE3 lddqu
171  ENDFUNC  ENDFUNC

Legend:
Removed from v.1794  
changed lines
  Added in v.1795

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