[svn] / branches / release-1_2-branch / xvidcore / src / motion / x86_asm / sad_sse2.asm Repository:
ViewVC logotype

Diff of /branches/release-1_2-branch/xvidcore/src/motion/x86_asm/sad_sse2.asm

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

trunk/xvidcore/src/motion/x86_asm/sad_sse2.asm revision 1790, Tue Aug 19 09:06:48 2008 UTC branches/release-1_2-branch/xvidcore/src/motion/x86_asm/sad_sse2.asm revision 1838, Mon Dec 1 17:27:03 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.14 2008-08-19 09:06:48 Isibaar Exp $  ; * $Id: sad_sse2.asm,v 1.16.2.1 2008-12-01 17:27:03 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  
                 %else  
                         global _%1  
                         %define %1 _%1  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function %1.endfunc-%1  
                 %else  
                         global %1  
                 %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 78  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 91  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)    PUSH_XMM6_XMM7
73    mov edx, [esp+ 8] ; ref    mov _EAX, prm1 ; cur (assumed aligned)
74    mov ecx, [esp+12] ; stride    mov TMP1, prm2 ; ref
75      mov TMP0, prm3 ; stride
76    
77    pxor xmm6, xmm6 ; accum    pxor xmm6, xmm6 ; accum
78    
# Line 109  Line 88 
88    pshufd  xmm5, xmm6, 00000010b    pshufd  xmm5, xmm6, 00000010b
89    paddusw xmm6, xmm5    paddusw xmm6, xmm5
90    pextrw  eax, xmm6, 0    pextrw  eax, xmm6, 0
91    
92      POP_XMM6_XMM7
93    ret    ret
94  %endmacro  %endmacro
95    
96  ALIGN 16  ALIGN SECTION_ALIGN
97  sad16_sse2:  sad16_sse2:
98    SAD16_SSE2_SSE3 movdqu    SAD16_SSE2_SSE3 movdqu
99  .endfunc  ENDFUNC
100    
101    
102  ALIGN 16  ALIGN SECTION_ALIGN
103  sad16_sse3:  sad16_sse3:
104    SAD16_SSE2_SSE3 lddqu    SAD16_SSE2_SSE3 lddqu
105  .endfunc  ENDFUNC
106    
107    
108  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
109  ; 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);
110  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
111    
112  %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
113    %1 xmm0, [eax]    %1 xmm0, [_EAX]
114    %1 xmm1, [eax+ecx]    %1 xmm1, [_EAX+TMP0]
115    lea eax, [eax+2*ecx]    ; + 2*stride    lea _EAX, [_EAX+2*TMP0]    ; + 2*stride
116    psadbw xmm0, xmm7    psadbw xmm0, xmm7
117    paddusw xmm6, xmm0    paddusw xmm6, xmm0
118    psadbw xmm1, xmm7    psadbw xmm1, xmm7
# Line 140  Line 121 
121    
122    
123  %macro MEAN16_SSE2_SSE3 1  %macro MEAN16_SSE2_SSE3 1
124    mov eax, [esp+ 4]   ; src    PUSH_XMM6_XMM7
125    mov ecx, [esp+ 8]   ; stride    mov _EAX, prm1   ; src
126      mov TMP0, prm2   ; stride
127    
128    pxor xmm6, xmm6     ; accum    pxor xmm6, xmm6     ; accum
129    pxor xmm7, xmm7     ; zero    pxor xmm7, xmm7     ; zero
# Line 156  Line 138 
138    MEAN_16x16_SSE2 %1    MEAN_16x16_SSE2 %1
139    MEAN_16x16_SSE2 %1    MEAN_16x16_SSE2 %1
140    
141    mov eax, [esp+ 4]       ; src again    mov _EAX, prm1       ; src again
142    
143    pshufd   xmm7, xmm6, 10b    pshufd   xmm7, xmm6, 10b
144    paddusw  xmm7, xmm6    paddusw  xmm7, xmm6
# Line 179  Line 161 
161    pshufd   xmm7, xmm6, 10b    pshufd   xmm7, xmm6, 10b
162    paddusw  xmm7, xmm6    paddusw  xmm7, xmm6
163    pextrw eax, xmm7, 0    pextrw eax, xmm7, 0
164    
165      POP_XMM6_XMM7
166    ret    ret
167  %endmacro  %endmacro
168    
169  ALIGN 16  ALIGN SECTION_ALIGN
170  dev16_sse2:  dev16_sse2:
171    MEAN16_SSE2_SSE3 movdqu    MEAN16_SSE2_SSE3 movdqu
172  .endfunc  ENDFUNC
173    
174  ALIGN 16  ALIGN SECTION_ALIGN
175  dev16_sse3:  dev16_sse3:
176    MEAN16_SSE2_SSE3 lddqu    MEAN16_SSE2_SSE3 lddqu
177  .endfunc  ENDFUNC
178    
179    
180  %ifidn __OUTPUT_FORMAT__,elf  %ifidn __OUTPUT_FORMAT__,elf

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

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