Parent Directory | Revision Log
Revision 1.1 - (view) (download)
1 : | suxen_drol | 1.1 | ;/************************************************************************** |
2 : | ; * | ||
3 : | ; * XVID MPEG-4 VIDEO CODEC | ||
4 : | ; * 3dnow (*but without xmm*) sum of absolute difference | ||
5 : | ; * | ||
6 : | ; * This program is free software; you can redistribute it and/or modify | ||
7 : | ; * it under the terms of the GNU General Public License as published by | ||
8 : | ; * the Free Software Foundation; either version 2 of the License, or | ||
9 : | ; * (at your option) any later version. | ||
10 : | ; * | ||
11 : | ; * This program is distributed in the hope that it will be useful, | ||
12 : | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 : | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 : | ; * GNU General Public License for more details. | ||
15 : | ; * | ||
16 : | ; * You should have received a copy of the GNU General Public License | ||
17 : | ; * along with this program; if not, write to the Free Software | ||
18 : | ; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 : | ; * | ||
20 : | ; *************************************************************************/ | ||
21 : | |||
22 : | ;/************************************************************************** | ||
23 : | ; * | ||
24 : | ; * History: | ||
25 : | ; * | ||
26 : | ; * 23.07.2002 sad[16,8]bi_3dn; <pross@xvid.org> | ||
27 : | ; * | ||
28 : | ; *************************************************************************/ | ||
29 : | |||
30 : | bits 32 | ||
31 : | |||
32 : | %macro cglobal 1 | ||
33 : | %ifdef PREFIX | ||
34 : | global _%1 | ||
35 : | %define %1 _%1 | ||
36 : | %else | ||
37 : | global %1 | ||
38 : | %endif | ||
39 : | %endmacro | ||
40 : | |||
41 : | section .data | ||
42 : | |||
43 : | align 16 | ||
44 : | mmx_one times 4 dw 1 | ||
45 : | |||
46 : | section .text | ||
47 : | |||
48 : | cglobal sad16bi_3dn | ||
49 : | cglobal sad8bi_3dn | ||
50 : | |||
51 : | ;=========================================================================== | ||
52 : | ; | ||
53 : | ; uint32_t sad16bi_3dn(const uint8_t * const cur, | ||
54 : | ; const uint8_t * const ref1, | ||
55 : | ; const uint8_t * const ref2, | ||
56 : | ; const uint32_t stride); | ||
57 : | ; | ||
58 : | ;=========================================================================== | ||
59 : | |||
60 : | %macro SADBI_16x16_3DN 0 | ||
61 : | movq mm0, [eax] ; src | ||
62 : | movq mm2, [eax+8] | ||
63 : | |||
64 : | movq mm1, [edx] ; ref1 | ||
65 : | movq mm3, [edx+8] | ||
66 : | pavgusb mm1, [ebx] ; ref2 | ||
67 : | lea edx,[edx+ecx] | ||
68 : | pavgusb mm3, [ebx+8] | ||
69 : | lea ebx,[ebx+ecx] | ||
70 : | |||
71 : | movq mm4, mm0 | ||
72 : | lea eax,[eax+ecx] | ||
73 : | psubusb mm0, mm1 | ||
74 : | movq mm5, mm2 | ||
75 : | psubusb mm2, mm3 | ||
76 : | |||
77 : | psubusb mm1, mm4 | ||
78 : | por mm0, mm1 | ||
79 : | psubusb mm3, mm5 | ||
80 : | por mm2, mm3 | ||
81 : | |||
82 : | movq mm1,mm0 | ||
83 : | movq mm3,mm2 | ||
84 : | |||
85 : | punpcklbw mm0,mm7 | ||
86 : | punpckhbw mm1,mm7 | ||
87 : | punpcklbw mm2,mm7 | ||
88 : | punpckhbw mm3,mm7 | ||
89 : | |||
90 : | paddusw mm0,mm1 | ||
91 : | paddusw mm2,mm3 | ||
92 : | paddusw mm6,mm0 | ||
93 : | paddusw mm6,mm2 | ||
94 : | %endmacro | ||
95 : | |||
96 : | align 16 | ||
97 : | sad16bi_3dn: | ||
98 : | push ebx | ||
99 : | mov eax, [esp+4+ 4] ; Src | ||
100 : | mov edx, [esp+4+ 8] ; Ref1 | ||
101 : | mov ebx, [esp+4+12] ; Ref2 | ||
102 : | mov ecx, [esp+4+16] ; Stride | ||
103 : | |||
104 : | pxor mm6, mm6 ; accum2 | ||
105 : | pxor mm7, mm7 | ||
106 : | .Loop | ||
107 : | SADBI_16x16_3DN | ||
108 : | SADBI_16x16_3DN | ||
109 : | SADBI_16x16_3DN | ||
110 : | SADBI_16x16_3DN | ||
111 : | SADBI_16x16_3DN | ||
112 : | SADBI_16x16_3DN | ||
113 : | SADBI_16x16_3DN | ||
114 : | SADBI_16x16_3DN | ||
115 : | |||
116 : | SADBI_16x16_3DN | ||
117 : | SADBI_16x16_3DN | ||
118 : | SADBI_16x16_3DN | ||
119 : | SADBI_16x16_3DN | ||
120 : | SADBI_16x16_3DN | ||
121 : | SADBI_16x16_3DN | ||
122 : | SADBI_16x16_3DN | ||
123 : | SADBI_16x16_3DN | ||
124 : | |||
125 : | pmaddwd mm6, [mmx_one] ; collapse | ||
126 : | movq mm7, mm6 | ||
127 : | psrlq mm7, 32 | ||
128 : | paddd mm6, mm7 | ||
129 : | |||
130 : | movd eax, mm6 | ||
131 : | |||
132 : | pop ebx | ||
133 : | |||
134 : | ret | ||
135 : | |||
136 : | |||
137 : | |||
138 : | ;=========================================================================== | ||
139 : | ; | ||
140 : | ; uint32_t sad8bi_3dn(const uint8_t * const cur, | ||
141 : | ; const uint8_t * const ref1, | ||
142 : | ; const uint8_t * const ref2, | ||
143 : | ; const uint32_t stride); | ||
144 : | ; | ||
145 : | ;=========================================================================== | ||
146 : | |||
147 : | %macro SADBI_8x8_3DN 0 | ||
148 : | movq mm0, [eax] ; src | ||
149 : | movq mm2, [eax+ecx] | ||
150 : | |||
151 : | movq mm1, [edx] ; ref1 | ||
152 : | movq mm3, [edx+ecx] | ||
153 : | pavgusb mm1, [ebx] ; ref2 | ||
154 : | lea edx,[edx+2*ecx] | ||
155 : | pavgusb mm3, [ebx+ecx] | ||
156 : | lea ebx,[ebx+2*ecx] | ||
157 : | |||
158 : | movq mm4, mm0 | ||
159 : | lea eax,[eax+2*ecx] | ||
160 : | psubusb mm0, mm1 | ||
161 : | movq mm5, mm2 | ||
162 : | psubusb mm2, mm3 | ||
163 : | |||
164 : | psubusb mm1, mm4 | ||
165 : | por mm0, mm1 | ||
166 : | psubusb mm3, mm5 | ||
167 : | por mm2, mm3 | ||
168 : | |||
169 : | movq mm1,mm0 | ||
170 : | movq mm3,mm2 | ||
171 : | |||
172 : | punpcklbw mm0,mm7 | ||
173 : | punpckhbw mm1,mm7 | ||
174 : | punpcklbw mm2,mm7 | ||
175 : | punpckhbw mm3,mm7 | ||
176 : | |||
177 : | paddusw mm0,mm1 | ||
178 : | paddusw mm2,mm3 | ||
179 : | paddusw mm6,mm0 | ||
180 : | paddusw mm6,mm2 | ||
181 : | %endmacro | ||
182 : | |||
183 : | align 16 | ||
184 : | sad8bi_3dn: | ||
185 : | push ebx | ||
186 : | mov eax, [esp+4+ 4] ; Src | ||
187 : | mov edx, [esp+4+ 8] ; Ref1 | ||
188 : | mov ebx, [esp+4+12] ; Ref2 | ||
189 : | mov ecx, [esp+4+16] ; Stride | ||
190 : | |||
191 : | pxor mm6, mm6 ; accum2 | ||
192 : | pxor mm7, mm7 | ||
193 : | .Loop | ||
194 : | SADBI_8x8_3DN | ||
195 : | SADBI_8x8_3DN | ||
196 : | SADBI_8x8_3DN | ||
197 : | SADBI_8x8_3DN | ||
198 : | |||
199 : | pmaddwd mm6, [mmx_one] ; collapse | ||
200 : | movq mm7, mm6 | ||
201 : | psrlq mm7, 32 | ||
202 : | paddd mm6, mm7 | ||
203 : | |||
204 : | movd eax, mm6 | ||
205 : | |||
206 : | pop ebx | ||
207 : | |||
208 : | ret |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |