[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 1793 - (view) (download)

1 : edgomez 1382 ;/****************************************************************************
2 : suxen_drol 329 ; *
3 : edgomez 1382 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - 3DNow sad operators w/o XMM instructions -
5 : suxen_drol 329 ; *
6 : edgomez 1382 ; * Copyright(C) 2002 Peter ross <pross@xvid.org>
7 : suxen_drol 329 ; *
8 : edgomez 1382 ; * This program is free software; you can redistribute it and/or modify it
9 :     ; * under the terms of the GNU General Public License as published by
10 :     ; * the Free Software Foundation; either version 2 of the License, or
11 :     ; * (at your option) any later version.
12 : suxen_drol 329 ; *
13 : edgomez 1382 ; * This program is distributed in the hope that it will be useful,
14 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 :     ; * GNU General Public License for more details.
17 : suxen_drol 329 ; *
18 : edgomez 1382 ; * You should have received a copy of the GNU General Public License
19 :     ; * along with this program; if not, write to the Free Software
20 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 : suxen_drol 329 ; *
22 : Isibaar 1793 ; * $Id: sad_3dn.asm,v 1.11 2008-11-11 20:46:24 Isibaar Exp $
23 : suxen_drol 329 ; *
24 : edgomez 1382 ; ***************************************************************************/
25 : suxen_drol 329
26 : edgomez 1382 BITS 32
27 : suxen_drol 329
28 : edgomez 1382 %macro cglobal 1
29 : suxen_drol 329 %ifdef PREFIX
30 : edgomez 1535 %ifdef MARK_FUNCS
31 : edgomez 1540 global _%1:function %1.endfunc-%1
32 :     %define %1 _%1:function %1.endfunc-%1
33 : Isibaar 1793 %define ENDFUNC .endfunc
34 : edgomez 1535 %else
35 :     global _%1
36 :     %define %1 _%1
37 : Isibaar 1793 %define ENDFUNC
38 : edgomez 1535 %endif
39 : suxen_drol 329 %else
40 : edgomez 1535 %ifdef MARK_FUNCS
41 : edgomez 1540 global %1:function %1.endfunc-%1
42 : Isibaar 1793 %define ENDFUNC .endfunc
43 : edgomez 1535 %else
44 :     global %1
45 : Isibaar 1793 %define ENDFUNC
46 : edgomez 1535 %endif
47 : suxen_drol 329 %endif
48 :     %endmacro
49 :    
50 : edgomez 1382 ;=============================================================================
51 :     ; Read only data
52 :     ;=============================================================================
53 : suxen_drol 329
54 : edgomez 1382 %ifdef FORMAT_COFF
55 : edgomez 1519 SECTION .rodata
56 : edgomez 1382 %else
57 : edgomez 1519 SECTION .rodata align=16
58 : edgomez 1382 %endif
59 : suxen_drol 329
60 : edgomez 1382 ALIGN 16
61 :     mmx_one:
62 :     times 4 dw 1
63 : suxen_drol 329
64 : edgomez 1382 ;=============================================================================
65 :     ; Helper macros
66 :     ;=============================================================================
67 :     %macro SADBI_16x16_3DN 0
68 :     movq mm0, [eax] ; src
69 :     movq mm2, [eax+8]
70 : suxen_drol 329
71 : edgomez 1382 movq mm1, [edx] ; ref1
72 :     movq mm3, [edx+8]
73 :     pavgusb mm1, [ebx] ; ref2
74 :     lea edx, [edx+ecx]
75 :     pavgusb mm3, [ebx+8]
76 :     lea ebx, [ebx+ecx]
77 : suxen_drol 329
78 : edgomez 1382 movq mm4, mm0
79 :     lea eax, [eax+ecx]
80 :     psubusb mm0, mm1
81 :     movq mm5, mm2
82 :     psubusb mm2, mm3
83 : suxen_drol 329
84 : edgomez 1382 psubusb mm1, mm4
85 :     por mm0, mm1
86 :     psubusb mm3, mm5
87 :     por mm2, mm3
88 : suxen_drol 329
89 : edgomez 1382 movq mm1, mm0
90 :     movq mm3, mm2
91 : suxen_drol 329
92 : edgomez 1382 punpcklbw mm0,mm7
93 :     punpckhbw mm1,mm7
94 :     punpcklbw mm2,mm7
95 :     punpckhbw mm3,mm7
96 : suxen_drol 329
97 : edgomez 1382 paddusw mm0,mm1
98 :     paddusw mm2,mm3
99 :     paddusw mm6,mm0
100 :     paddusw mm6,mm2
101 :     %endmacro
102 : suxen_drol 329
103 : edgomez 1382 %macro SADBI_8x8_3DN 0
104 :     movq mm0, [eax] ; src
105 :     movq mm2, [eax+ecx]
106 : suxen_drol 329
107 : edgomez 1382 movq mm1, [edx] ; ref1
108 :     movq mm3, [edx+ecx]
109 :     pavgusb mm1, [ebx] ; ref2
110 :     lea edx, [edx+2*ecx]
111 :     pavgusb mm3, [ebx+ecx]
112 :     lea ebx, [ebx+2*ecx]
113 : suxen_drol 329
114 : edgomez 1382 movq mm4, mm0
115 :     lea eax, [eax+2*ecx]
116 :     psubusb mm0, mm1
117 :     movq mm5, mm2
118 :     psubusb mm2, mm3
119 : suxen_drol 329
120 : edgomez 1382 psubusb mm1, mm4
121 :     por mm0, mm1
122 :     psubusb mm3, mm5
123 :     por mm2, mm3
124 : suxen_drol 329
125 : edgomez 1382 movq mm1, mm0
126 :     movq mm3, mm2
127 : suxen_drol 329
128 : edgomez 1382 punpcklbw mm0,mm7
129 :     punpckhbw mm1,mm7
130 :     punpcklbw mm2,mm7
131 :     punpckhbw mm3,mm7
132 : suxen_drol 329
133 : edgomez 1382 paddusw mm0,mm1
134 :     paddusw mm2,mm3
135 :     paddusw mm6,mm0
136 :     paddusw mm6,mm2
137 :     %endmacro
138 : suxen_drol 329
139 : edgomez 1382 ;=============================================================================
140 :     ; Code
141 :     ;=============================================================================
142 : suxen_drol 329
143 : edgomez 1382 SECTION .text
144 : suxen_drol 329
145 : edgomez 1382 cglobal sad16bi_3dn
146 :     cglobal sad8bi_3dn
147 : suxen_drol 329
148 : edgomez 1382 ;-----------------------------------------------------------------------------
149 :     ;
150 :     ; uint32_t sad16bi_3dn(const uint8_t * const cur,
151 :     ; const uint8_t * const ref1,
152 :     ; const uint8_t * const ref2,
153 :     ; const uint32_t stride);
154 :     ;
155 :     ;-----------------------------------------------------------------------------
156 : suxen_drol 329
157 : edgomez 1382 ALIGN 16
158 :     sad16bi_3dn:
159 :     push ebx
160 :     mov eax, [esp+4+ 4] ; Src
161 :     mov edx, [esp+4+ 8] ; Ref1
162 :     mov ebx, [esp+4+12] ; Ref2
163 :     mov ecx, [esp+4+16] ; Stride
164 : suxen_drol 329
165 : edgomez 1382 pxor mm6, mm6 ; accum2
166 :     pxor mm7, mm7
167 : Isibaar 1793 .Loop:
168 : edgomez 1382 SADBI_16x16_3DN
169 :     SADBI_16x16_3DN
170 :     SADBI_16x16_3DN
171 :     SADBI_16x16_3DN
172 :     SADBI_16x16_3DN
173 :     SADBI_16x16_3DN
174 :     SADBI_16x16_3DN
175 :     SADBI_16x16_3DN
176 : suxen_drol 329
177 : edgomez 1382 SADBI_16x16_3DN
178 :     SADBI_16x16_3DN
179 :     SADBI_16x16_3DN
180 :     SADBI_16x16_3DN
181 :     SADBI_16x16_3DN
182 :     SADBI_16x16_3DN
183 :     SADBI_16x16_3DN
184 :     SADBI_16x16_3DN
185 : suxen_drol 329
186 : edgomez 1382 pmaddwd mm6, [mmx_one] ; collapse
187 :     movq mm7, mm6
188 :     psrlq mm7, 32
189 :     paddd mm6, mm7
190 : suxen_drol 329
191 : edgomez 1382 movd eax, mm6
192 : suxen_drol 329
193 : edgomez 1382 pop ebx
194 : suxen_drol 329
195 : edgomez 1382 ret
196 : Isibaar 1793 ENDFUNC
197 : suxen_drol 329
198 : edgomez 1382 ;-----------------------------------------------------------------------------
199 :     ;
200 :     ; uint32_t sad8bi_3dn(const uint8_t * const cur,
201 :     ; const uint8_t * const ref1,
202 :     ; const uint8_t * const ref2,
203 :     ; const uint32_t stride);
204 :     ;
205 :     ;-----------------------------------------------------------------------------
206 : suxen_drol 329
207 : edgomez 1382 ALIGN 16
208 :     sad8bi_3dn:
209 :     push ebx
210 :     mov eax, [esp+4+ 4] ; Src
211 :     mov edx, [esp+4+ 8] ; Ref1
212 :     mov ebx, [esp+4+12] ; Ref2
213 :     mov ecx, [esp+4+16] ; Stride
214 : suxen_drol 329
215 : edgomez 1382 pxor mm6, mm6 ; accum2
216 :     pxor mm7, mm7
217 : Isibaar 1793 .Loop:
218 : edgomez 1382 SADBI_8x8_3DN
219 :     SADBI_8x8_3DN
220 :     SADBI_8x8_3DN
221 :     SADBI_8x8_3DN
222 : suxen_drol 329
223 : edgomez 1382 pmaddwd mm6, [mmx_one] ; collapse
224 :     movq mm7, mm6
225 :     psrlq mm7, 32
226 :     paddd mm6, mm7
227 : suxen_drol 329
228 : edgomez 1382 movd eax, mm6
229 : suxen_drol 329
230 : edgomez 1382 pop ebx
231 : suxen_drol 329
232 : edgomez 1382 ret
233 : Isibaar 1793 ENDFUNC
234 : edgomez 1540
235 : Isibaar 1790
236 :     %ifidn __OUTPUT_FORMAT__,elf
237 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
238 :     %endif
239 :    

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