[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 1382, Mon Mar 22 22:36:25 2004 UTC revision 1793, Tue Nov 11 20:46:24 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.9 2004-03-22 22:36:24 edgomez Exp $  ; * $Id: sad_sse2.asm,v 1.15 2008-11-11 20:46:24 Isibaar Exp $
24  ; *  ; *
25  ; ***************************************************************************/  ; ***************************************************************************/
26    
# Line 28  Line 28 
28    
29  %macro cglobal 1  %macro cglobal 1
30          %ifdef PREFIX          %ifdef PREFIX
31                    %ifdef MARK_FUNCS
32                            global _%1:function %1.endfunc-%1
33                            %define %1 _%1:function %1.endfunc-%1
34                            %define ENDFUNC .endfunc
35                    %else
36                  global _%1                  global _%1
37                  %define %1 _%1                  %define %1 _%1
38                            %define ENDFUNC
39                    %endif
40            %else
41                    %ifdef MARK_FUNCS
42                            global %1:function %1.endfunc-%1
43                            %define ENDFUNC .endfunc
44          %else          %else
45                  global %1                  global %1
46                            %define ENDFUNC
47                    %endif
48          %endif          %endif
49  %endmacro  %endmacro
50    
# Line 40  Line 53 
53  ;=============================================================================  ;=============================================================================
54    
55  %ifdef FORMAT_COFF  %ifdef FORMAT_COFF
56  SECTION .rodata data  SECTION .rodata
57  %else  %else
58  SECTION .rodata data align=16  SECTION .rodata align=16
59  %endif  %endif
60    
61  ALIGN 64  ALIGN 64
# Line 57  Line 70 
70  cglobal  sad16_sse2  cglobal  sad16_sse2
71  cglobal  dev16_sse2  cglobal  dev16_sse2
72    
73    cglobal  sad16_sse3
74    cglobal  dev16_sse3
75    
76  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
77  ; uint32_t sad16_sse2 (const uint8_t * const cur, <- assumed aligned!  ; uint32_t sad16_sse2 (const uint8_t * const cur, <- assumed aligned!
78  ;                      const uint8_t * const ref,  ;                      const uint8_t * const ref,
# Line 65  Line 81 
81  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
82    
83    
84  %macro SAD_16x16_SSE2 0  %macro SAD_16x16_SSE2 1
85    movdqu  xmm0, [edx]    %1  xmm0, [edx]
86    movdqu  xmm1, [edx+ecx]    %1  xmm1, [edx+ecx]
87    lea edx,[edx+2*ecx]    lea edx,[edx+2*ecx]
88    movdqa  xmm2, [eax]    movdqa  xmm2, [eax]
89    movdqa  xmm3, [eax+ecx]    movdqa  xmm3, [eax+ecx]
# Line 78  Line 94 
94    paddusw xmm6,xmm1    paddusw xmm6,xmm1
95  %endmacro  %endmacro
96    
97  ALIGN 16  %macro SAD16_SSE2_SSE3 1
 sad16_sse2:  
98    mov eax, [esp+ 4] ; cur (assumed aligned)    mov eax, [esp+ 4] ; cur (assumed aligned)
99    mov edx, [esp+ 8] ; ref    mov edx, [esp+ 8] ; ref
100    mov ecx, [esp+12] ; stride    mov ecx, [esp+12] ; stride
101    
102    pxor xmm6, xmm6 ; accum    pxor xmm6, xmm6 ; accum
103    
104    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
105    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
106    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
107    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
108    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
109    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
110    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
111    SAD_16x16_SSE2    SAD_16x16_SSE2 %1
112    
113    pshufd  xmm5, xmm6, 00000010b    pshufd  xmm5, xmm6, 00000010b
114    paddusw xmm6, xmm5    paddusw xmm6, xmm5
115    pextrw  eax, xmm6, 0    pextrw  eax, xmm6, 0
116    ret    ret
117    %endmacro
118    
119    ALIGN 16
120    sad16_sse2:
121      SAD16_SSE2_SSE3 movdqu
122    ENDFUNC
123    
124    
125    ALIGN 16
126    sad16_sse3:
127      SAD16_SSE2_SSE3 lddqu
128    ENDFUNC
129    
130    
131  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
132  ; 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);
133  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
134    
135  %macro MEAN_16x16_SSE2 0  ; eax: src, ecx:stride, mm7: zero or mean => mm6: result  %macro MEAN_16x16_SSE2 1  ; eax: src, ecx:stride, mm7: zero or mean => mm6: result
136    movdqu xmm0, [eax]    %1 xmm0, [eax]
137    movdqu xmm1, [eax+ecx]    %1 xmm1, [eax+ecx]
138    lea eax, [eax+2*ecx]    ; + 2*stride    lea eax, [eax+2*ecx]    ; + 2*stride
139    psadbw xmm0, xmm7    psadbw xmm0, xmm7
140    paddusw xmm6, xmm0    paddusw xmm6, xmm0
# Line 116  Line 143 
143  %endmacro  %endmacro
144    
145    
146  ALIGN 16  %macro MEAN16_SSE2_SSE3 1
 dev16_sse2:  
147    mov eax, [esp+ 4]   ; src    mov eax, [esp+ 4]   ; src
148    mov ecx, [esp+ 8]   ; stride    mov ecx, [esp+ 8]   ; stride
149    
150    pxor xmm6, xmm6     ; accum    pxor xmm6, xmm6     ; accum
151    pxor xmm7, xmm7     ; zero    pxor xmm7, xmm7     ; zero
152    
153    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
154    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
155    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
156    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
157    
158    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
159    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
160    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
161    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
162    
163    mov eax, [esp+ 4]       ; src again    mov eax, [esp+ 4]       ; src again
164    
# Line 144  Line 170 
170    packuswb xmm7, xmm7    packuswb xmm7, xmm7
171    pshufd   xmm7, xmm7, 00000000b    pshufd   xmm7, xmm7, 00000000b
172    
173    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
174    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
175    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
176    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
177    
178    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
179    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
180    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
181    MEAN_16x16_SSE2    MEAN_16x16_SSE2 %1
182    
183    pshufd   xmm7, xmm6, 10b    pshufd   xmm7, xmm6, 10b
184    paddusw  xmm7, xmm6    paddusw  xmm7, xmm6
185    pextrw eax, xmm7, 0    pextrw eax, xmm7, 0
186    ret    ret
187    %endmacro
188    
189    ALIGN 16
190    dev16_sse2:
191      MEAN16_SSE2_SSE3 movdqu
192    ENDFUNC
193    
194    ALIGN 16
195    dev16_sse3:
196      MEAN16_SSE2_SSE3 lddqu
197    ENDFUNC
198    
199    
200    %ifidn __OUTPUT_FORMAT__,elf
201    section ".note.GNU-stack" noalloc noexec nowrite progbits
202    %endif
203    

Legend:
Removed from v.1382  
changed lines
  Added in v.1793

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