[svn] / branches / dev-api-4 / xvidcore / src / motion / x86_asm / sad_3dn.asm Repository:
ViewVC logotype

Annotation of /branches/dev-api-4/xvidcore/src/motion/x86_asm/sad_3dn.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 436 - (view) (download)
Original Path: trunk/xvidcore/src/motion/x86_asm/sad_3dn.asm

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 : chl 430 ; * This program is an implementation of a part of one or more MPEG-4
9 :     ; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending
10 :     ; * to use this software module in hardware or software products are
11 :     ; * advised that its use may infringe existing patents or copyrights, and
12 :     ; * any such use would be at such party's own risk. The original
13 :     ; * developer of this software module and his/her company, and subsequent
14 :     ; * editors and their companies, will have no liability for use of this
15 :     ; * software or modifications or derivatives thereof.
16 : suxen_drol 329 ; *
17 : chl 430 ; * This program is free software; you can redistribute it and/or modify
18 :     ; * it under the terms of the GNU General Public License as published by
19 :     ; * the Free Software Foundation; either version 2 of the License, or
20 :     ; * (at your option) any later version.
21 : suxen_drol 329 ; *
22 : chl 430 ; * This program is distributed in the hope that it will be useful,
23 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 :     ; * GNU General Public License for more details.
26 : suxen_drol 329 ; *
27 : chl 430 ; * You should have received a copy of the GNU General Public License
28 :     ; * along with this program; if not, write to the Free Software
29 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 : suxen_drol 329 ; *
31 : chl 436 ; ****************************************************************************/
32 : suxen_drol 329
33 :     bits 32
34 :    
35 :     %macro cglobal 1
36 :     %ifdef PREFIX
37 :     global _%1
38 :     %define %1 _%1
39 :     %else
40 :     global %1
41 :     %endif
42 :     %endmacro
43 :    
44 :     section .data
45 :    
46 :     align 16
47 :     mmx_one times 4 dw 1
48 :    
49 :     section .text
50 :    
51 :     cglobal sad16bi_3dn
52 :     cglobal sad8bi_3dn
53 :    
54 :     ;===========================================================================
55 :     ;
56 :     ; uint32_t sad16bi_3dn(const uint8_t * const cur,
57 :     ; const uint8_t * const ref1,
58 :     ; const uint8_t * const ref2,
59 :     ; const uint32_t stride);
60 :     ;
61 :     ;===========================================================================
62 :    
63 :     %macro SADBI_16x16_3DN 0
64 :     movq mm0, [eax] ; src
65 :     movq mm2, [eax+8]
66 :    
67 :     movq mm1, [edx] ; ref1
68 :     movq mm3, [edx+8]
69 :     pavgusb mm1, [ebx] ; ref2
70 :     lea edx,[edx+ecx]
71 :     pavgusb mm3, [ebx+8]
72 :     lea ebx,[ebx+ecx]
73 :    
74 :     movq mm4, mm0
75 :     lea eax,[eax+ecx]
76 :     psubusb mm0, mm1
77 :     movq mm5, mm2
78 :     psubusb mm2, mm3
79 :    
80 :     psubusb mm1, mm4
81 :     por mm0, mm1
82 :     psubusb mm3, mm5
83 :     por mm2, mm3
84 :    
85 :     movq mm1,mm0
86 :     movq mm3,mm2
87 :    
88 :     punpcklbw mm0,mm7
89 :     punpckhbw mm1,mm7
90 :     punpcklbw mm2,mm7
91 :     punpckhbw mm3,mm7
92 :    
93 :     paddusw mm0,mm1
94 :     paddusw mm2,mm3
95 :     paddusw mm6,mm0
96 :     paddusw mm6,mm2
97 :     %endmacro
98 :    
99 :     align 16
100 :     sad16bi_3dn:
101 :     push ebx
102 :     mov eax, [esp+4+ 4] ; Src
103 :     mov edx, [esp+4+ 8] ; Ref1
104 :     mov ebx, [esp+4+12] ; Ref2
105 :     mov ecx, [esp+4+16] ; Stride
106 :    
107 :     pxor mm6, mm6 ; accum2
108 :     pxor mm7, mm7
109 :     .Loop
110 :     SADBI_16x16_3DN
111 :     SADBI_16x16_3DN
112 :     SADBI_16x16_3DN
113 :     SADBI_16x16_3DN
114 :     SADBI_16x16_3DN
115 :     SADBI_16x16_3DN
116 :     SADBI_16x16_3DN
117 :     SADBI_16x16_3DN
118 :    
119 :     SADBI_16x16_3DN
120 :     SADBI_16x16_3DN
121 :     SADBI_16x16_3DN
122 :     SADBI_16x16_3DN
123 :     SADBI_16x16_3DN
124 :     SADBI_16x16_3DN
125 :     SADBI_16x16_3DN
126 :     SADBI_16x16_3DN
127 :    
128 :     pmaddwd mm6, [mmx_one] ; collapse
129 :     movq mm7, mm6
130 :     psrlq mm7, 32
131 :     paddd mm6, mm7
132 :    
133 :     movd eax, mm6
134 :    
135 :     pop ebx
136 :    
137 :     ret
138 :    
139 :    
140 :    
141 :     ;===========================================================================
142 :     ;
143 :     ; uint32_t sad8bi_3dn(const uint8_t * const cur,
144 :     ; const uint8_t * const ref1,
145 :     ; const uint8_t * const ref2,
146 :     ; const uint32_t stride);
147 :     ;
148 :     ;===========================================================================
149 :    
150 :     %macro SADBI_8x8_3DN 0
151 :     movq mm0, [eax] ; src
152 :     movq mm2, [eax+ecx]
153 :    
154 :     movq mm1, [edx] ; ref1
155 :     movq mm3, [edx+ecx]
156 :     pavgusb mm1, [ebx] ; ref2
157 :     lea edx,[edx+2*ecx]
158 :     pavgusb mm3, [ebx+ecx]
159 :     lea ebx,[ebx+2*ecx]
160 :    
161 :     movq mm4, mm0
162 :     lea eax,[eax+2*ecx]
163 :     psubusb mm0, mm1
164 :     movq mm5, mm2
165 :     psubusb mm2, mm3
166 :    
167 :     psubusb mm1, mm4
168 :     por mm0, mm1
169 :     psubusb mm3, mm5
170 :     por mm2, mm3
171 :    
172 :     movq mm1,mm0
173 :     movq mm3,mm2
174 :    
175 :     punpcklbw mm0,mm7
176 :     punpckhbw mm1,mm7
177 :     punpcklbw mm2,mm7
178 :     punpckhbw mm3,mm7
179 :    
180 :     paddusw mm0,mm1
181 :     paddusw mm2,mm3
182 :     paddusw mm6,mm0
183 :     paddusw mm6,mm2
184 :     %endmacro
185 :    
186 :     align 16
187 :     sad8bi_3dn:
188 :     push ebx
189 :     mov eax, [esp+4+ 4] ; Src
190 :     mov edx, [esp+4+ 8] ; Ref1
191 :     mov ebx, [esp+4+12] ; Ref2
192 :     mov ecx, [esp+4+16] ; Stride
193 :    
194 :     pxor mm6, mm6 ; accum2
195 :     pxor mm7, mm7
196 :     .Loop
197 :     SADBI_8x8_3DN
198 :     SADBI_8x8_3DN
199 :     SADBI_8x8_3DN
200 :     SADBI_8x8_3DN
201 :    
202 :     pmaddwd mm6, [mmx_one] ; collapse
203 :     movq mm7, mm6
204 :     psrlq mm7, 32
205 :     paddd mm6, mm7
206 :    
207 :     movd eax, mm6
208 :    
209 :     pop ebx
210 :    
211 :     ret

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