31 #if COMPILE_TEMPLATE_MMXEXT
32 #define PREFETCH "prefetchnta"
34 #define PREFETCH " # nop"
37 #if COMPILE_TEMPLATE_MMXEXT
38 #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
39 #define MOVNTQ2 "movntq "
41 #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
42 #define MOVNTQ2 "movq "
44 #define MOVNTQ(a,b) REAL_MOVNTQ(a,b)
46 #if !COMPILE_TEMPLATE_MMXEXT
51 __asm__
volatile(
"pxor %%mm0, %%mm0\n\t"
52 "movq (%0), %%mm3\n\t"
53 "movq %%mm3, %%mm4\n\t"
54 "psrlq $24, %%mm3\n\t"
55 "psllq $40, %%mm4\n\t"
56 "por %%mm4, %%mm3\n\t"
57 "movq %%mm3, %%mm4\n\t"
58 "punpcklbw %%mm0, %%mm3\n\t"
59 "punpckhbw %%mm0, %%mm4\n\t"
63 __asm__
volatile(
"pxor %%mm0, %%mm0\n\t"
64 "movq (%0), %%mm3\n\t"
65 "movq %%mm3, %%mm4\n\t"
66 "punpcklbw %%mm0, %%mm3\n\t"
67 "punpckhbw %%mm0, %%mm4\n\t"
74 static void RENAME(yuv2yuvX)(
const int16_t *
filter,
int filterSize,
82 "punpcklwd %%mm1, %%mm1\n\t"
83 "punpckldq %%mm1, %%mm1\n\t"
85 "paddw %%mm1, %%mm3\n\t"
86 "paddw %%mm1, %%mm4\n\t"
93 "movq %%mm3, %%mm6\n\t"
94 "movq %%mm4, %%mm7\n\t"
96 "mov %0, %%"REG_d
" \n\t"\
97 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
100 "movq 8(%%"REG_d
"), %%mm0 \n\t" \
101 "movq (%%"REG_S
", %%"REG_c
", 2), %%mm2 \n\t" \
102 "movq 8(%%"REG_S
", %%"REG_c
", 2), %%mm5 \n\t" \
103 "add $16, %%"REG_d
" \n\t"\
104 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
105 "test %%"REG_S
", %%"REG_S
" \n\t"\
106 "pmulhw %%mm0, %%mm2 \n\t"\
107 "pmulhw %%mm0, %%mm5 \n\t"\
108 "paddw %%mm2, %%mm3 \n\t"\
109 "paddw %%mm5, %%mm4 \n\t"\
111 "psraw $3, %%mm3 \n\t"\
112 "psraw $3, %%mm4 \n\t"\
113 "packuswb %%mm4, %%mm3 \n\t"
114 MOVNTQ2 " %%mm3, (%1, %%"REG_c
")\n\t"
115 "add $8, %%"REG_c
" \n\t"\
116 "cmp %2, %%"REG_c
" \n\t"\
117 "movq %%mm6, %%mm3\n\t"
118 "movq %%mm7, %%mm4\n\t"
119 "mov %0, %%"REG_d
" \n\t"\
120 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
124 :
"%"REG_d,
"%"REG_S,
"%"REG_c
128 #define YSCALEYUV2PACKEDX_UV \
130 "xor %%"REG_a", %%"REG_a" \n\t"\
134 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
135 "mov (%%"REG_d"), %%"REG_S" \n\t"\
136 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
137 "movq %%mm3, %%mm4 \n\t"\
140 "movq 8(%%"REG_d"), %%mm0 \n\t" \
141 "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" \
142 "add %6, %%"REG_S" \n\t" \
143 "movq (%%"REG_S", %%"REG_a"), %%mm5 \n\t" \
144 "add $16, %%"REG_d" \n\t"\
145 "mov (%%"REG_d"), %%"REG_S" \n\t"\
146 "pmulhw %%mm0, %%mm2 \n\t"\
147 "pmulhw %%mm0, %%mm5 \n\t"\
148 "paddw %%mm2, %%mm3 \n\t"\
149 "paddw %%mm5, %%mm4 \n\t"\
150 "test %%"REG_S", %%"REG_S" \n\t"\
153 #define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \
154 "lea "offset"(%0), %%"REG_d" \n\t"\
155 "mov (%%"REG_d"), %%"REG_S" \n\t"\
156 "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\
157 "movq "#dst1", "#dst2" \n\t"\
160 "movq 8(%%"REG_d"), "#coeff" \n\t" \
161 "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" \
162 "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" \
163 "add $16, %%"REG_d" \n\t"\
164 "mov (%%"REG_d"), %%"REG_S" \n\t"\
165 "pmulhw "#coeff", "#src1" \n\t"\
166 "pmulhw "#coeff", "#src2" \n\t"\
167 "paddw "#src1", "#dst1" \n\t"\
168 "paddw "#src2", "#dst2" \n\t"\
169 "test %%"REG_S", %%"REG_S" \n\t"\
172 #define YSCALEYUV2PACKEDX \
173 YSCALEYUV2PACKEDX_UV \
174 YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \
176 #define YSCALEYUV2PACKEDX_END \
177 :: "r" (&c->redDither), \
178 "m" (dummy), "m" (dummy), "m" (dummy),\
179 "r" (dest), "m" (dstW_reg), "m"(uv_off) \
180 NAMED_CONSTRAINTS_ADD(bF8,bFC) \
181 : "%"REG_a, "%"REG_d, "%"REG_S \
184 #define YSCALEYUV2PACKEDX_ACCURATE_UV \
186 "xor %%"REG_a", %%"REG_a" \n\t"\
190 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
191 "mov (%%"REG_d"), %%"REG_S" \n\t"\
192 "pxor %%mm4, %%mm4 \n\t"\
193 "pxor %%mm5, %%mm5 \n\t"\
194 "pxor %%mm6, %%mm6 \n\t"\
195 "pxor %%mm7, %%mm7 \n\t"\
198 "movq (%%"REG_S", %%"REG_a"), %%mm0 \n\t" \
199 "add %6, %%"REG_S" \n\t" \
200 "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" \
201 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
202 "movq (%%"REG_S", %%"REG_a"), %%mm1 \n\t" \
203 "movq %%mm0, %%mm3 \n\t"\
204 "punpcklwd %%mm1, %%mm0 \n\t"\
205 "punpckhwd %%mm1, %%mm3 \n\t"\
206 "movq "STR(APCK_COEF)"(%%"REG_d"),%%mm1 \n\t" \
207 "pmaddwd %%mm1, %%mm0 \n\t"\
208 "pmaddwd %%mm1, %%mm3 \n\t"\
209 "paddd %%mm0, %%mm4 \n\t"\
210 "paddd %%mm3, %%mm5 \n\t"\
211 "add %6, %%"REG_S" \n\t" \
212 "movq (%%"REG_S", %%"REG_a"), %%mm3 \n\t" \
213 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
214 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
215 "test %%"REG_S", %%"REG_S" \n\t"\
216 "movq %%mm2, %%mm0 \n\t"\
217 "punpcklwd %%mm3, %%mm2 \n\t"\
218 "punpckhwd %%mm3, %%mm0 \n\t"\
219 "pmaddwd %%mm1, %%mm2 \n\t"\
220 "pmaddwd %%mm1, %%mm0 \n\t"\
221 "paddd %%mm2, %%mm6 \n\t"\
222 "paddd %%mm0, %%mm7 \n\t"\
224 "psrad $16, %%mm4 \n\t"\
225 "psrad $16, %%mm5 \n\t"\
226 "psrad $16, %%mm6 \n\t"\
227 "psrad $16, %%mm7 \n\t"\
228 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
229 "packssdw %%mm5, %%mm4 \n\t"\
230 "packssdw %%mm7, %%mm6 \n\t"\
231 "paddw %%mm0, %%mm4 \n\t"\
232 "paddw %%mm0, %%mm6 \n\t"\
233 "movq %%mm4, "U_TEMP"(%0) \n\t"\
234 "movq %%mm6, "V_TEMP"(%0) \n\t"\
236 #define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \
237 "lea "offset"(%0), %%"REG_d" \n\t"\
238 "mov (%%"REG_d"), %%"REG_S" \n\t"\
239 "pxor %%mm1, %%mm1 \n\t"\
240 "pxor %%mm5, %%mm5 \n\t"\
241 "pxor %%mm7, %%mm7 \n\t"\
242 "pxor %%mm6, %%mm6 \n\t"\
245 "movq (%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" \
246 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" \
247 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
248 "movq (%%"REG_S", %%"REG_a", 2), %%mm4 \n\t" \
249 "movq %%mm0, %%mm3 \n\t"\
250 "punpcklwd %%mm4, %%mm0 \n\t"\
251 "punpckhwd %%mm4, %%mm3 \n\t"\
252 "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm4 \n\t" \
253 "pmaddwd %%mm4, %%mm0 \n\t"\
254 "pmaddwd %%mm4, %%mm3 \n\t"\
255 "paddd %%mm0, %%mm1 \n\t"\
256 "paddd %%mm3, %%mm5 \n\t"\
257 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" \
258 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
259 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
260 "test %%"REG_S", %%"REG_S" \n\t"\
261 "movq %%mm2, %%mm0 \n\t"\
262 "punpcklwd %%mm3, %%mm2 \n\t"\
263 "punpckhwd %%mm3, %%mm0 \n\t"\
264 "pmaddwd %%mm4, %%mm2 \n\t"\
265 "pmaddwd %%mm4, %%mm0 \n\t"\
266 "paddd %%mm2, %%mm7 \n\t"\
267 "paddd %%mm0, %%mm6 \n\t"\
269 "psrad $16, %%mm1 \n\t"\
270 "psrad $16, %%mm5 \n\t"\
271 "psrad $16, %%mm7 \n\t"\
272 "psrad $16, %%mm6 \n\t"\
273 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
274 "packssdw %%mm5, %%mm1 \n\t"\
275 "packssdw %%mm6, %%mm7 \n\t"\
276 "paddw %%mm0, %%mm1 \n\t"\
277 "paddw %%mm0, %%mm7 \n\t"\
278 "movq "U_TEMP"(%0), %%mm3 \n\t"\
279 "movq "V_TEMP"(%0), %%mm4 \n\t"\
281 #define YSCALEYUV2PACKEDX_ACCURATE \
282 YSCALEYUV2PACKEDX_ACCURATE_UV \
283 YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET)
285 #define YSCALEYUV2RGBX \
286 "psubw "U_OFFSET"(%0), %%mm3 \n\t" \
287 "psubw "V_OFFSET"(%0), %%mm4 \n\t" \
288 "movq %%mm3, %%mm2 \n\t" \
289 "movq %%mm4, %%mm5 \n\t" \
290 "pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\
291 "pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\
293 "pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\
294 "pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\
295 "psubw "Y_OFFSET"(%0), %%mm1 \n\t" \
296 "psubw "Y_OFFSET"(%0), %%mm7 \n\t" \
297 "pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\
298 "pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\
300 "paddw %%mm3, %%mm4 \n\t"\
301 "movq %%mm2, %%mm0 \n\t"\
302 "movq %%mm5, %%mm6 \n\t"\
303 "movq %%mm4, %%mm3 \n\t"\
304 "punpcklwd %%mm2, %%mm2 \n\t"\
305 "punpcklwd %%mm5, %%mm5 \n\t"\
306 "punpcklwd %%mm4, %%mm4 \n\t"\
307 "paddw %%mm1, %%mm2 \n\t"\
308 "paddw %%mm1, %%mm5 \n\t"\
309 "paddw %%mm1, %%mm4 \n\t"\
310 "punpckhwd %%mm0, %%mm0 \n\t"\
311 "punpckhwd %%mm6, %%mm6 \n\t"\
312 "punpckhwd %%mm3, %%mm3 \n\t"\
313 "paddw %%mm7, %%mm0 \n\t"\
314 "paddw %%mm7, %%mm6 \n\t"\
315 "paddw %%mm7, %%mm3 \n\t"\
317 "packuswb %%mm0, %%mm2 \n\t"\
318 "packuswb %%mm6, %%mm5 \n\t"\
319 "packuswb %%mm3, %%mm4 \n\t"\
321 #define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \
322 "movq "#b", "#q2" \n\t" \
323 "movq "#r", "#t" \n\t" \
324 "punpcklbw "#g", "#b" \n\t" \
325 "punpcklbw "#a", "#r" \n\t" \
326 "punpckhbw "#g", "#q2" \n\t" \
327 "punpckhbw "#a", "#t" \n\t" \
328 "movq "#b", "#q0" \n\t" \
329 "movq "#q2", "#q3" \n\t" \
330 "punpcklwd "#r", "#q0" \n\t" \
331 "punpckhwd "#r", "#b" \n\t" \
332 "punpcklwd "#t", "#q2" \n\t" \
333 "punpckhwd "#t", "#q3" \n\t" \
335 MOVNTQ( q0, (dst, index, 4))\
336 MOVNTQ( b, 8(dst, index, 4))\
337 MOVNTQ( q2, 16(dst, index, 4))\
338 MOVNTQ( q3, 24(dst, index, 4))\
340 "add $8, "#index" \n\t"\
341 "cmp "dstw", "#index" \n\t"\
343 #define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
346 const int16_t **lumSrc,
int lumFilterSize,
347 const int16_t *chrFilter,
const int16_t **chrUSrc,
348 const int16_t **chrVSrc,
349 int chrFilterSize,
const int16_t **alpSrc,
356 if (CONFIG_SWSCALE_ALPHA &&
c->alpPixBuf) {
359 "movq %%mm2, "U_TEMP"(%0) \n\t"
360 "movq %%mm4, "V_TEMP"(%0) \n\t"
361 "movq %%mm5, "Y_TEMP"(%0) \n\t"
363 "movq "Y_TEMP"(%0), %%mm5 \n\t"
364 "psraw $3, %%mm1 \n\t"
365 "psraw $3, %%mm7 \n\t"
366 "packuswb %%mm7, %%mm1 \n\t"
367 WRITEBGR32(%4,
"%5", %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
372 "pcmpeqd %%mm7, %%mm7 \n\t"
373 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
379 const int16_t **lumSrc,
int lumFilterSize,
380 const int16_t *chrFilter,
const int16_t **chrUSrc,
381 const int16_t **chrVSrc,
382 int chrFilterSize,
const int16_t **alpSrc,
389 if (CONFIG_SWSCALE_ALPHA &&
c->alpPixBuf) {
393 "psraw $3, %%mm1 \n\t"
394 "psraw $3, %%mm7 \n\t"
395 "packuswb %%mm7, %%mm1 \n\t"
396 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
401 "pcmpeqd %%mm7, %%mm7 \n\t"
402 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
407 #define REAL_WRITERGB16(dst, dstw, index) \
408 "pand "MANGLE(bF8)", %%mm2 \n\t" \
409 "pand "MANGLE(bFC)", %%mm4 \n\t" \
410 "pand "MANGLE(bF8)", %%mm5 \n\t" \
411 "psrlq $3, %%mm2 \n\t"\
413 "movq %%mm2, %%mm1 \n\t"\
414 "movq %%mm4, %%mm3 \n\t"\
416 "punpcklbw %%mm7, %%mm3 \n\t"\
417 "punpcklbw %%mm5, %%mm2 \n\t"\
418 "punpckhbw %%mm7, %%mm4 \n\t"\
419 "punpckhbw %%mm5, %%mm1 \n\t"\
421 "psllq $3, %%mm3 \n\t"\
422 "psllq $3, %%mm4 \n\t"\
424 "por %%mm3, %%mm2 \n\t"\
425 "por %%mm4, %%mm1 \n\t"\
427 MOVNTQ(%%mm2, (dst, index, 2))\
428 MOVNTQ(%%mm1, 8(dst, index, 2))\
430 "add $8, "#index" \n\t"\
431 "cmp "dstw", "#index" \n\t"\
433 #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index)
436 const int16_t **lumSrc,
int lumFilterSize,
437 const int16_t *chrFilter,
const int16_t **chrUSrc,
438 const int16_t **chrVSrc,
439 int chrFilterSize,
const int16_t **alpSrc,
448 "pxor %%mm7, %%mm7 \n\t"
460 const int16_t **lumSrc,
int lumFilterSize,
461 const int16_t *chrFilter,
const int16_t **chrUSrc,
462 const int16_t **chrVSrc,
463 int chrFilterSize,
const int16_t **alpSrc,
472 "pxor %%mm7, %%mm7 \n\t"
483 #define REAL_WRITERGB15(dst, dstw, index) \
484 "pand "MANGLE(bF8)", %%mm2 \n\t" \
485 "pand "MANGLE(bF8)", %%mm4 \n\t" \
486 "pand "MANGLE(bF8)", %%mm5 \n\t" \
487 "psrlq $3, %%mm2 \n\t"\
488 "psrlq $1, %%mm5 \n\t"\
490 "movq %%mm2, %%mm1 \n\t"\
491 "movq %%mm4, %%mm3 \n\t"\
493 "punpcklbw %%mm7, %%mm3 \n\t"\
494 "punpcklbw %%mm5, %%mm2 \n\t"\
495 "punpckhbw %%mm7, %%mm4 \n\t"\
496 "punpckhbw %%mm5, %%mm1 \n\t"\
498 "psllq $2, %%mm3 \n\t"\
499 "psllq $2, %%mm4 \n\t"\
501 "por %%mm3, %%mm2 \n\t"\
502 "por %%mm4, %%mm1 \n\t"\
504 MOVNTQ(%%mm2, (dst, index, 2))\
505 MOVNTQ(%%mm1, 8(dst, index, 2))\
507 "add $8, "#index" \n\t"\
508 "cmp "dstw", "#index" \n\t"\
510 #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index)
513 const int16_t **lumSrc,
int lumFilterSize,
514 const int16_t *chrFilter,
const int16_t **chrUSrc,
515 const int16_t **chrVSrc,
516 int chrFilterSize,
const int16_t **alpSrc,
525 "pxor %%mm7, %%mm7 \n\t"
537 const int16_t **lumSrc,
int lumFilterSize,
538 const int16_t *chrFilter,
const int16_t **chrUSrc,
539 const int16_t **chrVSrc,
540 int chrFilterSize,
const int16_t **alpSrc,
549 "pxor %%mm7, %%mm7 \n\t"
560 #define WRITEBGR24MMX(dst, dstw, index) \
562 "movq %%mm2, %%mm1 \n\t" \
563 "movq %%mm5, %%mm6 \n\t" \
564 "punpcklbw %%mm4, %%mm2 \n\t" \
565 "punpcklbw %%mm7, %%mm5 \n\t" \
566 "punpckhbw %%mm4, %%mm1 \n\t" \
567 "punpckhbw %%mm7, %%mm6 \n\t" \
568 "movq %%mm2, %%mm0 \n\t" \
569 "movq %%mm1, %%mm3 \n\t" \
570 "punpcklwd %%mm5, %%mm0 \n\t" \
571 "punpckhwd %%mm5, %%mm2 \n\t" \
572 "punpcklwd %%mm6, %%mm1 \n\t" \
573 "punpckhwd %%mm6, %%mm3 \n\t" \
575 "movq %%mm0, %%mm4 \n\t" \
576 "movq %%mm2, %%mm6 \n\t" \
577 "movq %%mm1, %%mm5 \n\t" \
578 "movq %%mm3, %%mm7 \n\t" \
580 "psllq $40, %%mm0 \n\t" \
581 "psllq $40, %%mm2 \n\t" \
582 "psllq $40, %%mm1 \n\t" \
583 "psllq $40, %%mm3 \n\t" \
585 "punpckhdq %%mm4, %%mm0 \n\t" \
586 "punpckhdq %%mm6, %%mm2 \n\t" \
587 "punpckhdq %%mm5, %%mm1 \n\t" \
588 "punpckhdq %%mm7, %%mm3 \n\t" \
590 "psrlq $8, %%mm0 \n\t" \
591 "movq %%mm2, %%mm6 \n\t" \
592 "psllq $40, %%mm2 \n\t" \
593 "por %%mm2, %%mm0 \n\t" \
594 MOVNTQ(%%mm0, (dst))\
596 "psrlq $24, %%mm6 \n\t" \
597 "movq %%mm1, %%mm5 \n\t" \
598 "psllq $24, %%mm1 \n\t" \
599 "por %%mm1, %%mm6 \n\t" \
600 MOVNTQ(%%mm6, 8(dst))\
602 "psrlq $40, %%mm5 \n\t" \
603 "psllq $8, %%mm3 \n\t" \
604 "por %%mm3, %%mm5 \n\t" \
605 MOVNTQ(%%mm5, 16(dst))\
607 "add $24, "#dst" \n\t"\
609 "add $8, "#index" \n\t"\
610 "cmp "dstw", "#index" \n\t"\
613 #define WRITEBGR24MMXEXT(dst, dstw, index) \
615 "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
616 "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
617 "pshufw $0x50, %%mm2, %%mm1 \n\t" \
618 "pshufw $0x50, %%mm4, %%mm3 \n\t" \
619 "pshufw $0x00, %%mm5, %%mm6 \n\t" \
621 "pand %%mm0, %%mm1 \n\t" \
622 "pand %%mm0, %%mm3 \n\t" \
623 "pand %%mm7, %%mm6 \n\t" \
625 "psllq $8, %%mm3 \n\t" \
626 "por %%mm1, %%mm6 \n\t"\
627 "por %%mm3, %%mm6 \n\t"\
628 MOVNTQ(%%mm6, (dst))\
630 "psrlq $8, %%mm4 \n\t" \
631 "pshufw $0xA5, %%mm2, %%mm1 \n\t" \
632 "pshufw $0x55, %%mm4, %%mm3 \n\t" \
633 "pshufw $0xA5, %%mm5, %%mm6 \n\t" \
635 "pand "MANGLE(ff_M24B)", %%mm1 \n\t" \
636 "pand %%mm7, %%mm3 \n\t" \
637 "pand %%mm0, %%mm6 \n\t" \
639 "por %%mm1, %%mm3 \n\t" \
640 "por %%mm3, %%mm6 \n\t"\
641 MOVNTQ(%%mm6, 8(dst))\
643 "pshufw $0xFF, %%mm2, %%mm1 \n\t" \
644 "pshufw $0xFA, %%mm4, %%mm3 \n\t" \
645 "pshufw $0xFA, %%mm5, %%mm6 \n\t" \
647 "pand %%mm7, %%mm1 \n\t" \
648 "pand %%mm0, %%mm3 \n\t" \
649 "pand "MANGLE(ff_M24B)", %%mm6 \n\t" \
651 "por %%mm1, %%mm3 \n\t"\
652 "por %%mm3, %%mm6 \n\t"\
653 MOVNTQ(%%mm6, 16(dst))\
655 "add $24, "#dst" \n\t"\
657 "add $8, "#index" \n\t"\
658 "cmp "dstw", "#index" \n\t"\
661 #if COMPILE_TEMPLATE_MMXEXT
663 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMXEXT(dst, dstw, index)
666 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
671 const int16_t **lumSrc,
int lumFilterSize,
672 const int16_t *chrFilter,
const int16_t **chrUSrc,
673 const int16_t **chrVSrc,
674 int chrFilterSize,
const int16_t **alpSrc,
683 "pxor %%mm7, %%mm7 \n\t"
684 "lea (%%"REG_a
", %%"REG_a
", 2), %%"REG_c
"\n\t"
685 "add %4, %%"REG_c
" \n\t"
687 ::
"r" (&
c->redDither),
688 "m" (dummy),
"m" (
dummy),
"m" (dummy),
689 "r" (dest),
"m" (dstW_reg),
"m"(
uv_off)
691 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S
696 const int16_t **lumSrc,
int lumFilterSize,
697 const int16_t *chrFilter,
const int16_t **chrUSrc,
698 const int16_t **chrVSrc,
699 int chrFilterSize,
const int16_t **alpSrc,
708 "pxor %%mm7, %%mm7 \n\t"
709 "lea (%%"REG_a
", %%"REG_a
", 2), %%"REG_c
" \n\t"
710 "add %4, %%"REG_c
" \n\t"
713 "m" (dummy),
"m" (dummy),
"m" (dummy),
714 "r" (dest),
"m" (dstW_reg),
"m"(uv_off)
716 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S
721 #define REAL_WRITEYUY2(dst, dstw, index) \
722 "packuswb %%mm3, %%mm3 \n\t"\
723 "packuswb %%mm4, %%mm4 \n\t"\
724 "packuswb %%mm7, %%mm1 \n\t"\
725 "punpcklbw %%mm4, %%mm3 \n\t"\
726 "movq %%mm1, %%mm7 \n\t"\
727 "punpcklbw %%mm3, %%mm1 \n\t"\
728 "punpckhbw %%mm3, %%mm7 \n\t"\
730 MOVNTQ(%%mm1, (dst, index, 2))\
731 MOVNTQ(%%mm7, 8(dst, index, 2))\
733 "add $8, "#index" \n\t"\
734 "cmp "dstw", "#index" \n\t"\
736 #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index)
739 const int16_t **lumSrc,
int lumFilterSize,
740 const int16_t *chrFilter,
const int16_t **chrUSrc,
741 const int16_t **chrVSrc,
742 int chrFilterSize,
const int16_t **alpSrc,
751 "psraw $3, %%mm3 \n\t"
752 "psraw $3, %%mm4 \n\t"
753 "psraw $3, %%mm1 \n\t"
754 "psraw $3, %%mm7 \n\t"
760 const int16_t **lumSrc,
int lumFilterSize,
761 const int16_t *chrFilter,
const int16_t **chrUSrc,
762 const int16_t **chrVSrc,
763 int chrFilterSize,
const int16_t **alpSrc,
772 "psraw $3, %%mm3 \n\t"
773 "psraw $3, %%mm4 \n\t"
774 "psraw $3, %%mm1 \n\t"
775 "psraw $3, %%mm7 \n\t"
780 #define REAL_YSCALEYUV2RGB_UV(index, c) \
781 "xor "#index", "#index" \n\t"\
784 "movq (%2, "#index"), %%mm2 \n\t" \
785 "movq (%3, "#index"), %%mm3 \n\t" \
786 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
787 "movq (%2, "#index"), %%mm5 \n\t" \
788 "movq (%3, "#index"), %%mm4 \n\t" \
789 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
790 "psubw %%mm3, %%mm2 \n\t" \
791 "psubw %%mm4, %%mm5 \n\t" \
792 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
793 "pmulhw %%mm0, %%mm2 \n\t" \
794 "pmulhw %%mm0, %%mm5 \n\t" \
795 "psraw $4, %%mm3 \n\t" \
796 "psraw $4, %%mm4 \n\t" \
797 "paddw %%mm2, %%mm3 \n\t" \
798 "paddw %%mm5, %%mm4 \n\t" \
799 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
800 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
801 "movq %%mm3, %%mm2 \n\t" \
802 "movq %%mm4, %%mm5 \n\t" \
803 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
804 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
807 #define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \
808 "movq ("#b1", "#index", 2), %%mm0 \n\t" \
809 "movq ("#b2", "#index", 2), %%mm1 \n\t" \
810 "movq 8("#b1", "#index", 2), %%mm6 \n\t" \
811 "movq 8("#b2", "#index", 2), %%mm7 \n\t" \
812 "psubw %%mm1, %%mm0 \n\t" \
813 "psubw %%mm7, %%mm6 \n\t" \
814 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" \
815 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" \
816 "psraw $4, %%mm1 \n\t" \
817 "psraw $4, %%mm7 \n\t" \
818 "paddw %%mm0, %%mm1 \n\t" \
819 "paddw %%mm6, %%mm7 \n\t" \
821 #define REAL_YSCALEYUV2RGB_COEFF(c) \
822 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
823 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
824 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
825 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
826 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
827 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
829 "paddw %%mm3, %%mm4 \n\t"\
830 "movq %%mm2, %%mm0 \n\t"\
831 "movq %%mm5, %%mm6 \n\t"\
832 "movq %%mm4, %%mm3 \n\t"\
833 "punpcklwd %%mm2, %%mm2 \n\t"\
834 "punpcklwd %%mm5, %%mm5 \n\t"\
835 "punpcklwd %%mm4, %%mm4 \n\t"\
836 "paddw %%mm1, %%mm2 \n\t"\
837 "paddw %%mm1, %%mm5 \n\t"\
838 "paddw %%mm1, %%mm4 \n\t"\
839 "punpckhwd %%mm0, %%mm0 \n\t"\
840 "punpckhwd %%mm6, %%mm6 \n\t"\
841 "punpckhwd %%mm3, %%mm3 \n\t"\
842 "paddw %%mm7, %%mm0 \n\t"\
843 "paddw %%mm7, %%mm6 \n\t"\
844 "paddw %%mm7, %%mm3 \n\t"\
846 "packuswb %%mm0, %%mm2 \n\t"\
847 "packuswb %%mm6, %%mm5 \n\t"\
848 "packuswb %%mm3, %%mm4 \n\t"\
850 #define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2)
852 #define YSCALEYUV2RGB(index, c) \
853 REAL_YSCALEYUV2RGB_UV(index, c) \
854 REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \
855 REAL_YSCALEYUV2RGB_COEFF(c)
861 const int16_t *ubuf[2],
const int16_t *vbuf[2],
862 const int16_t *abuf[2],
uint8_t *dest,
863 int dstW,
int yalpha,
int uvalpha,
int y)
865 const int16_t *buf0 = buf[0], *buf1 = buf[1],
866 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
868 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
869 const int16_t *abuf0 = abuf[0], *abuf1 = abuf[1];
874 "psraw $3, %%mm1 \n\t"
875 "psraw $3, %%mm7 \n\t"
876 "packuswb %%mm7, %%mm1 \n\t"
877 WRITEBGR32(%4,
DSTW_OFFSET"(%5)", %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
878 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"r" (dest),
880 "r" (abuf0),
"r" (abuf1)
884 c->u_temp=(intptr_t)abuf0;
885 c->v_temp=(intptr_t)abuf1;
888 "mov %4, %%"REG_b
" \n\t"
889 "push %%"REG_BP
" \n\t"
893 "mov "U_TEMP"(%5), %0 \n\t"
894 "mov "V_TEMP"(%5), %1 \n\t"
896 "psraw $3, %%mm1 \n\t"
897 "psraw $3, %%mm7 \n\t"
898 "packuswb %%mm7, %%mm1 \n\t"
901 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
902 "pop %%"REG_BP
" \n\t"
904 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
911 "mov %4, %%"REG_b
" \n\t"
912 "push %%"REG_BP
" \n\t"
914 "pcmpeqd %%mm7, %%mm7 \n\t"
915 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
916 "pop %%"REG_BP
" \n\t"
918 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
925 const int16_t *ubuf[2],
const int16_t *vbuf[2],
926 const int16_t *abuf[2],
uint8_t *dest,
927 int dstW,
int yalpha,
int uvalpha,
int y)
929 const int16_t *buf0 = buf[0], *buf1 = buf[1],
930 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
934 "mov %4, %%"REG_b
" \n\t"
935 "push %%"REG_BP
" \n\t"
937 "pxor %%mm7, %%mm7 \n\t"
939 "pop %%"REG_BP
" \n\t"
941 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
948 const int16_t *ubuf[2],
const int16_t *vbuf[2],
949 const int16_t *abuf[2],
uint8_t *dest,
950 int dstW,
int yalpha,
int uvalpha,
int y)
952 const int16_t *buf0 = buf[0], *buf1 = buf[1],
953 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
957 "mov %4, %%"REG_b
" \n\t"
958 "push %%"REG_BP
" \n\t"
960 "pxor %%mm7, %%mm7 \n\t"
968 "pop %%"REG_BP
" \n\t"
970 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
977 const int16_t *ubuf[2],
const int16_t *vbuf[2],
978 const int16_t *abuf[2],
uint8_t *dest,
979 int dstW,
int yalpha,
int uvalpha,
int y)
981 const int16_t *buf0 = buf[0], *buf1 = buf[1],
982 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
986 "mov %4, %%"REG_b
" \n\t"
987 "push %%"REG_BP
" \n\t"
989 "pxor %%mm7, %%mm7 \n\t"
997 "pop %%"REG_BP
" \n\t"
999 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1005 #define REAL_YSCALEYUV2PACKED(index, c) \
1006 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
1007 "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\
1008 "psraw $3, %%mm0 \n\t"\
1009 "psraw $3, %%mm1 \n\t"\
1010 "movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
1011 "movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
1012 "xor "#index", "#index" \n\t"\
1015 "movq (%2, "#index"), %%mm2 \n\t" \
1016 "movq (%3, "#index"), %%mm3 \n\t" \
1017 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1018 "movq (%2, "#index"), %%mm5 \n\t" \
1019 "movq (%3, "#index"), %%mm4 \n\t" \
1020 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1021 "psubw %%mm3, %%mm2 \n\t" \
1022 "psubw %%mm4, %%mm5 \n\t" \
1023 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
1024 "pmulhw %%mm0, %%mm2 \n\t" \
1025 "pmulhw %%mm0, %%mm5 \n\t" \
1026 "psraw $7, %%mm3 \n\t" \
1027 "psraw $7, %%mm4 \n\t" \
1028 "paddw %%mm2, %%mm3 \n\t" \
1029 "paddw %%mm5, %%mm4 \n\t" \
1030 "movq (%0, "#index", 2), %%mm0 \n\t" \
1031 "movq (%1, "#index", 2), %%mm1 \n\t" \
1032 "movq 8(%0, "#index", 2), %%mm6 \n\t" \
1033 "movq 8(%1, "#index", 2), %%mm7 \n\t" \
1034 "psubw %%mm1, %%mm0 \n\t" \
1035 "psubw %%mm7, %%mm6 \n\t" \
1036 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" \
1037 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" \
1038 "psraw $7, %%mm1 \n\t" \
1039 "psraw $7, %%mm7 \n\t" \
1040 "paddw %%mm0, %%mm1 \n\t" \
1041 "paddw %%mm6, %%mm7 \n\t" \
1043 #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c)
1046 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1047 const int16_t *abuf[2],
uint8_t *dest,
1048 int dstW,
int yalpha,
int uvalpha,
int y)
1050 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1051 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
1055 "mov %4, %%"REG_b
" \n\t"
1056 "push %%"REG_BP
" \n\t"
1059 "pop %%"REG_BP
" \n\t"
1061 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1066 #define REAL_YSCALEYUV2RGB1(index, c) \
1067 "xor "#index", "#index" \n\t"\
1070 "movq (%2, "#index"), %%mm3 \n\t" \
1071 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1072 "movq (%2, "#index"), %%mm4 \n\t" \
1073 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1074 "psraw $4, %%mm3 \n\t" \
1075 "psraw $4, %%mm4 \n\t" \
1076 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
1077 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
1078 "movq %%mm3, %%mm2 \n\t" \
1079 "movq %%mm4, %%mm5 \n\t" \
1080 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1081 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1083 "movq (%0, "#index", 2), %%mm1 \n\t" \
1084 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1085 "psraw $4, %%mm1 \n\t" \
1086 "psraw $4, %%mm7 \n\t" \
1087 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1088 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1089 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
1090 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
1091 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1092 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1094 "paddw %%mm3, %%mm4 \n\t"\
1095 "movq %%mm2, %%mm0 \n\t"\
1096 "movq %%mm5, %%mm6 \n\t"\
1097 "movq %%mm4, %%mm3 \n\t"\
1098 "punpcklwd %%mm2, %%mm2 \n\t"\
1099 "punpcklwd %%mm5, %%mm5 \n\t"\
1100 "punpcklwd %%mm4, %%mm4 \n\t"\
1101 "paddw %%mm1, %%mm2 \n\t"\
1102 "paddw %%mm1, %%mm5 \n\t"\
1103 "paddw %%mm1, %%mm4 \n\t"\
1104 "punpckhwd %%mm0, %%mm0 \n\t"\
1105 "punpckhwd %%mm6, %%mm6 \n\t"\
1106 "punpckhwd %%mm3, %%mm3 \n\t"\
1107 "paddw %%mm7, %%mm0 \n\t"\
1108 "paddw %%mm7, %%mm6 \n\t"\
1109 "paddw %%mm7, %%mm3 \n\t"\
1111 "packuswb %%mm0, %%mm2 \n\t"\
1112 "packuswb %%mm6, %%mm5 \n\t"\
1113 "packuswb %%mm3, %%mm4 \n\t"\
1115 #define YSCALEYUV2RGB1(index, c) REAL_YSCALEYUV2RGB1(index, c)
1118 #define REAL_YSCALEYUV2RGB1b(index, c) \
1119 "xor "#index", "#index" \n\t"\
1122 "movq (%2, "#index"), %%mm2 \n\t" \
1123 "movq (%3, "#index"), %%mm3 \n\t" \
1124 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1125 "movq (%2, "#index"), %%mm5 \n\t" \
1126 "movq (%3, "#index"), %%mm4 \n\t" \
1127 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1128 "paddw %%mm2, %%mm3 \n\t" \
1129 "paddw %%mm5, %%mm4 \n\t" \
1130 "psrlw $5, %%mm3 \n\t" \
1131 "psrlw $5, %%mm4 \n\t" \
1132 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
1133 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
1134 "movq %%mm3, %%mm2 \n\t" \
1135 "movq %%mm4, %%mm5 \n\t" \
1136 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1137 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1139 "movq (%0, "#index", 2), %%mm1 \n\t" \
1140 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1141 "psraw $4, %%mm1 \n\t" \
1142 "psraw $4, %%mm7 \n\t" \
1143 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1144 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1145 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
1146 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
1147 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1148 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1150 "paddw %%mm3, %%mm4 \n\t"\
1151 "movq %%mm2, %%mm0 \n\t"\
1152 "movq %%mm5, %%mm6 \n\t"\
1153 "movq %%mm4, %%mm3 \n\t"\
1154 "punpcklwd %%mm2, %%mm2 \n\t"\
1155 "punpcklwd %%mm5, %%mm5 \n\t"\
1156 "punpcklwd %%mm4, %%mm4 \n\t"\
1157 "paddw %%mm1, %%mm2 \n\t"\
1158 "paddw %%mm1, %%mm5 \n\t"\
1159 "paddw %%mm1, %%mm4 \n\t"\
1160 "punpckhwd %%mm0, %%mm0 \n\t"\
1161 "punpckhwd %%mm6, %%mm6 \n\t"\
1162 "punpckhwd %%mm3, %%mm3 \n\t"\
1163 "paddw %%mm7, %%mm0 \n\t"\
1164 "paddw %%mm7, %%mm6 \n\t"\
1165 "paddw %%mm7, %%mm3 \n\t"\
1167 "packuswb %%mm0, %%mm2 \n\t"\
1168 "packuswb %%mm6, %%mm5 \n\t"\
1169 "packuswb %%mm3, %%mm4 \n\t"\
1171 #define YSCALEYUV2RGB1b(index, c) REAL_YSCALEYUV2RGB1b(index, c)
1173 #define REAL_YSCALEYUV2RGB1_ALPHA(index) \
1174 "movq (%1, "#index", 2), %%mm7 \n\t" \
1175 "movq 8(%1, "#index", 2), %%mm1 \n\t" \
1176 "psraw $7, %%mm7 \n\t" \
1177 "psraw $7, %%mm1 \n\t" \
1178 "packuswb %%mm1, %%mm7 \n\t"
1179 #define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index)
1185 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1186 const int16_t *abuf0,
uint8_t *dest,
1187 int dstW,
int uvalpha,
int y)
1189 const int16_t *ubuf0 = ubuf[0];
1190 const int16_t *buf1= buf0;
1192 if (uvalpha < 2048) {
1193 const int16_t *ubuf1 = ubuf[0];
1194 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
1197 "mov %4, %%"REG_b
" \n\t"
1198 "push %%"REG_BP
" \n\t"
1201 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1202 "pop %%"REG_BP
" \n\t"
1204 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1210 "mov %4, %%"REG_b
" \n\t"
1211 "push %%"REG_BP
" \n\t"
1213 "pcmpeqd %%mm7, %%mm7 \n\t"
1214 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1215 "pop %%"REG_BP
" \n\t"
1217 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1222 const int16_t *ubuf1 = ubuf[1];
1223 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
1226 "mov %4, %%"REG_b
" \n\t"
1227 "push %%"REG_BP
" \n\t"
1230 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1231 "pop %%"REG_BP
" \n\t"
1233 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1239 "mov %4, %%"REG_b
" \n\t"
1240 "push %%"REG_BP
" \n\t"
1242 "pcmpeqd %%mm7, %%mm7 \n\t"
1243 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1244 "pop %%"REG_BP
" \n\t"
1246 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1254 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1255 const int16_t *abuf0,
uint8_t *dest,
1256 int dstW,
int uvalpha,
int y)
1258 const int16_t *ubuf0 = ubuf[0];
1259 const int16_t *buf1= buf0;
1261 if (uvalpha < 2048) {
1262 const int16_t *ubuf1 = ubuf[0];
1265 "mov %4, %%"REG_b
" \n\t"
1266 "push %%"REG_BP
" \n\t"
1268 "pxor %%mm7, %%mm7 \n\t"
1270 "pop %%"REG_BP
" \n\t"
1272 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1277 const int16_t *ubuf1 = ubuf[1];
1280 "mov %4, %%"REG_b
" \n\t"
1281 "push %%"REG_BP
" \n\t"
1283 "pxor %%mm7, %%mm7 \n\t"
1285 "pop %%"REG_BP
" \n\t"
1287 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1295 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1296 const int16_t *abuf0,
uint8_t *dest,
1297 int dstW,
int uvalpha,
int y)
1299 const int16_t *ubuf0 = ubuf[0];
1300 const int16_t *buf1= buf0;
1302 if (uvalpha < 2048) {
1303 const int16_t *ubuf1 = ubuf[0];
1306 "mov %4, %%"REG_b
" \n\t"
1307 "push %%"REG_BP
" \n\t"
1309 "pxor %%mm7, %%mm7 \n\t"
1317 "pop %%"REG_BP
" \n\t"
1319 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1324 const int16_t *ubuf1 = ubuf[1];
1327 "mov %4, %%"REG_b
" \n\t"
1328 "push %%"REG_BP
" \n\t"
1330 "pxor %%mm7, %%mm7 \n\t"
1338 "pop %%"REG_BP
" \n\t"
1340 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1348 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1349 const int16_t *abuf0,
uint8_t *dest,
1350 int dstW,
int uvalpha,
int y)
1352 const int16_t *ubuf0 = ubuf[0];
1353 const int16_t *buf1= buf0;
1355 if (uvalpha < 2048) {
1356 const int16_t *ubuf1 = ubuf[0];
1359 "mov %4, %%"REG_b
" \n\t"
1360 "push %%"REG_BP
" \n\t"
1362 "pxor %%mm7, %%mm7 \n\t"
1370 "pop %%"REG_BP
" \n\t"
1372 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1377 const int16_t *ubuf1 = ubuf[1];
1380 "mov %4, %%"REG_b
" \n\t"
1381 "push %%"REG_BP
" \n\t"
1383 "pxor %%mm7, %%mm7 \n\t"
1391 "pop %%"REG_BP
" \n\t"
1393 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1400 #define REAL_YSCALEYUV2PACKED1(index, c) \
1401 "xor "#index", "#index" \n\t"\
1404 "movq (%2, "#index"), %%mm3 \n\t" \
1405 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1406 "movq (%2, "#index"), %%mm4 \n\t" \
1407 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1408 "psraw $7, %%mm3 \n\t" \
1409 "psraw $7, %%mm4 \n\t" \
1410 "movq (%0, "#index", 2), %%mm1 \n\t" \
1411 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1412 "psraw $7, %%mm1 \n\t" \
1413 "psraw $7, %%mm7 \n\t" \
1415 #define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c)
1417 #define REAL_YSCALEYUV2PACKED1b(index, c) \
1418 "xor "#index", "#index" \n\t"\
1421 "movq (%2, "#index"), %%mm2 \n\t" \
1422 "movq (%3, "#index"), %%mm3 \n\t" \
1423 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1424 "movq (%2, "#index"), %%mm5 \n\t" \
1425 "movq (%3, "#index"), %%mm4 \n\t" \
1426 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1427 "paddw %%mm2, %%mm3 \n\t" \
1428 "paddw %%mm5, %%mm4 \n\t" \
1429 "psrlw $8, %%mm3 \n\t" \
1430 "psrlw $8, %%mm4 \n\t" \
1431 "movq (%0, "#index", 2), %%mm1 \n\t" \
1432 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1433 "psraw $7, %%mm1 \n\t" \
1434 "psraw $7, %%mm7 \n\t"
1435 #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c)
1438 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1439 const int16_t *abuf0,
uint8_t *dest,
1440 int dstW,
int uvalpha,
int y)
1442 const int16_t *ubuf0 = ubuf[0];
1443 const int16_t *buf1= buf0;
1445 if (uvalpha < 2048) {
1446 const int16_t *ubuf1 = ubuf[0];
1449 "mov %4, %%"REG_b
" \n\t"
1450 "push %%"REG_BP
" \n\t"
1453 "pop %%"REG_BP
" \n\t"
1455 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1459 const int16_t *ubuf1 = ubuf[1];
1462 "mov %4, %%"REG_b
" \n\t"
1463 "push %%"REG_BP
" \n\t"
1466 "pop %%"REG_BP
" \n\t"
1468 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1474 #if COMPILE_TEMPLATE_MMXEXT
1479 int32_t *filterPos = c->hLumFilterPos;
1480 int16_t *
filter = c->hLumFilter;
1481 void *mmxextFilterCode = c->lumMmxextFilterCode;
1492 "mov %%"REG_b
", %5 \n\t"
1494 "mov -8(%%rsp), %%"REG_a
" \n\t"
1495 "mov %%"REG_a
", %6 \n\t"
1499 "mov -8(%%rsp), %%"REG_a
" \n\t"
1500 "mov %%"REG_a
", %5 \n\t"
1503 "pxor %%mm7, %%mm7 \n\t"
1504 "mov %0, %%"REG_c
" \n\t"
1505 "mov %1, %%"REG_D
" \n\t"
1506 "mov %2, %%"REG_d
" \n\t"
1507 "mov %3, %%"REG_b
" \n\t"
1508 "xor %%"REG_a
", %%"REG_a
" \n\t"
1514 #define CALL_MMXEXT_FILTER_CODE \
1515 "movl (%%"REG_b"), %%esi \n\t"\
1517 "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
1518 "add %%"REG_S", %%"REG_c" \n\t"\
1519 "add %%"REG_a", %%"REG_D" \n\t"\
1520 "xor %%"REG_a", %%"REG_a" \n\t"\
1523 #define CALL_MMXEXT_FILTER_CODE \
1524 "movl (%%"REG_b"), %%esi \n\t"\
1526 "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
1527 "add %%"REG_a", %%"REG_D" \n\t"\
1528 "xor %%"REG_a", %%"REG_a" \n\t"\
1532 CALL_MMXEXT_FILTER_CODE
1533 CALL_MMXEXT_FILTER_CODE
1534 CALL_MMXEXT_FILTER_CODE
1535 CALL_MMXEXT_FILTER_CODE
1536 CALL_MMXEXT_FILTER_CODE
1537 CALL_MMXEXT_FILTER_CODE
1538 CALL_MMXEXT_FILTER_CODE
1539 CALL_MMXEXT_FILTER_CODE
1542 "mov %5, %%"REG_b
" \n\t"
1544 "mov %6, %%"REG_a
" \n\t"
1545 "mov %%"REG_a
", -8(%%rsp) \n\t"
1549 "mov %5, %%"REG_a
" \n\t"
1550 "mov %%"REG_a
", -8(%%rsp) \n\t"
1553 ::
"m" (
src),
"m" (dst),
"m" (
filter),
"m" (filterPos),
1554 "m" (mmxextFilterCode)
1561 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S,
"%"REG_D
1567 for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--)
1568 dst[i] = src[srcW-1]*128;
1572 int dstWidth,
const uint8_t *src1,
1575 int32_t *filterPos = c->hChrFilterPos;
1576 int16_t *filter = c->hChrFilter;
1577 void *mmxextFilterCode = c->chrMmxextFilterCode;
1588 "mov %%"REG_b
", %7 \n\t"
1590 "mov -8(%%rsp), %%"REG_a
" \n\t"
1591 "mov %%"REG_a
", %8 \n\t"
1595 "mov -8(%%rsp), %%"REG_a
" \n\t"
1596 "mov %%"REG_a
", %7 \n\t"
1599 "pxor %%mm7, %%mm7 \n\t"
1600 "mov %0, %%"REG_c
" \n\t"
1601 "mov %1, %%"REG_D
" \n\t"
1602 "mov %2, %%"REG_d
" \n\t"
1603 "mov %3, %%"REG_b
" \n\t"
1604 "xor %%"REG_a
", %%"REG_a
" \n\t"
1609 CALL_MMXEXT_FILTER_CODE
1610 CALL_MMXEXT_FILTER_CODE
1611 CALL_MMXEXT_FILTER_CODE
1612 CALL_MMXEXT_FILTER_CODE
1613 "xor %%"REG_a
", %%"REG_a
" \n\t"
1614 "mov %5, %%"REG_c
" \n\t"
1615 "mov %6, %%"REG_D
" \n\t"
1620 CALL_MMXEXT_FILTER_CODE
1621 CALL_MMXEXT_FILTER_CODE
1622 CALL_MMXEXT_FILTER_CODE
1623 CALL_MMXEXT_FILTER_CODE
1626 "mov %7, %%"REG_b
" \n\t"
1628 "mov %8, %%"REG_a
" \n\t"
1629 "mov %%"REG_a
", -8(%%rsp) \n\t"
1633 "mov %7, %%"REG_a
" \n\t"
1634 "mov %%"REG_a
", -8(%%rsp) \n\t"
1637 ::
"m" (src1),
"m" (dst1),
"m" (
filter),
"m" (filterPos),
1638 "m" (mmxextFilterCode),
"m" (src2),
"m"(dst2)
1645 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S,
"%"REG_D
1651 for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
1652 dst1[i] = src1[srcW-1]*128;
1653 dst2[i] = src2[srcW-1]*128;
1662 c->use_mmx_vfilter= 0;
1667 switch (c->dstFormat) {
1679 c->use_mmx_vfilter= 1;
1680 c->yuv2planeX =
RENAME(yuv2yuvX );
1682 switch (c->dstFormat) {
1695 switch (c->dstFormat) {
1697 c->yuv2packed1 =
RENAME(yuv2rgb32_1);
1698 c->yuv2packed2 =
RENAME(yuv2rgb32_2);
1701 c->yuv2packed1 =
RENAME(yuv2bgr24_1);
1702 c->yuv2packed2 =
RENAME(yuv2bgr24_2);
1705 c->yuv2packed1 =
RENAME(yuv2rgb555_1);
1706 c->yuv2packed2 =
RENAME(yuv2rgb555_2);
1709 c->yuv2packed1 =
RENAME(yuv2rgb565_1);
1710 c->yuv2packed2 =
RENAME(yuv2rgb565_2);
1713 c->yuv2packed1 =
RENAME(yuv2yuyv422_1);
1714 c->yuv2packed2 =
RENAME(yuv2yuyv422_2);
1722 if (c->srcBpc == 8 && c->dstBpc <= 14) {
1724 #if COMPILE_TEMPLATE_MMXEXT
1730 c->hyscale_fast = NULL;
1731 c->hcscale_fast = NULL;
1732 #if COMPILE_TEMPLATE_MMXEXT