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

Annotation of /xvidcore/src/motion/x86_asm/sad_sse2.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (view) (download)

1 : edgomez 1.9 ;/****************************************************************************
2 : Isibaar 1.1 ; *
3 : edgomez 1.9 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - SSE2 optimized SAD operators -
5 : Isibaar 1.1 ; *
6 : edgomez 1.9 ; * Copyright(C) 2003 Pascal Massimino <skal@planet-d.net>
7 : Isibaar 1.1 ; *
8 : chl 1.3 ; *
9 : edgomez 1.9 ; * This program is free software; you can redistribute it and/or modify it
10 :     ; * under the terms of the GNU General Public License as published by
11 :     ; * the Free Software Foundation; either version 2 of the License, or
12 :     ; * (at your option) any later version.
13 : edgomez 1.7 ; *
14 : edgomez 1.9 ; * This program is distributed in the hope that it will be useful,
15 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 :     ; * GNU General Public License for more details.
18 : Isibaar 1.1 ; *
19 : edgomez 1.9 ; * You should have received a copy of the GNU General Public License
20 :     ; * along with this program; if not, write to the Free Software
21 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : edgomez 1.8 ; *
23 : Isibaar 1.16 ; * $Id: sad_sse2.asm,v 1.15 2008/11/11 20:46:24 Isibaar Exp $
24 : edgomez 1.8 ; *
25 : edgomez 1.9 ; ***************************************************************************/
26 : Isibaar 1.1
27 : Isibaar 1.16 %include "nasm.inc"
28 : Isibaar 1.1
29 : edgomez 1.9 ;=============================================================================
30 :     ; Read only data
31 :     ;=============================================================================
32 : Isibaar 1.1
33 : Isibaar 1.16 DATA
34 : Isibaar 1.1
35 : Isibaar 1.16 ALIGN SECTION_ALIGN
36 : Isibaar 1.1 zero times 4 dd 0
37 :    
38 : edgomez 1.9 ;=============================================================================
39 :     ; Code
40 :     ;=============================================================================
41 :    
42 : Isibaar 1.16 SECTION .rotext align=SECTION_ALIGN
43 : Isibaar 1.1
44 :     cglobal sad16_sse2
45 :     cglobal dev16_sse2
46 :    
47 : Isibaar 1.13 cglobal sad16_sse3
48 :     cglobal dev16_sse3
49 :    
50 : edgomez 1.9 ;-----------------------------------------------------------------------------
51 :     ; uint32_t sad16_sse2 (const uint8_t * const cur, <- assumed aligned!
52 :     ; const uint8_t * const ref,
53 :     ; const uint32_t stride,
54 :     ; const uint32_t /*ignored*/);
55 :     ;-----------------------------------------------------------------------------
56 :    
57 :    
58 : Isibaar 1.13 %macro SAD_16x16_SSE2 1
59 : Isibaar 1.16 %1 xmm0, [TMP1]
60 :     %1 xmm1, [TMP1+TMP0]
61 :     lea TMP1,[TMP1+2*TMP0]
62 :     movdqa xmm2, [_EAX]
63 :     movdqa xmm3, [_EAX+TMP0]
64 :     lea _EAX,[_EAX+2*TMP0]
65 : edgomez 1.9 psadbw xmm0, xmm2
66 :     paddusw xmm6,xmm0
67 :     psadbw xmm1, xmm3
68 :     paddusw xmm6,xmm1
69 :     %endmacro
70 :    
71 : Isibaar 1.13 %macro SAD16_SSE2_SSE3 1
72 : Isibaar 1.16 mov _EAX, prm1 ; cur (assumed aligned)
73 :     mov TMP1, prm2 ; ref
74 :     mov TMP0, prm3 ; stride
75 : edgomez 1.9
76 :     pxor xmm6, xmm6 ; accum
77 :    
78 : Isibaar 1.13 SAD_16x16_SSE2 %1
79 :     SAD_16x16_SSE2 %1
80 :     SAD_16x16_SSE2 %1
81 :     SAD_16x16_SSE2 %1
82 :     SAD_16x16_SSE2 %1
83 :     SAD_16x16_SSE2 %1
84 :     SAD_16x16_SSE2 %1
85 :     SAD_16x16_SSE2 %1
86 : edgomez 1.9
87 :     pshufd xmm5, xmm6, 00000010b
88 :     paddusw xmm6, xmm5
89 :     pextrw eax, xmm6, 0
90 :     ret
91 : Isibaar 1.13 %endmacro
92 :    
93 : Isibaar 1.16 ALIGN SECTION_ALIGN
94 : Isibaar 1.13 sad16_sse2:
95 :     SAD16_SSE2_SSE3 movdqu
96 : Isibaar 1.15 ENDFUNC
97 : Isibaar 1.13
98 :    
99 : Isibaar 1.16 ALIGN SECTION_ALIGN
100 : Isibaar 1.13 sad16_sse3:
101 :     SAD16_SSE2_SSE3 lddqu
102 : Isibaar 1.15 ENDFUNC
103 : edgomez 1.9
104 :    
105 :     ;-----------------------------------------------------------------------------
106 :     ; uint32_t dev16_sse2(const uint8_t * const cur, const uint32_t stride);
107 :     ;-----------------------------------------------------------------------------
108 :    
109 : Isibaar 1.16 %macro MEAN_16x16_SSE2 1 ; _EAX: src, TMP0:stride, mm7: zero or mean => mm6: result
110 :     %1 xmm0, [_EAX]
111 :     %1 xmm1, [_EAX+TMP0]
112 :     lea _EAX, [_EAX+2*TMP0] ; + 2*stride
113 : edgomez 1.9 psadbw xmm0, xmm7
114 :     paddusw xmm6, xmm0
115 :     psadbw xmm1, xmm7
116 :     paddusw xmm6, xmm1
117 :     %endmacro
118 :    
119 :    
120 : Isibaar 1.13 %macro MEAN16_SSE2_SSE3 1
121 : Isibaar 1.16 mov _EAX, prm1 ; src
122 :     mov TMP0, prm2 ; stride
123 : edgomez 1.9
124 :     pxor xmm6, xmm6 ; accum
125 :     pxor xmm7, xmm7 ; zero
126 :    
127 : Isibaar 1.13 MEAN_16x16_SSE2 %1
128 :     MEAN_16x16_SSE2 %1
129 :     MEAN_16x16_SSE2 %1
130 :     MEAN_16x16_SSE2 %1
131 :    
132 :     MEAN_16x16_SSE2 %1
133 :     MEAN_16x16_SSE2 %1
134 :     MEAN_16x16_SSE2 %1
135 :     MEAN_16x16_SSE2 %1
136 : edgomez 1.9
137 : Isibaar 1.16 mov _EAX, prm1 ; src again
138 : edgomez 1.9
139 :     pshufd xmm7, xmm6, 10b
140 :     paddusw xmm7, xmm6
141 :     pxor xmm6, xmm6 ; zero accum
142 :     psrlw xmm7, 8 ; => Mean
143 :     pshuflw xmm7, xmm7, 0 ; replicate Mean
144 :     packuswb xmm7, xmm7
145 :     pshufd xmm7, xmm7, 00000000b
146 :    
147 : Isibaar 1.13 MEAN_16x16_SSE2 %1
148 :     MEAN_16x16_SSE2 %1
149 :     MEAN_16x16_SSE2 %1
150 :     MEAN_16x16_SSE2 %1
151 :    
152 :     MEAN_16x16_SSE2 %1
153 :     MEAN_16x16_SSE2 %1
154 :     MEAN_16x16_SSE2 %1
155 :     MEAN_16x16_SSE2 %1
156 : edgomez 1.9
157 :     pshufd xmm7, xmm6, 10b
158 :     paddusw xmm7, xmm6
159 :     pextrw eax, xmm7, 0
160 :     ret
161 : Isibaar 1.13 %endmacro
162 :    
163 : Isibaar 1.16 ALIGN SECTION_ALIGN
164 : Isibaar 1.13 dev16_sse2:
165 :     MEAN16_SSE2_SSE3 movdqu
166 : Isibaar 1.15 ENDFUNC
167 : edgomez 1.12
168 : Isibaar 1.16 ALIGN SECTION_ALIGN
169 : Isibaar 1.13 dev16_sse3:
170 :     MEAN16_SSE2_SSE3 lddqu
171 : Isibaar 1.15 ENDFUNC
172 : Isibaar 1.14
173 :    
174 :     %ifidn __OUTPUT_FORMAT__,elf
175 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
176 :     %endif
177 :    

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