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

Annotation of /trunk/xvidcore/src/motion/x86_asm/sad_3dn.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 652 - (view) (download)

1 : chl 430 ;/*****************************************************************************
2 : suxen_drol 329 ; *
3 : chl 430 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * 3dnow (*but without xmm*) sum of absolute difference
5 : suxen_drol 329 ; *
6 : chl 430 ; * Copyright(C) 2002 Peter Ross <pross@xvid.org>
7 : suxen_drol 329 ; *
8 : edgomez 652 ; * This file is part of XviD, a free MPEG-4 video encoder/decoder
9 : suxen_drol 329 ; *
10 : edgomez 652 ; * XviD is free software; you can redistribute it and/or modify it
11 :     ; * under the terms of the GNU General Public License as published by
12 : chl 430 ; * the Free Software Foundation; either version 2 of the License, or
13 :     ; * (at your option) any later version.
14 : suxen_drol 329 ; *
15 : chl 430 ; * This program is distributed in the hope that it will be useful,
16 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 :     ; * GNU General Public License for more details.
19 : suxen_drol 329 ; *
20 : chl 430 ; * You should have received a copy of the GNU General Public License
21 :     ; * along with this program; if not, write to the Free Software
22 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 : suxen_drol 329 ; *
24 : edgomez 652 ; * Under section 8 of the GNU General Public License, the copyright
25 :     ; * holders of XVID explicitly forbid distribution in the following
26 :     ; * countries:
27 :     ; *
28 :     ; * - Japan
29 :     ; * - United States of America
30 :     ; *
31 :     ; * Linking XviD statically or dynamically with other modules is making a
32 :     ; * combined work based on XviD. Thus, the terms and conditions of the
33 :     ; * GNU General Public License cover the whole combination.
34 :     ; *
35 :     ; * As a special exception, the copyright holders of XviD give you
36 :     ; * permission to link XviD with independent modules that communicate with
37 :     ; * XviD solely through the VFW1.1 and DShow interfaces, regardless of the
38 :     ; * license terms of these independent modules, and to copy and distribute
39 :     ; * the resulting combined work under terms of your choice, provided that
40 :     ; * every copy of the combined work is accompanied by a complete copy of
41 :     ; * the source code of XviD (the version of XviD used to produce the
42 :     ; * combined work), being distributed under the terms of the GNU General
43 :     ; * Public License plus this exception. An independent module is a module
44 :     ; * which is not derived from or based on XviD.
45 :     ; *
46 :     ; * Note that people who make modified versions of XviD are not obligated
47 :     ; * to grant this special exception for their modified versions; it is
48 :     ; * their choice whether to do so. The GNU General Public License gives
49 :     ; * permission to release a modified version without this exception; this
50 :     ; * exception also makes it possible to release a modified version which
51 :     ; * carries forward this exception.
52 :     ; *
53 :     ; * $Id: sad_3dn.asm,v 1.4 2002-11-17 00:32:06 edgomez Exp $
54 :     ; *
55 : chl 436 ; ****************************************************************************/
56 : suxen_drol 329
57 :     bits 32
58 :    
59 :     %macro cglobal 1
60 :     %ifdef PREFIX
61 :     global _%1
62 :     %define %1 _%1
63 :     %else
64 :     global %1
65 :     %endif
66 :     %endmacro
67 :    
68 :     section .data
69 :    
70 :     align 16
71 :     mmx_one times 4 dw 1
72 :    
73 :     section .text
74 :    
75 :     cglobal sad16bi_3dn
76 :     cglobal sad8bi_3dn
77 :    
78 :     ;===========================================================================
79 :     ;
80 :     ; uint32_t sad16bi_3dn(const uint8_t * const cur,
81 :     ; const uint8_t * const ref1,
82 :     ; const uint8_t * const ref2,
83 :     ; const uint32_t stride);
84 :     ;
85 :     ;===========================================================================
86 :    
87 :     %macro SADBI_16x16_3DN 0
88 :     movq mm0, [eax] ; src
89 :     movq mm2, [eax+8]
90 :    
91 :     movq mm1, [edx] ; ref1
92 :     movq mm3, [edx+8]
93 :     pavgusb mm1, [ebx] ; ref2
94 :     lea edx,[edx+ecx]
95 :     pavgusb mm3, [ebx+8]
96 :     lea ebx,[ebx+ecx]
97 :    
98 :     movq mm4, mm0
99 :     lea eax,[eax+ecx]
100 :     psubusb mm0, mm1
101 :     movq mm5, mm2
102 :     psubusb mm2, mm3
103 :    
104 :     psubusb mm1, mm4
105 :     por mm0, mm1
106 :     psubusb mm3, mm5
107 :     por mm2, mm3
108 :    
109 :     movq mm1,mm0
110 :     movq mm3,mm2
111 :    
112 :     punpcklbw mm0,mm7
113 :     punpckhbw mm1,mm7
114 :     punpcklbw mm2,mm7
115 :     punpckhbw mm3,mm7
116 :    
117 :     paddusw mm0,mm1
118 :     paddusw mm2,mm3
119 :     paddusw mm6,mm0
120 :     paddusw mm6,mm2
121 :     %endmacro
122 :    
123 :     align 16
124 :     sad16bi_3dn:
125 :     push ebx
126 :     mov eax, [esp+4+ 4] ; Src
127 :     mov edx, [esp+4+ 8] ; Ref1
128 :     mov ebx, [esp+4+12] ; Ref2
129 :     mov ecx, [esp+4+16] ; Stride
130 :    
131 :     pxor mm6, mm6 ; accum2
132 :     pxor mm7, mm7
133 :     .Loop
134 :     SADBI_16x16_3DN
135 :     SADBI_16x16_3DN
136 :     SADBI_16x16_3DN
137 :     SADBI_16x16_3DN
138 :     SADBI_16x16_3DN
139 :     SADBI_16x16_3DN
140 :     SADBI_16x16_3DN
141 :     SADBI_16x16_3DN
142 :    
143 :     SADBI_16x16_3DN
144 :     SADBI_16x16_3DN
145 :     SADBI_16x16_3DN
146 :     SADBI_16x16_3DN
147 :     SADBI_16x16_3DN
148 :     SADBI_16x16_3DN
149 :     SADBI_16x16_3DN
150 :     SADBI_16x16_3DN
151 :    
152 :     pmaddwd mm6, [mmx_one] ; collapse
153 :     movq mm7, mm6
154 :     psrlq mm7, 32
155 :     paddd mm6, mm7
156 :    
157 :     movd eax, mm6
158 :    
159 :     pop ebx
160 :    
161 :     ret
162 :    
163 :    
164 :    
165 :     ;===========================================================================
166 :     ;
167 :     ; uint32_t sad8bi_3dn(const uint8_t * const cur,
168 :     ; const uint8_t * const ref1,
169 :     ; const uint8_t * const ref2,
170 :     ; const uint32_t stride);
171 :     ;
172 :     ;===========================================================================
173 :    
174 :     %macro SADBI_8x8_3DN 0
175 :     movq mm0, [eax] ; src
176 :     movq mm2, [eax+ecx]
177 :    
178 :     movq mm1, [edx] ; ref1
179 :     movq mm3, [edx+ecx]
180 :     pavgusb mm1, [ebx] ; ref2
181 :     lea edx,[edx+2*ecx]
182 :     pavgusb mm3, [ebx+ecx]
183 :     lea ebx,[ebx+2*ecx]
184 :    
185 :     movq mm4, mm0
186 :     lea eax,[eax+2*ecx]
187 :     psubusb mm0, mm1
188 :     movq mm5, mm2
189 :     psubusb mm2, mm3
190 :    
191 :     psubusb mm1, mm4
192 :     por mm0, mm1
193 :     psubusb mm3, mm5
194 :     por mm2, mm3
195 :    
196 :     movq mm1,mm0
197 :     movq mm3,mm2
198 :    
199 :     punpcklbw mm0,mm7
200 :     punpckhbw mm1,mm7
201 :     punpcklbw mm2,mm7
202 :     punpckhbw mm3,mm7
203 :    
204 :     paddusw mm0,mm1
205 :     paddusw mm2,mm3
206 :     paddusw mm6,mm0
207 :     paddusw mm6,mm2
208 :     %endmacro
209 :    
210 :     align 16
211 :     sad8bi_3dn:
212 :     push ebx
213 :     mov eax, [esp+4+ 4] ; Src
214 :     mov edx, [esp+4+ 8] ; Ref1
215 :     mov ebx, [esp+4+12] ; Ref2
216 :     mov ecx, [esp+4+16] ; Stride
217 :    
218 :     pxor mm6, mm6 ; accum2
219 :     pxor mm7, mm7
220 :     .Loop
221 :     SADBI_8x8_3DN
222 :     SADBI_8x8_3DN
223 :     SADBI_8x8_3DN
224 :     SADBI_8x8_3DN
225 :    
226 :     pmaddwd mm6, [mmx_one] ; collapse
227 :     movq mm7, mm6
228 :     psrlq mm7, 32
229 :     paddd mm6, mm7
230 :    
231 :     movd eax, mm6
232 :    
233 :     pop ebx
234 :    
235 :     ret

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