Mercurial > libavcodec.hg
annotate i386/motion_est_mmx.c @ 1903:c94b19667d8b libavcodec
1000l for iive
author | michael |
---|---|
date | Mon, 22 Mar 2004 20:54:04 +0000 |
parents | 3054613980a8 |
children | 15cfba1b97b5 |
rev | line source |
---|---|
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
1 /* |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
2 * MMX optimized motion estimation |
429 | 3 * Copyright (c) 2001 Fabrice Bellard. |
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1708
diff
changeset
|
4 * Copyright (c) 2002-2004 Michael Niedermayer |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
5 * |
429 | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | |
8 * License as published by the Free Software Foundation; either | |
9 * version 2 of the License, or (at your option) any later version. | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
10 * |
429 | 11 * This library is distributed in the hope that it will be useful, |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
15 * |
429 | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
19 * |
294 | 20 * mostly by Michael Niedermayer <michaelni@gmx.at> |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
21 */ |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
22 #include "../dsputil.h" |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
23 |
1064 | 24 static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={ |
1569
1f8d1e1173d8
Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents:
1455
diff
changeset
|
25 0x0000000000000000ULL, |
1f8d1e1173d8
Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents:
1455
diff
changeset
|
26 0x0001000100010001ULL, |
1f8d1e1173d8
Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents:
1455
diff
changeset
|
27 0x0002000200020002ULL, |
294 | 28 }; |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
29 |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1739
diff
changeset
|
30 static attribute_used __attribute__ ((aligned(8))) uint64_t bone= 0x0101010101010101LL; |
330 | 31 |
1708 | 32 static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
33 { |
1708 | 34 int len= -(stride*h); |
294 | 35 asm volatile( |
36 ".balign 16 \n\t" | |
37 "1: \n\t" | |
38 "movq (%1, %%eax), %%mm0 \n\t" | |
39 "movq (%2, %%eax), %%mm2 \n\t" | |
40 "movq (%2, %%eax), %%mm4 \n\t" | |
41 "addl %3, %%eax \n\t" | |
42 "psubusb %%mm0, %%mm2 \n\t" | |
43 "psubusb %%mm4, %%mm0 \n\t" | |
44 "movq (%1, %%eax), %%mm1 \n\t" | |
45 "movq (%2, %%eax), %%mm3 \n\t" | |
46 "movq (%2, %%eax), %%mm5 \n\t" | |
47 "psubusb %%mm1, %%mm3 \n\t" | |
48 "psubusb %%mm5, %%mm1 \n\t" | |
49 "por %%mm2, %%mm0 \n\t" | |
50 "por %%mm1, %%mm3 \n\t" | |
51 "movq %%mm0, %%mm1 \n\t" | |
52 "movq %%mm3, %%mm2 \n\t" | |
53 "punpcklbw %%mm7, %%mm0 \n\t" | |
54 "punpckhbw %%mm7, %%mm1 \n\t" | |
55 "punpcklbw %%mm7, %%mm3 \n\t" | |
56 "punpckhbw %%mm7, %%mm2 \n\t" | |
57 "paddw %%mm1, %%mm0 \n\t" | |
58 "paddw %%mm3, %%mm2 \n\t" | |
59 "paddw %%mm2, %%mm0 \n\t" | |
60 "paddw %%mm0, %%mm6 \n\t" | |
61 "addl %3, %%eax \n\t" | |
62 " js 1b \n\t" | |
63 : "+a" (len) | |
64 : "r" (blk1 - len), "r" (blk2 - len), "r" (stride) | |
65 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
66 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
67 |
1708 | 68 static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
69 { |
1708 | 70 int len= -(stride*h); |
294 | 71 asm volatile( |
72 ".balign 16 \n\t" | |
73 "1: \n\t" | |
74 "movq (%1, %%eax), %%mm0 \n\t" | |
75 "movq (%2, %%eax), %%mm2 \n\t" | |
76 "psadbw %%mm2, %%mm0 \n\t" | |
77 "addl %3, %%eax \n\t" | |
78 "movq (%1, %%eax), %%mm1 \n\t" | |
79 "movq (%2, %%eax), %%mm3 \n\t" | |
80 "psadbw %%mm1, %%mm3 \n\t" | |
81 "paddw %%mm3, %%mm0 \n\t" | |
82 "paddw %%mm0, %%mm6 \n\t" | |
83 "addl %3, %%eax \n\t" | |
84 " js 1b \n\t" | |
85 : "+a" (len) | |
86 : "r" (blk1 - len), "r" (blk2 - len), "r" (stride) | |
87 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
88 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
89 |
1064 | 90 static inline void sad8_2_mmx2(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
91 { |
1708 | 92 int len= -(stride*h); |
294 | 93 asm volatile( |
94 ".balign 16 \n\t" | |
95 "1: \n\t" | |
96 "movq (%1, %%eax), %%mm0 \n\t" | |
97 "movq (%2, %%eax), %%mm2 \n\t" | |
98 "pavgb %%mm2, %%mm0 \n\t" | |
99 "movq (%3, %%eax), %%mm2 \n\t" | |
100 "psadbw %%mm2, %%mm0 \n\t" | |
101 "addl %4, %%eax \n\t" | |
102 "movq (%1, %%eax), %%mm1 \n\t" | |
103 "movq (%2, %%eax), %%mm3 \n\t" | |
104 "pavgb %%mm1, %%mm3 \n\t" | |
105 "movq (%3, %%eax), %%mm1 \n\t" | |
106 "psadbw %%mm1, %%mm3 \n\t" | |
107 "paddw %%mm3, %%mm0 \n\t" | |
108 "paddw %%mm0, %%mm6 \n\t" | |
109 "addl %4, %%eax \n\t" | |
110 " js 1b \n\t" | |
111 : "+a" (len) | |
112 : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" (stride) | |
113 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
114 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
115 |
1064 | 116 static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) |
294 | 117 { //FIXME reuse src |
1708 | 118 int len= -(stride*h); |
294 | 119 asm volatile( |
120 ".balign 16 \n\t" | |
330 | 121 "movq "MANGLE(bone)", %%mm5 \n\t" |
1057 | 122 "1: \n\t" |
294 | 123 "movq (%1, %%eax), %%mm0 \n\t" |
124 "movq (%2, %%eax), %%mm2 \n\t" | |
125 "movq 1(%1, %%eax), %%mm1 \n\t" | |
126 "movq 1(%2, %%eax), %%mm3 \n\t" | |
127 "pavgb %%mm2, %%mm0 \n\t" | |
128 "pavgb %%mm1, %%mm3 \n\t" | |
330 | 129 "psubusb %%mm5, %%mm3 \n\t" |
294 | 130 "pavgb %%mm3, %%mm0 \n\t" |
131 "movq (%3, %%eax), %%mm2 \n\t" | |
132 "psadbw %%mm2, %%mm0 \n\t" | |
133 "addl %4, %%eax \n\t" | |
134 "movq (%1, %%eax), %%mm1 \n\t" | |
135 "movq (%2, %%eax), %%mm3 \n\t" | |
136 "movq 1(%1, %%eax), %%mm2 \n\t" | |
137 "movq 1(%2, %%eax), %%mm4 \n\t" | |
138 "pavgb %%mm3, %%mm1 \n\t" | |
139 "pavgb %%mm4, %%mm2 \n\t" | |
330 | 140 "psubusb %%mm5, %%mm2 \n\t" |
294 | 141 "pavgb %%mm1, %%mm2 \n\t" |
142 "movq (%3, %%eax), %%mm1 \n\t" | |
143 "psadbw %%mm1, %%mm2 \n\t" | |
144 "paddw %%mm2, %%mm0 \n\t" | |
145 "paddw %%mm0, %%mm6 \n\t" | |
146 "addl %4, %%eax \n\t" | |
147 " js 1b \n\t" | |
148 : "+a" (len) | |
149 : "r" (blk1 - len), "r" (blk1 - len + stride), "r" (blk2 - len), "r" (stride) | |
150 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
151 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
152 |
1064 | 153 static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
154 { |
1708 | 155 int len= -(stride*h); |
294 | 156 asm volatile( |
157 ".balign 16 \n\t" | |
158 "1: \n\t" | |
159 "movq (%1, %%eax), %%mm0 \n\t" | |
160 "movq (%2, %%eax), %%mm1 \n\t" | |
161 "movq (%1, %%eax), %%mm2 \n\t" | |
162 "movq (%2, %%eax), %%mm3 \n\t" | |
163 "punpcklbw %%mm7, %%mm0 \n\t" | |
164 "punpcklbw %%mm7, %%mm1 \n\t" | |
165 "punpckhbw %%mm7, %%mm2 \n\t" | |
166 "punpckhbw %%mm7, %%mm3 \n\t" | |
167 "paddw %%mm0, %%mm1 \n\t" | |
168 "paddw %%mm2, %%mm3 \n\t" | |
1057 | 169 "movq (%3, %%eax), %%mm4 \n\t" |
294 | 170 "movq (%3, %%eax), %%mm2 \n\t" |
171 "paddw %%mm5, %%mm1 \n\t" | |
172 "paddw %%mm5, %%mm3 \n\t" | |
173 "psrlw $1, %%mm1 \n\t" | |
174 "psrlw $1, %%mm3 \n\t" | |
175 "packuswb %%mm3, %%mm1 \n\t" | |
176 "psubusb %%mm1, %%mm4 \n\t" | |
177 "psubusb %%mm2, %%mm1 \n\t" | |
178 "por %%mm4, %%mm1 \n\t" | |
179 "movq %%mm1, %%mm0 \n\t" | |
180 "punpcklbw %%mm7, %%mm0 \n\t" | |
181 "punpckhbw %%mm7, %%mm1 \n\t" | |
182 "paddw %%mm1, %%mm0 \n\t" | |
183 "paddw %%mm0, %%mm6 \n\t" | |
184 "addl %4, %%eax \n\t" | |
185 " js 1b \n\t" | |
186 : "+a" (len) | |
187 : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" (stride) | |
188 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
189 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
190 |
1064 | 191 static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
192 { |
1708 | 193 int len= -(stride*h); |
294 | 194 asm volatile( |
195 ".balign 16 \n\t" | |
196 "1: \n\t" | |
197 "movq (%1, %%eax), %%mm0 \n\t" | |
198 "movq (%2, %%eax), %%mm1 \n\t" | |
199 "movq %%mm0, %%mm4 \n\t" | |
200 "movq %%mm1, %%mm2 \n\t" | |
201 "punpcklbw %%mm7, %%mm0 \n\t" | |
202 "punpcklbw %%mm7, %%mm1 \n\t" | |
203 "punpckhbw %%mm7, %%mm4 \n\t" | |
204 "punpckhbw %%mm7, %%mm2 \n\t" | |
205 "paddw %%mm1, %%mm0 \n\t" | |
206 "paddw %%mm2, %%mm4 \n\t" | |
207 "movq 1(%1, %%eax), %%mm2 \n\t" | |
208 "movq 1(%2, %%eax), %%mm3 \n\t" | |
209 "movq %%mm2, %%mm1 \n\t" | |
210 "punpcklbw %%mm7, %%mm2 \n\t" | |
211 "punpckhbw %%mm7, %%mm1 \n\t" | |
212 "paddw %%mm0, %%mm2 \n\t" | |
213 "paddw %%mm4, %%mm1 \n\t" | |
214 "movq %%mm3, %%mm4 \n\t" | |
215 "punpcklbw %%mm7, %%mm3 \n\t" | |
216 "punpckhbw %%mm7, %%mm4 \n\t" | |
217 "paddw %%mm3, %%mm2 \n\t" | |
218 "paddw %%mm4, %%mm1 \n\t" | |
1057 | 219 "movq (%3, %%eax), %%mm3 \n\t" |
220 "movq (%3, %%eax), %%mm4 \n\t" | |
294 | 221 "paddw %%mm5, %%mm2 \n\t" |
222 "paddw %%mm5, %%mm1 \n\t" | |
223 "psrlw $2, %%mm2 \n\t" | |
224 "psrlw $2, %%mm1 \n\t" | |
225 "packuswb %%mm1, %%mm2 \n\t" | |
226 "psubusb %%mm2, %%mm3 \n\t" | |
227 "psubusb %%mm4, %%mm2 \n\t" | |
228 "por %%mm3, %%mm2 \n\t" | |
229 "movq %%mm2, %%mm0 \n\t" | |
230 "punpcklbw %%mm7, %%mm0 \n\t" | |
231 "punpckhbw %%mm7, %%mm2 \n\t" | |
232 "paddw %%mm2, %%mm0 \n\t" | |
233 "paddw %%mm0, %%mm6 \n\t" | |
234 "addl %4, %%eax \n\t" | |
235 " js 1b \n\t" | |
236 : "+a" (len) | |
237 : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" (stride) | |
238 ); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
239 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
240 |
1057 | 241 static inline int sum_mmx(void) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
242 { |
294 | 243 int ret; |
244 asm volatile( | |
245 "movq %%mm6, %%mm0 \n\t" | |
246 "psrlq $32, %%mm6 \n\t" | |
247 "paddw %%mm0, %%mm6 \n\t" | |
248 "movq %%mm6, %%mm0 \n\t" | |
249 "psrlq $16, %%mm6 \n\t" | |
250 "paddw %%mm0, %%mm6 \n\t" | |
251 "movd %%mm6, %0 \n\t" | |
252 : "=r" (ret) | |
253 ); | |
254 return ret&0xFFFF; | |
255 } | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
256 |
1057 | 257 static inline int sum_mmx2(void) |
294 | 258 { |
259 int ret; | |
260 asm volatile( | |
261 "movd %%mm6, %0 \n\t" | |
262 : "=r" (ret) | |
263 ); | |
264 return ret; | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
265 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
266 |
900 | 267 |
294 | 268 #define PIX_SAD(suf)\ |
1708 | 269 static int sad8_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ |
270 {\ | |
271 assert(h==8);\ | |
272 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
273 "pxor %%mm6, %%mm6 \n\t":);\ | |
274 \ | |
275 sad8_1_ ## suf(blk1, blk2, stride, 8);\ | |
276 \ | |
277 return sum_ ## suf();\ | |
278 }\ | |
279 static int sad8_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ | |
280 {\ | |
281 assert(h==8);\ | |
282 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
283 "pxor %%mm6, %%mm6 \n\t"\ | |
284 "movq %0, %%mm5 \n\t"\ | |
285 :: "m"(round_tab[1]) \ | |
286 );\ | |
287 \ | |
288 sad8_2_ ## suf(blk1, blk1+1, blk2, stride, 8);\ | |
289 \ | |
290 return sum_ ## suf();\ | |
291 }\ | |
292 \ | |
293 static int sad8_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ | |
294 {\ | |
295 assert(h==8);\ | |
296 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
297 "pxor %%mm6, %%mm6 \n\t"\ | |
298 "movq %0, %%mm5 \n\t"\ | |
299 :: "m"(round_tab[1]) \ | |
300 );\ | |
301 \ | |
302 sad8_2_ ## suf(blk1, blk1+stride, blk2, stride, 8);\ | |
303 \ | |
304 return sum_ ## suf();\ | |
305 }\ | |
306 \ | |
307 static int sad8_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ | |
308 {\ | |
309 assert(h==8);\ | |
310 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
311 "pxor %%mm6, %%mm6 \n\t"\ | |
312 "movq %0, %%mm5 \n\t"\ | |
313 :: "m"(round_tab[2]) \ | |
314 );\ | |
315 \ | |
316 sad8_4_ ## suf(blk1, blk2, stride, 8);\ | |
317 \ | |
318 return sum_ ## suf();\ | |
319 }\ | |
320 \ | |
321 static int sad16_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ | |
294 | 322 {\ |
323 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
324 "pxor %%mm6, %%mm6 \n\t":);\ | |
325 \ | |
1708 | 326 sad8_1_ ## suf(blk1 , blk2 , stride, h);\ |
327 sad8_1_ ## suf(blk1+8, blk2+8, stride, h);\ | |
294 | 328 \ |
329 return sum_ ## suf();\ | |
330 }\ | |
1708 | 331 static int sad16_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ |
294 | 332 {\ |
333 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
334 "pxor %%mm6, %%mm6 \n\t"\ | |
335 "movq %0, %%mm5 \n\t"\ | |
336 :: "m"(round_tab[1]) \ | |
337 );\ | |
338 \ | |
1708 | 339 sad8_2_ ## suf(blk1 , blk1+1, blk2 , stride, h);\ |
340 sad8_2_ ## suf(blk1+8, blk1+9, blk2+8, stride, h);\ | |
294 | 341 \ |
342 return sum_ ## suf();\ | |
343 }\ | |
1708 | 344 static int sad16_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ |
294 | 345 {\ |
346 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
347 "pxor %%mm6, %%mm6 \n\t"\ | |
348 "movq %0, %%mm5 \n\t"\ | |
349 :: "m"(round_tab[1]) \ | |
350 );\ | |
351 \ | |
1708 | 352 sad8_2_ ## suf(blk1 , blk1+stride, blk2 , stride, h);\ |
353 sad8_2_ ## suf(blk1+8, blk1+stride+8,blk2+8, stride, h);\ | |
294 | 354 \ |
355 return sum_ ## suf();\ | |
356 }\ | |
1708 | 357 static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\ |
294 | 358 {\ |
359 asm volatile("pxor %%mm7, %%mm7 \n\t"\ | |
360 "pxor %%mm6, %%mm6 \n\t"\ | |
361 "movq %0, %%mm5 \n\t"\ | |
362 :: "m"(round_tab[2]) \ | |
363 );\ | |
364 \ | |
1708 | 365 sad8_4_ ## suf(blk1 , blk2 , stride, h);\ |
366 sad8_4_ ## suf(blk1+8, blk2+8, stride, h);\ | |
294 | 367 \ |
368 return sum_ ## suf();\ | |
369 }\ | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
370 |
294 | 371 PIX_SAD(mmx) |
372 PIX_SAD(mmx2) | |
1057 | 373 |
1092 | 374 void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx) |
1057 | 375 { |
376 if (mm_flags & MM_MMX) { | |
1708 | 377 c->pix_abs[0][0] = sad16_mmx; |
378 c->pix_abs[0][1] = sad16_x2_mmx; | |
379 c->pix_abs[0][2] = sad16_y2_mmx; | |
380 c->pix_abs[0][3] = sad16_xy2_mmx; | |
381 c->pix_abs[1][0] = sad8_mmx; | |
382 c->pix_abs[1][1] = sad8_x2_mmx; | |
383 c->pix_abs[1][2] = sad8_y2_mmx; | |
384 c->pix_abs[1][3] = sad8_xy2_mmx; | |
1057 | 385 |
1708 | 386 c->sad[0]= sad16_mmx; |
387 c->sad[1]= sad8_mmx; | |
1057 | 388 } |
389 if (mm_flags & MM_MMXEXT) { | |
1708 | 390 c->pix_abs[0][0] = sad16_mmx2; |
391 c->pix_abs[1][0] = sad8_mmx2; | |
1057 | 392 |
1708 | 393 c->sad[0]= sad16_mmx2; |
394 c->sad[1]= sad8_mmx2; | |
1092 | 395 |
396 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |
1708 | 397 c->pix_abs[0][1] = sad16_x2_mmx2; |
398 c->pix_abs[0][2] = sad16_y2_mmx2; | |
399 c->pix_abs[0][3] = sad16_xy2_mmx2; | |
400 c->pix_abs[1][1] = sad8_x2_mmx2; | |
401 c->pix_abs[1][2] = sad8_y2_mmx2; | |
402 c->pix_abs[1][3] = sad8_xy2_mmx2; | |
1092 | 403 } |
1057 | 404 } |
405 } |