32 #if COMPILE_TEMPLATE_MMXEXT
33 #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
34 #define MOVNTQ2 "movntq "
36 #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
37 #define MOVNTQ2 "movq "
39 #define MOVNTQ(a,b) REAL_MOVNTQ(a,b)
41 #if !COMPILE_TEMPLATE_MMXEXT
46 __asm__
volatile(
"pxor %%mm0, %%mm0\n\t"
47 "movq (%0), %%mm3\n\t"
48 "movq %%mm3, %%mm4\n\t"
49 "psrlq $24, %%mm3\n\t"
50 "psllq $40, %%mm4\n\t"
51 "por %%mm4, %%mm3\n\t"
52 "movq %%mm3, %%mm4\n\t"
53 "punpcklbw %%mm0, %%mm3\n\t"
54 "punpckhbw %%mm0, %%mm4\n\t"
58 __asm__
volatile(
"pxor %%mm0, %%mm0\n\t"
59 "movq (%0), %%mm3\n\t"
60 "movq %%mm3, %%mm4\n\t"
61 "punpcklbw %%mm0, %%mm3\n\t"
62 "punpckhbw %%mm0, %%mm4\n\t"
69 static void RENAME(yuv2yuvX)(
const int16_t *
filter,
int filterSize,
77 "punpcklwd %%mm1, %%mm1\n\t"
78 "punpckldq %%mm1, %%mm1\n\t"
80 "paddw %%mm1, %%mm3\n\t"
81 "paddw %%mm1, %%mm4\n\t"
88 "movq %%mm3, %%mm6\n\t"
89 "movq %%mm4, %%mm7\n\t"
91 "mov %0, %%"REG_d
" \n\t"\
92 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
95 "movq 8(%%"REG_d
"), %%mm0 \n\t" \
96 "movq (%%"REG_S
", %%"REG_c
", 2), %%mm2 \n\t" \
97 "movq 8(%%"REG_S
", %%"REG_c
", 2), %%mm5 \n\t" \
98 "add $16, %%"REG_d
" \n\t"\
99 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
100 "test %%"REG_S
", %%"REG_S
" \n\t"\
101 "pmulhw %%mm0, %%mm2 \n\t"\
102 "pmulhw %%mm0, %%mm5 \n\t"\
103 "paddw %%mm2, %%mm3 \n\t"\
104 "paddw %%mm5, %%mm4 \n\t"\
106 "psraw $3, %%mm3 \n\t"\
107 "psraw $3, %%mm4 \n\t"\
108 "packuswb %%mm4, %%mm3 \n\t"
109 MOVNTQ2 " %%mm3, (%1, %%"REG_c
")\n\t"
110 "add $8, %%"REG_c
" \n\t"\
111 "cmp %2, %%"REG_c
" \n\t"\
112 "movq %%mm6, %%mm3\n\t"
113 "movq %%mm7, %%mm4\n\t"
114 "mov %0, %%"REG_d
" \n\t"\
115 "mov (%%"REG_d
"), %%"REG_S
" \n\t"\
119 :
"%"REG_d,
"%"REG_S,
"%"REG_c
123 #define YSCALEYUV2PACKEDX_UV \
125 "xor %%"REG_a", %%"REG_a" \n\t"\
129 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
130 "mov (%%"REG_d"), %%"REG_S" \n\t"\
131 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
132 "movq %%mm3, %%mm4 \n\t"\
135 "movq 8(%%"REG_d"), %%mm0 \n\t" \
136 "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" \
137 "add %6, %%"REG_S" \n\t" \
138 "movq (%%"REG_S", %%"REG_a"), %%mm5 \n\t" \
139 "add $16, %%"REG_d" \n\t"\
140 "mov (%%"REG_d"), %%"REG_S" \n\t"\
141 "pmulhw %%mm0, %%mm2 \n\t"\
142 "pmulhw %%mm0, %%mm5 \n\t"\
143 "paddw %%mm2, %%mm3 \n\t"\
144 "paddw %%mm5, %%mm4 \n\t"\
145 "test %%"REG_S", %%"REG_S" \n\t"\
148 #define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \
149 "lea "offset"(%0), %%"REG_d" \n\t"\
150 "mov (%%"REG_d"), %%"REG_S" \n\t"\
151 "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\
152 "movq "#dst1", "#dst2" \n\t"\
155 "movq 8(%%"REG_d"), "#coeff" \n\t" \
156 "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" \
157 "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" \
158 "add $16, %%"REG_d" \n\t"\
159 "mov (%%"REG_d"), %%"REG_S" \n\t"\
160 "pmulhw "#coeff", "#src1" \n\t"\
161 "pmulhw "#coeff", "#src2" \n\t"\
162 "paddw "#src1", "#dst1" \n\t"\
163 "paddw "#src2", "#dst2" \n\t"\
164 "test %%"REG_S", %%"REG_S" \n\t"\
167 #define YSCALEYUV2PACKEDX \
168 YSCALEYUV2PACKEDX_UV \
169 YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \
171 #define YSCALEYUV2PACKEDX_END \
172 :: "r" (&c->redDither), \
173 "m" (dummy), "m" (dummy), "m" (dummy),\
174 "r" (dest), "m" (dstW_reg), "m"(uv_off) \
175 NAMED_CONSTRAINTS_ADD(bF8,bFC) \
176 : "%"REG_a, "%"REG_d, "%"REG_S \
179 #define YSCALEYUV2PACKEDX_ACCURATE_UV \
181 "xor %%"REG_a", %%"REG_a" \n\t"\
185 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
186 "mov (%%"REG_d"), %%"REG_S" \n\t"\
187 "pxor %%mm4, %%mm4 \n\t"\
188 "pxor %%mm5, %%mm5 \n\t"\
189 "pxor %%mm6, %%mm6 \n\t"\
190 "pxor %%mm7, %%mm7 \n\t"\
193 "movq (%%"REG_S", %%"REG_a"), %%mm0 \n\t" \
194 "add %6, %%"REG_S" \n\t" \
195 "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" \
196 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
197 "movq (%%"REG_S", %%"REG_a"), %%mm1 \n\t" \
198 "movq %%mm0, %%mm3 \n\t"\
199 "punpcklwd %%mm1, %%mm0 \n\t"\
200 "punpckhwd %%mm1, %%mm3 \n\t"\
201 "movq "STR(APCK_COEF)"(%%"REG_d"),%%mm1 \n\t" \
202 "pmaddwd %%mm1, %%mm0 \n\t"\
203 "pmaddwd %%mm1, %%mm3 \n\t"\
204 "paddd %%mm0, %%mm4 \n\t"\
205 "paddd %%mm3, %%mm5 \n\t"\
206 "add %6, %%"REG_S" \n\t" \
207 "movq (%%"REG_S", %%"REG_a"), %%mm3 \n\t" \
208 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
209 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
210 "test %%"REG_S", %%"REG_S" \n\t"\
211 "movq %%mm2, %%mm0 \n\t"\
212 "punpcklwd %%mm3, %%mm2 \n\t"\
213 "punpckhwd %%mm3, %%mm0 \n\t"\
214 "pmaddwd %%mm1, %%mm2 \n\t"\
215 "pmaddwd %%mm1, %%mm0 \n\t"\
216 "paddd %%mm2, %%mm6 \n\t"\
217 "paddd %%mm0, %%mm7 \n\t"\
219 "psrad $16, %%mm4 \n\t"\
220 "psrad $16, %%mm5 \n\t"\
221 "psrad $16, %%mm6 \n\t"\
222 "psrad $16, %%mm7 \n\t"\
223 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
224 "packssdw %%mm5, %%mm4 \n\t"\
225 "packssdw %%mm7, %%mm6 \n\t"\
226 "paddw %%mm0, %%mm4 \n\t"\
227 "paddw %%mm0, %%mm6 \n\t"\
228 "movq %%mm4, "U_TEMP"(%0) \n\t"\
229 "movq %%mm6, "V_TEMP"(%0) \n\t"\
231 #define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \
232 "lea "offset"(%0), %%"REG_d" \n\t"\
233 "mov (%%"REG_d"), %%"REG_S" \n\t"\
234 "pxor %%mm1, %%mm1 \n\t"\
235 "pxor %%mm5, %%mm5 \n\t"\
236 "pxor %%mm7, %%mm7 \n\t"\
237 "pxor %%mm6, %%mm6 \n\t"\
240 "movq (%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" \
241 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" \
242 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
243 "movq (%%"REG_S", %%"REG_a", 2), %%mm4 \n\t" \
244 "movq %%mm0, %%mm3 \n\t"\
245 "punpcklwd %%mm4, %%mm0 \n\t"\
246 "punpckhwd %%mm4, %%mm3 \n\t"\
247 "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm4 \n\t" \
248 "pmaddwd %%mm4, %%mm0 \n\t"\
249 "pmaddwd %%mm4, %%mm3 \n\t"\
250 "paddd %%mm0, %%mm1 \n\t"\
251 "paddd %%mm3, %%mm5 \n\t"\
252 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" \
253 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
254 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
255 "test %%"REG_S", %%"REG_S" \n\t"\
256 "movq %%mm2, %%mm0 \n\t"\
257 "punpcklwd %%mm3, %%mm2 \n\t"\
258 "punpckhwd %%mm3, %%mm0 \n\t"\
259 "pmaddwd %%mm4, %%mm2 \n\t"\
260 "pmaddwd %%mm4, %%mm0 \n\t"\
261 "paddd %%mm2, %%mm7 \n\t"\
262 "paddd %%mm0, %%mm6 \n\t"\
264 "psrad $16, %%mm1 \n\t"\
265 "psrad $16, %%mm5 \n\t"\
266 "psrad $16, %%mm7 \n\t"\
267 "psrad $16, %%mm6 \n\t"\
268 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
269 "packssdw %%mm5, %%mm1 \n\t"\
270 "packssdw %%mm6, %%mm7 \n\t"\
271 "paddw %%mm0, %%mm1 \n\t"\
272 "paddw %%mm0, %%mm7 \n\t"\
273 "movq "U_TEMP"(%0), %%mm3 \n\t"\
274 "movq "V_TEMP"(%0), %%mm4 \n\t"\
276 #define YSCALEYUV2PACKEDX_ACCURATE \
277 YSCALEYUV2PACKEDX_ACCURATE_UV \
278 YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET)
280 #define YSCALEYUV2RGBX \
281 "psubw "U_OFFSET"(%0), %%mm3 \n\t" \
282 "psubw "V_OFFSET"(%0), %%mm4 \n\t" \
283 "movq %%mm3, %%mm2 \n\t" \
284 "movq %%mm4, %%mm5 \n\t" \
285 "pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\
286 "pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\
288 "pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\
289 "pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\
290 "psubw "Y_OFFSET"(%0), %%mm1 \n\t" \
291 "psubw "Y_OFFSET"(%0), %%mm7 \n\t" \
292 "pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\
293 "pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\
295 "paddw %%mm3, %%mm4 \n\t"\
296 "movq %%mm2, %%mm0 \n\t"\
297 "movq %%mm5, %%mm6 \n\t"\
298 "movq %%mm4, %%mm3 \n\t"\
299 "punpcklwd %%mm2, %%mm2 \n\t"\
300 "punpcklwd %%mm5, %%mm5 \n\t"\
301 "punpcklwd %%mm4, %%mm4 \n\t"\
302 "paddw %%mm1, %%mm2 \n\t"\
303 "paddw %%mm1, %%mm5 \n\t"\
304 "paddw %%mm1, %%mm4 \n\t"\
305 "punpckhwd %%mm0, %%mm0 \n\t"\
306 "punpckhwd %%mm6, %%mm6 \n\t"\
307 "punpckhwd %%mm3, %%mm3 \n\t"\
308 "paddw %%mm7, %%mm0 \n\t"\
309 "paddw %%mm7, %%mm6 \n\t"\
310 "paddw %%mm7, %%mm3 \n\t"\
312 "packuswb %%mm0, %%mm2 \n\t"\
313 "packuswb %%mm6, %%mm5 \n\t"\
314 "packuswb %%mm3, %%mm4 \n\t"\
316 #define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \
317 "movq "#b", "#q2" \n\t" \
318 "movq "#r", "#t" \n\t" \
319 "punpcklbw "#g", "#b" \n\t" \
320 "punpcklbw "#a", "#r" \n\t" \
321 "punpckhbw "#g", "#q2" \n\t" \
322 "punpckhbw "#a", "#t" \n\t" \
323 "movq "#b", "#q0" \n\t" \
324 "movq "#q2", "#q3" \n\t" \
325 "punpcklwd "#r", "#q0" \n\t" \
326 "punpckhwd "#r", "#b" \n\t" \
327 "punpcklwd "#t", "#q2" \n\t" \
328 "punpckhwd "#t", "#q3" \n\t" \
330 MOVNTQ( q0, (dst, index, 4))\
331 MOVNTQ( b, 8(dst, index, 4))\
332 MOVNTQ( q2, 16(dst, index, 4))\
333 MOVNTQ( q3, 24(dst, index, 4))\
335 "add $8, "#index" \n\t"\
336 "cmp "dstw", "#index" \n\t"\
338 #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)
341 const int16_t **lumSrc,
int lumFilterSize,
342 const int16_t *chrFilter,
const int16_t **chrUSrc,
343 const int16_t **chrVSrc,
344 int chrFilterSize,
const int16_t **alpSrc,
351 if (CONFIG_SWSCALE_ALPHA &&
c->alpPixBuf) {
354 "movq %%mm2, "U_TEMP"(%0) \n\t"
355 "movq %%mm4, "V_TEMP"(%0) \n\t"
356 "movq %%mm5, "Y_TEMP"(%0) \n\t"
358 "movq "Y_TEMP"(%0), %%mm5 \n\t"
359 "psraw $3, %%mm1 \n\t"
360 "psraw $3, %%mm7 \n\t"
361 "packuswb %%mm7, %%mm1 \n\t"
362 WRITEBGR32(%4,
"%5", %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
367 "pcmpeqd %%mm7, %%mm7 \n\t"
368 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
374 const int16_t **lumSrc,
int lumFilterSize,
375 const int16_t *chrFilter,
const int16_t **chrUSrc,
376 const int16_t **chrVSrc,
377 int chrFilterSize,
const int16_t **alpSrc,
384 if (CONFIG_SWSCALE_ALPHA &&
c->alpPixBuf) {
388 "psraw $3, %%mm1 \n\t"
389 "psraw $3, %%mm7 \n\t"
390 "packuswb %%mm7, %%mm1 \n\t"
391 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
396 "pcmpeqd %%mm7, %%mm7 \n\t"
397 WRITEBGR32(%4,
"%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
402 #define REAL_WRITERGB16(dst, dstw, index) \
403 "pand "MANGLE(bF8)", %%mm2 \n\t" \
404 "pand "MANGLE(bFC)", %%mm4 \n\t" \
405 "pand "MANGLE(bF8)", %%mm5 \n\t" \
406 "psrlq $3, %%mm2 \n\t"\
408 "movq %%mm2, %%mm1 \n\t"\
409 "movq %%mm4, %%mm3 \n\t"\
411 "punpcklbw %%mm7, %%mm3 \n\t"\
412 "punpcklbw %%mm5, %%mm2 \n\t"\
413 "punpckhbw %%mm7, %%mm4 \n\t"\
414 "punpckhbw %%mm5, %%mm1 \n\t"\
416 "psllq $3, %%mm3 \n\t"\
417 "psllq $3, %%mm4 \n\t"\
419 "por %%mm3, %%mm2 \n\t"\
420 "por %%mm4, %%mm1 \n\t"\
422 MOVNTQ(%%mm2, (dst, index, 2))\
423 MOVNTQ(%%mm1, 8(dst, index, 2))\
425 "add $8, "#index" \n\t"\
426 "cmp "dstw", "#index" \n\t"\
428 #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index)
431 const int16_t **lumSrc,
int lumFilterSize,
432 const int16_t *chrFilter,
const int16_t **chrUSrc,
433 const int16_t **chrVSrc,
434 int chrFilterSize,
const int16_t **alpSrc,
443 "pxor %%mm7, %%mm7 \n\t"
455 const int16_t **lumSrc,
int lumFilterSize,
456 const int16_t *chrFilter,
const int16_t **chrUSrc,
457 const int16_t **chrVSrc,
458 int chrFilterSize,
const int16_t **alpSrc,
467 "pxor %%mm7, %%mm7 \n\t"
478 #define REAL_WRITERGB15(dst, dstw, index) \
479 "pand "MANGLE(bF8)", %%mm2 \n\t" \
480 "pand "MANGLE(bF8)", %%mm4 \n\t" \
481 "pand "MANGLE(bF8)", %%mm5 \n\t" \
482 "psrlq $3, %%mm2 \n\t"\
483 "psrlq $1, %%mm5 \n\t"\
485 "movq %%mm2, %%mm1 \n\t"\
486 "movq %%mm4, %%mm3 \n\t"\
488 "punpcklbw %%mm7, %%mm3 \n\t"\
489 "punpcklbw %%mm5, %%mm2 \n\t"\
490 "punpckhbw %%mm7, %%mm4 \n\t"\
491 "punpckhbw %%mm5, %%mm1 \n\t"\
493 "psllq $2, %%mm3 \n\t"\
494 "psllq $2, %%mm4 \n\t"\
496 "por %%mm3, %%mm2 \n\t"\
497 "por %%mm4, %%mm1 \n\t"\
499 MOVNTQ(%%mm2, (dst, index, 2))\
500 MOVNTQ(%%mm1, 8(dst, index, 2))\
502 "add $8, "#index" \n\t"\
503 "cmp "dstw", "#index" \n\t"\
505 #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index)
508 const int16_t **lumSrc,
int lumFilterSize,
509 const int16_t *chrFilter,
const int16_t **chrUSrc,
510 const int16_t **chrVSrc,
511 int chrFilterSize,
const int16_t **alpSrc,
520 "pxor %%mm7, %%mm7 \n\t"
532 const int16_t **lumSrc,
int lumFilterSize,
533 const int16_t *chrFilter,
const int16_t **chrUSrc,
534 const int16_t **chrVSrc,
535 int chrFilterSize,
const int16_t **alpSrc,
544 "pxor %%mm7, %%mm7 \n\t"
555 #define WRITEBGR24MMX(dst, dstw, index) \
557 "movq %%mm2, %%mm1 \n\t" \
558 "movq %%mm5, %%mm6 \n\t" \
559 "punpcklbw %%mm4, %%mm2 \n\t" \
560 "punpcklbw %%mm7, %%mm5 \n\t" \
561 "punpckhbw %%mm4, %%mm1 \n\t" \
562 "punpckhbw %%mm7, %%mm6 \n\t" \
563 "movq %%mm2, %%mm0 \n\t" \
564 "movq %%mm1, %%mm3 \n\t" \
565 "punpcklwd %%mm5, %%mm0 \n\t" \
566 "punpckhwd %%mm5, %%mm2 \n\t" \
567 "punpcklwd %%mm6, %%mm1 \n\t" \
568 "punpckhwd %%mm6, %%mm3 \n\t" \
570 "movq %%mm0, %%mm4 \n\t" \
571 "movq %%mm2, %%mm6 \n\t" \
572 "movq %%mm1, %%mm5 \n\t" \
573 "movq %%mm3, %%mm7 \n\t" \
575 "psllq $40, %%mm0 \n\t" \
576 "psllq $40, %%mm2 \n\t" \
577 "psllq $40, %%mm1 \n\t" \
578 "psllq $40, %%mm3 \n\t" \
580 "punpckhdq %%mm4, %%mm0 \n\t" \
581 "punpckhdq %%mm6, %%mm2 \n\t" \
582 "punpckhdq %%mm5, %%mm1 \n\t" \
583 "punpckhdq %%mm7, %%mm3 \n\t" \
585 "psrlq $8, %%mm0 \n\t" \
586 "movq %%mm2, %%mm6 \n\t" \
587 "psllq $40, %%mm2 \n\t" \
588 "por %%mm2, %%mm0 \n\t" \
589 MOVNTQ(%%mm0, (dst))\
591 "psrlq $24, %%mm6 \n\t" \
592 "movq %%mm1, %%mm5 \n\t" \
593 "psllq $24, %%mm1 \n\t" \
594 "por %%mm1, %%mm6 \n\t" \
595 MOVNTQ(%%mm6, 8(dst))\
597 "psrlq $40, %%mm5 \n\t" \
598 "psllq $8, %%mm3 \n\t" \
599 "por %%mm3, %%mm5 \n\t" \
600 MOVNTQ(%%mm5, 16(dst))\
602 "add $24, "#dst" \n\t"\
604 "add $8, "#index" \n\t"\
605 "cmp "dstw", "#index" \n\t"\
608 #define WRITEBGR24MMXEXT(dst, dstw, index) \
610 "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
611 "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
612 "pshufw $0x50, %%mm2, %%mm1 \n\t" \
613 "pshufw $0x50, %%mm4, %%mm3 \n\t" \
614 "pshufw $0x00, %%mm5, %%mm6 \n\t" \
616 "pand %%mm0, %%mm1 \n\t" \
617 "pand %%mm0, %%mm3 \n\t" \
618 "pand %%mm7, %%mm6 \n\t" \
620 "psllq $8, %%mm3 \n\t" \
621 "por %%mm1, %%mm6 \n\t"\
622 "por %%mm3, %%mm6 \n\t"\
623 MOVNTQ(%%mm6, (dst))\
625 "psrlq $8, %%mm4 \n\t" \
626 "pshufw $0xA5, %%mm2, %%mm1 \n\t" \
627 "pshufw $0x55, %%mm4, %%mm3 \n\t" \
628 "pshufw $0xA5, %%mm5, %%mm6 \n\t" \
630 "pand "MANGLE(ff_M24B)", %%mm1 \n\t" \
631 "pand %%mm7, %%mm3 \n\t" \
632 "pand %%mm0, %%mm6 \n\t" \
634 "por %%mm1, %%mm3 \n\t" \
635 "por %%mm3, %%mm6 \n\t"\
636 MOVNTQ(%%mm6, 8(dst))\
638 "pshufw $0xFF, %%mm2, %%mm1 \n\t" \
639 "pshufw $0xFA, %%mm4, %%mm3 \n\t" \
640 "pshufw $0xFA, %%mm5, %%mm6 \n\t" \
642 "pand %%mm7, %%mm1 \n\t" \
643 "pand %%mm0, %%mm3 \n\t" \
644 "pand "MANGLE(ff_M24B)", %%mm6 \n\t" \
646 "por %%mm1, %%mm3 \n\t"\
647 "por %%mm3, %%mm6 \n\t"\
648 MOVNTQ(%%mm6, 16(dst))\
650 "add $24, "#dst" \n\t"\
652 "add $8, "#index" \n\t"\
653 "cmp "dstw", "#index" \n\t"\
656 #if COMPILE_TEMPLATE_MMXEXT
658 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMXEXT(dst, dstw, index)
661 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
666 const int16_t **lumSrc,
int lumFilterSize,
667 const int16_t *chrFilter,
const int16_t **chrUSrc,
668 const int16_t **chrVSrc,
669 int chrFilterSize,
const int16_t **alpSrc,
678 "pxor %%mm7, %%mm7 \n\t"
679 "lea (%%"REG_a
", %%"REG_a
", 2), %%"REG_c
"\n\t"
680 "add %4, %%"REG_c
" \n\t"
682 ::
"r" (&
c->redDither),
683 "m" (dummy),
"m" (
dummy),
"m" (dummy),
684 "r" (dest),
"m" (dstW_reg),
"m"(
uv_off)
686 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S
691 const int16_t **lumSrc,
int lumFilterSize,
692 const int16_t *chrFilter,
const int16_t **chrUSrc,
693 const int16_t **chrVSrc,
694 int chrFilterSize,
const int16_t **alpSrc,
703 "pxor %%mm7, %%mm7 \n\t"
704 "lea (%%"REG_a
", %%"REG_a
", 2), %%"REG_c
" \n\t"
705 "add %4, %%"REG_c
" \n\t"
708 "m" (dummy),
"m" (dummy),
"m" (dummy),
709 "r" (dest),
"m" (dstW_reg),
"m"(uv_off)
711 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S
716 #define REAL_WRITEYUY2(dst, dstw, index) \
717 "packuswb %%mm3, %%mm3 \n\t"\
718 "packuswb %%mm4, %%mm4 \n\t"\
719 "packuswb %%mm7, %%mm1 \n\t"\
720 "punpcklbw %%mm4, %%mm3 \n\t"\
721 "movq %%mm1, %%mm7 \n\t"\
722 "punpcklbw %%mm3, %%mm1 \n\t"\
723 "punpckhbw %%mm3, %%mm7 \n\t"\
725 MOVNTQ(%%mm1, (dst, index, 2))\
726 MOVNTQ(%%mm7, 8(dst, index, 2))\
728 "add $8, "#index" \n\t"\
729 "cmp "dstw", "#index" \n\t"\
731 #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index)
734 const int16_t **lumSrc,
int lumFilterSize,
735 const int16_t *chrFilter,
const int16_t **chrUSrc,
736 const int16_t **chrVSrc,
737 int chrFilterSize,
const int16_t **alpSrc,
746 "psraw $3, %%mm3 \n\t"
747 "psraw $3, %%mm4 \n\t"
748 "psraw $3, %%mm1 \n\t"
749 "psraw $3, %%mm7 \n\t"
755 const int16_t **lumSrc,
int lumFilterSize,
756 const int16_t *chrFilter,
const int16_t **chrUSrc,
757 const int16_t **chrVSrc,
758 int chrFilterSize,
const int16_t **alpSrc,
767 "psraw $3, %%mm3 \n\t"
768 "psraw $3, %%mm4 \n\t"
769 "psraw $3, %%mm1 \n\t"
770 "psraw $3, %%mm7 \n\t"
775 #define REAL_YSCALEYUV2RGB_UV(index, c) \
776 "xor "#index", "#index" \n\t"\
779 "movq (%2, "#index"), %%mm2 \n\t" \
780 "movq (%3, "#index"), %%mm3 \n\t" \
781 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
782 "movq (%2, "#index"), %%mm5 \n\t" \
783 "movq (%3, "#index"), %%mm4 \n\t" \
784 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
785 "psubw %%mm3, %%mm2 \n\t" \
786 "psubw %%mm4, %%mm5 \n\t" \
787 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
788 "pmulhw %%mm0, %%mm2 \n\t" \
789 "pmulhw %%mm0, %%mm5 \n\t" \
790 "psraw $4, %%mm3 \n\t" \
791 "psraw $4, %%mm4 \n\t" \
792 "paddw %%mm2, %%mm3 \n\t" \
793 "paddw %%mm5, %%mm4 \n\t" \
794 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
795 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
796 "movq %%mm3, %%mm2 \n\t" \
797 "movq %%mm4, %%mm5 \n\t" \
798 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
799 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
802 #define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \
803 "movq ("#b1", "#index", 2), %%mm0 \n\t" \
804 "movq ("#b2", "#index", 2), %%mm1 \n\t" \
805 "movq 8("#b1", "#index", 2), %%mm6 \n\t" \
806 "movq 8("#b2", "#index", 2), %%mm7 \n\t" \
807 "psubw %%mm1, %%mm0 \n\t" \
808 "psubw %%mm7, %%mm6 \n\t" \
809 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" \
810 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" \
811 "psraw $4, %%mm1 \n\t" \
812 "psraw $4, %%mm7 \n\t" \
813 "paddw %%mm0, %%mm1 \n\t" \
814 "paddw %%mm6, %%mm7 \n\t" \
816 #define REAL_YSCALEYUV2RGB_COEFF(c) \
817 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
818 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
819 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
820 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
821 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
822 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
824 "paddw %%mm3, %%mm4 \n\t"\
825 "movq %%mm2, %%mm0 \n\t"\
826 "movq %%mm5, %%mm6 \n\t"\
827 "movq %%mm4, %%mm3 \n\t"\
828 "punpcklwd %%mm2, %%mm2 \n\t"\
829 "punpcklwd %%mm5, %%mm5 \n\t"\
830 "punpcklwd %%mm4, %%mm4 \n\t"\
831 "paddw %%mm1, %%mm2 \n\t"\
832 "paddw %%mm1, %%mm5 \n\t"\
833 "paddw %%mm1, %%mm4 \n\t"\
834 "punpckhwd %%mm0, %%mm0 \n\t"\
835 "punpckhwd %%mm6, %%mm6 \n\t"\
836 "punpckhwd %%mm3, %%mm3 \n\t"\
837 "paddw %%mm7, %%mm0 \n\t"\
838 "paddw %%mm7, %%mm6 \n\t"\
839 "paddw %%mm7, %%mm3 \n\t"\
841 "packuswb %%mm0, %%mm2 \n\t"\
842 "packuswb %%mm6, %%mm5 \n\t"\
843 "packuswb %%mm3, %%mm4 \n\t"\
845 #define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2)
847 #define YSCALEYUV2RGB(index, c) \
848 REAL_YSCALEYUV2RGB_UV(index, c) \
849 REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \
850 REAL_YSCALEYUV2RGB_COEFF(c)
856 const int16_t *ubuf[2],
const int16_t *vbuf[2],
857 const int16_t *abuf[2],
uint8_t *dest,
858 int dstW,
int yalpha,
int uvalpha,
int y)
860 const int16_t *buf0 = buf[0], *buf1 = buf[1],
861 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
863 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
864 const int16_t *abuf0 = abuf[0], *abuf1 = abuf[1];
869 "psraw $3, %%mm1 \n\t"
870 "psraw $3, %%mm7 \n\t"
871 "packuswb %%mm7, %%mm1 \n\t"
872 WRITEBGR32(%4,
DSTW_OFFSET"(%5)", %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
873 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"r" (dest),
875 "r" (abuf0),
"r" (abuf1)
879 c->u_temp=(intptr_t)abuf0;
880 c->v_temp=(intptr_t)abuf1;
883 "mov %4, %%"REG_b
" \n\t"
884 "push %%"REG_BP
" \n\t"
888 "mov "U_TEMP"(%5), %0 \n\t"
889 "mov "V_TEMP"(%5), %1 \n\t"
891 "psraw $3, %%mm1 \n\t"
892 "psraw $3, %%mm7 \n\t"
893 "packuswb %%mm7, %%mm1 \n\t"
896 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
897 "pop %%"REG_BP
" \n\t"
899 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
906 "mov %4, %%"REG_b
" \n\t"
907 "push %%"REG_BP
" \n\t"
909 "pcmpeqd %%mm7, %%mm7 \n\t"
910 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
911 "pop %%"REG_BP
" \n\t"
913 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
920 const int16_t *ubuf[2],
const int16_t *vbuf[2],
921 const int16_t *abuf[2],
uint8_t *dest,
922 int dstW,
int yalpha,
int uvalpha,
int y)
924 const int16_t *buf0 = buf[0], *buf1 = buf[1],
925 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
929 "mov %4, %%"REG_b
" \n\t"
930 "push %%"REG_BP
" \n\t"
932 "pxor %%mm7, %%mm7 \n\t"
934 "pop %%"REG_BP
" \n\t"
936 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
943 const int16_t *ubuf[2],
const int16_t *vbuf[2],
944 const int16_t *abuf[2],
uint8_t *dest,
945 int dstW,
int yalpha,
int uvalpha,
int y)
947 const int16_t *buf0 = buf[0], *buf1 = buf[1],
948 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
952 "mov %4, %%"REG_b
" \n\t"
953 "push %%"REG_BP
" \n\t"
955 "pxor %%mm7, %%mm7 \n\t"
963 "pop %%"REG_BP
" \n\t"
965 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
972 const int16_t *ubuf[2],
const int16_t *vbuf[2],
973 const int16_t *abuf[2],
uint8_t *dest,
974 int dstW,
int yalpha,
int uvalpha,
int y)
976 const int16_t *buf0 = buf[0], *buf1 = buf[1],
977 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
981 "mov %4, %%"REG_b
" \n\t"
982 "push %%"REG_BP
" \n\t"
984 "pxor %%mm7, %%mm7 \n\t"
992 "pop %%"REG_BP
" \n\t"
994 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1000 #define REAL_YSCALEYUV2PACKED(index, c) \
1001 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
1002 "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\
1003 "psraw $3, %%mm0 \n\t"\
1004 "psraw $3, %%mm1 \n\t"\
1005 "movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
1006 "movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
1007 "xor "#index", "#index" \n\t"\
1010 "movq (%2, "#index"), %%mm2 \n\t" \
1011 "movq (%3, "#index"), %%mm3 \n\t" \
1012 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1013 "movq (%2, "#index"), %%mm5 \n\t" \
1014 "movq (%3, "#index"), %%mm4 \n\t" \
1015 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1016 "psubw %%mm3, %%mm2 \n\t" \
1017 "psubw %%mm4, %%mm5 \n\t" \
1018 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
1019 "pmulhw %%mm0, %%mm2 \n\t" \
1020 "pmulhw %%mm0, %%mm5 \n\t" \
1021 "psraw $7, %%mm3 \n\t" \
1022 "psraw $7, %%mm4 \n\t" \
1023 "paddw %%mm2, %%mm3 \n\t" \
1024 "paddw %%mm5, %%mm4 \n\t" \
1025 "movq (%0, "#index", 2), %%mm0 \n\t" \
1026 "movq (%1, "#index", 2), %%mm1 \n\t" \
1027 "movq 8(%0, "#index", 2), %%mm6 \n\t" \
1028 "movq 8(%1, "#index", 2), %%mm7 \n\t" \
1029 "psubw %%mm1, %%mm0 \n\t" \
1030 "psubw %%mm7, %%mm6 \n\t" \
1031 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" \
1032 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" \
1033 "psraw $7, %%mm1 \n\t" \
1034 "psraw $7, %%mm7 \n\t" \
1035 "paddw %%mm0, %%mm1 \n\t" \
1036 "paddw %%mm6, %%mm7 \n\t" \
1038 #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c)
1041 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1042 const int16_t *abuf[2],
uint8_t *dest,
1043 int dstW,
int yalpha,
int uvalpha,
int y)
1045 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1046 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
1050 "mov %4, %%"REG_b
" \n\t"
1051 "push %%"REG_BP
" \n\t"
1054 "pop %%"REG_BP
" \n\t"
1056 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1061 #define REAL_YSCALEYUV2RGB1(index, c) \
1062 "xor "#index", "#index" \n\t"\
1065 "movq (%2, "#index"), %%mm3 \n\t" \
1066 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1067 "movq (%2, "#index"), %%mm4 \n\t" \
1068 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1069 "psraw $4, %%mm3 \n\t" \
1070 "psraw $4, %%mm4 \n\t" \
1071 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
1072 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
1073 "movq %%mm3, %%mm2 \n\t" \
1074 "movq %%mm4, %%mm5 \n\t" \
1075 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1076 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1078 "movq (%0, "#index", 2), %%mm1 \n\t" \
1079 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1080 "psraw $4, %%mm1 \n\t" \
1081 "psraw $4, %%mm7 \n\t" \
1082 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1083 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1084 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
1085 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
1086 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1087 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1089 "paddw %%mm3, %%mm4 \n\t"\
1090 "movq %%mm2, %%mm0 \n\t"\
1091 "movq %%mm5, %%mm6 \n\t"\
1092 "movq %%mm4, %%mm3 \n\t"\
1093 "punpcklwd %%mm2, %%mm2 \n\t"\
1094 "punpcklwd %%mm5, %%mm5 \n\t"\
1095 "punpcklwd %%mm4, %%mm4 \n\t"\
1096 "paddw %%mm1, %%mm2 \n\t"\
1097 "paddw %%mm1, %%mm5 \n\t"\
1098 "paddw %%mm1, %%mm4 \n\t"\
1099 "punpckhwd %%mm0, %%mm0 \n\t"\
1100 "punpckhwd %%mm6, %%mm6 \n\t"\
1101 "punpckhwd %%mm3, %%mm3 \n\t"\
1102 "paddw %%mm7, %%mm0 \n\t"\
1103 "paddw %%mm7, %%mm6 \n\t"\
1104 "paddw %%mm7, %%mm3 \n\t"\
1106 "packuswb %%mm0, %%mm2 \n\t"\
1107 "packuswb %%mm6, %%mm5 \n\t"\
1108 "packuswb %%mm3, %%mm4 \n\t"\
1110 #define YSCALEYUV2RGB1(index, c) REAL_YSCALEYUV2RGB1(index, c)
1113 #define REAL_YSCALEYUV2RGB1b(index, c) \
1114 "xor "#index", "#index" \n\t"\
1117 "movq (%2, "#index"), %%mm2 \n\t" \
1118 "movq (%3, "#index"), %%mm3 \n\t" \
1119 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1120 "movq (%2, "#index"), %%mm5 \n\t" \
1121 "movq (%3, "#index"), %%mm4 \n\t" \
1122 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1123 "paddw %%mm2, %%mm3 \n\t" \
1124 "paddw %%mm5, %%mm4 \n\t" \
1125 "psrlw $5, %%mm3 \n\t" \
1126 "psrlw $5, %%mm4 \n\t" \
1127 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" \
1128 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" \
1129 "movq %%mm3, %%mm2 \n\t" \
1130 "movq %%mm4, %%mm5 \n\t" \
1131 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1132 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1134 "movq (%0, "#index", 2), %%mm1 \n\t" \
1135 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1136 "psraw $4, %%mm1 \n\t" \
1137 "psraw $4, %%mm7 \n\t" \
1138 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1139 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1140 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" \
1141 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" \
1142 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1143 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1145 "paddw %%mm3, %%mm4 \n\t"\
1146 "movq %%mm2, %%mm0 \n\t"\
1147 "movq %%mm5, %%mm6 \n\t"\
1148 "movq %%mm4, %%mm3 \n\t"\
1149 "punpcklwd %%mm2, %%mm2 \n\t"\
1150 "punpcklwd %%mm5, %%mm5 \n\t"\
1151 "punpcklwd %%mm4, %%mm4 \n\t"\
1152 "paddw %%mm1, %%mm2 \n\t"\
1153 "paddw %%mm1, %%mm5 \n\t"\
1154 "paddw %%mm1, %%mm4 \n\t"\
1155 "punpckhwd %%mm0, %%mm0 \n\t"\
1156 "punpckhwd %%mm6, %%mm6 \n\t"\
1157 "punpckhwd %%mm3, %%mm3 \n\t"\
1158 "paddw %%mm7, %%mm0 \n\t"\
1159 "paddw %%mm7, %%mm6 \n\t"\
1160 "paddw %%mm7, %%mm3 \n\t"\
1162 "packuswb %%mm0, %%mm2 \n\t"\
1163 "packuswb %%mm6, %%mm5 \n\t"\
1164 "packuswb %%mm3, %%mm4 \n\t"\
1166 #define YSCALEYUV2RGB1b(index, c) REAL_YSCALEYUV2RGB1b(index, c)
1168 #define REAL_YSCALEYUV2RGB1_ALPHA(index) \
1169 "movq (%1, "#index", 2), %%mm7 \n\t" \
1170 "movq 8(%1, "#index", 2), %%mm1 \n\t" \
1171 "psraw $7, %%mm7 \n\t" \
1172 "psraw $7, %%mm1 \n\t" \
1173 "packuswb %%mm1, %%mm7 \n\t"
1174 #define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index)
1180 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1181 const int16_t *abuf0,
uint8_t *dest,
1182 int dstW,
int uvalpha,
int y)
1184 const int16_t *ubuf0 = ubuf[0];
1185 const int16_t *buf1= buf0;
1187 if (uvalpha < 2048) {
1188 const int16_t *ubuf1 = ubuf[0];
1189 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
1192 "mov %4, %%"REG_b
" \n\t"
1193 "push %%"REG_BP
" \n\t"
1196 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1197 "pop %%"REG_BP
" \n\t"
1199 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1205 "mov %4, %%"REG_b
" \n\t"
1206 "push %%"REG_BP
" \n\t"
1208 "pcmpeqd %%mm7, %%mm7 \n\t"
1209 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1210 "pop %%"REG_BP
" \n\t"
1212 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1217 const int16_t *ubuf1 = ubuf[1];
1218 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
1221 "mov %4, %%"REG_b
" \n\t"
1222 "push %%"REG_BP
" \n\t"
1225 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1226 "pop %%"REG_BP
" \n\t"
1228 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1234 "mov %4, %%"REG_b
" \n\t"
1235 "push %%"REG_BP
" \n\t"
1237 "pcmpeqd %%mm7, %%mm7 \n\t"
1238 WRITEBGR32(%%REGb,
DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1239 "pop %%"REG_BP
" \n\t"
1241 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1249 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1250 const int16_t *abuf0,
uint8_t *dest,
1251 int dstW,
int uvalpha,
int y)
1253 const int16_t *ubuf0 = ubuf[0];
1254 const int16_t *buf1= buf0;
1256 if (uvalpha < 2048) {
1257 const int16_t *ubuf1 = ubuf[0];
1260 "mov %4, %%"REG_b
" \n\t"
1261 "push %%"REG_BP
" \n\t"
1263 "pxor %%mm7, %%mm7 \n\t"
1265 "pop %%"REG_BP
" \n\t"
1267 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1272 const int16_t *ubuf1 = ubuf[1];
1275 "mov %4, %%"REG_b
" \n\t"
1276 "push %%"REG_BP
" \n\t"
1278 "pxor %%mm7, %%mm7 \n\t"
1280 "pop %%"REG_BP
" \n\t"
1282 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1290 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1291 const int16_t *abuf0,
uint8_t *dest,
1292 int dstW,
int uvalpha,
int y)
1294 const int16_t *ubuf0 = ubuf[0];
1295 const int16_t *buf1= buf0;
1297 if (uvalpha < 2048) {
1298 const int16_t *ubuf1 = ubuf[0];
1301 "mov %4, %%"REG_b
" \n\t"
1302 "push %%"REG_BP
" \n\t"
1304 "pxor %%mm7, %%mm7 \n\t"
1312 "pop %%"REG_BP
" \n\t"
1314 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1319 const int16_t *ubuf1 = ubuf[1];
1322 "mov %4, %%"REG_b
" \n\t"
1323 "push %%"REG_BP
" \n\t"
1325 "pxor %%mm7, %%mm7 \n\t"
1333 "pop %%"REG_BP
" \n\t"
1335 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1343 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1344 const int16_t *abuf0,
uint8_t *dest,
1345 int dstW,
int uvalpha,
int y)
1347 const int16_t *ubuf0 = ubuf[0];
1348 const int16_t *buf1= buf0;
1350 if (uvalpha < 2048) {
1351 const int16_t *ubuf1 = ubuf[0];
1354 "mov %4, %%"REG_b
" \n\t"
1355 "push %%"REG_BP
" \n\t"
1357 "pxor %%mm7, %%mm7 \n\t"
1365 "pop %%"REG_BP
" \n\t"
1367 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1372 const int16_t *ubuf1 = ubuf[1];
1375 "mov %4, %%"REG_b
" \n\t"
1376 "push %%"REG_BP
" \n\t"
1378 "pxor %%mm7, %%mm7 \n\t"
1386 "pop %%"REG_BP
" \n\t"
1388 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1395 #define REAL_YSCALEYUV2PACKED1(index, c) \
1396 "xor "#index", "#index" \n\t"\
1399 "movq (%2, "#index"), %%mm3 \n\t" \
1400 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1401 "movq (%2, "#index"), %%mm4 \n\t" \
1402 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1403 "psraw $7, %%mm3 \n\t" \
1404 "psraw $7, %%mm4 \n\t" \
1405 "movq (%0, "#index", 2), %%mm1 \n\t" \
1406 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1407 "psraw $7, %%mm1 \n\t" \
1408 "psraw $7, %%mm7 \n\t" \
1410 #define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c)
1412 #define REAL_YSCALEYUV2PACKED1b(index, c) \
1413 "xor "#index", "#index" \n\t"\
1416 "movq (%2, "#index"), %%mm2 \n\t" \
1417 "movq (%3, "#index"), %%mm3 \n\t" \
1418 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1419 "movq (%2, "#index"), %%mm5 \n\t" \
1420 "movq (%3, "#index"), %%mm4 \n\t" \
1421 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1422 "paddw %%mm2, %%mm3 \n\t" \
1423 "paddw %%mm5, %%mm4 \n\t" \
1424 "psrlw $8, %%mm3 \n\t" \
1425 "psrlw $8, %%mm4 \n\t" \
1426 "movq (%0, "#index", 2), %%mm1 \n\t" \
1427 "movq 8(%0, "#index", 2), %%mm7 \n\t" \
1428 "psraw $7, %%mm1 \n\t" \
1429 "psraw $7, %%mm7 \n\t"
1430 #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c)
1433 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1434 const int16_t *abuf0,
uint8_t *dest,
1435 int dstW,
int uvalpha,
int y)
1437 const int16_t *ubuf0 = ubuf[0];
1438 const int16_t *buf1= buf0;
1440 if (uvalpha < 2048) {
1441 const int16_t *ubuf1 = ubuf[0];
1444 "mov %4, %%"REG_b
" \n\t"
1445 "push %%"REG_BP
" \n\t"
1448 "pop %%"REG_BP
" \n\t"
1450 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1454 const int16_t *ubuf1 = ubuf[1];
1457 "mov %4, %%"REG_b
" \n\t"
1458 "push %%"REG_BP
" \n\t"
1461 "pop %%"REG_BP
" \n\t"
1463 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1472 c->use_mmx_vfilter= 0;
1477 switch (c->dstFormat) {
1489 c->use_mmx_vfilter= 1;
1490 c->yuv2planeX =
RENAME(yuv2yuvX );
1492 switch (c->dstFormat) {
1505 switch (c->dstFormat) {
1507 c->yuv2packed1 =
RENAME(yuv2rgb32_1);
1508 c->yuv2packed2 =
RENAME(yuv2rgb32_2);
1511 c->yuv2packed1 =
RENAME(yuv2bgr24_1);
1512 c->yuv2packed2 =
RENAME(yuv2bgr24_2);
1515 c->yuv2packed1 =
RENAME(yuv2rgb555_1);
1516 c->yuv2packed2 =
RENAME(yuv2rgb555_2);
1519 c->yuv2packed1 =
RENAME(yuv2rgb565_1);
1520 c->yuv2packed2 =
RENAME(yuv2rgb565_2);
1523 c->yuv2packed1 =
RENAME(yuv2yuyv422_1);
1524 c->yuv2packed2 =
RENAME(yuv2yuyv422_2);
1532 if (c->srcBpc == 8 && c->dstBpc <= 14) {
1534 #if COMPILE_TEMPLATE_MMXEXT
1540 c->hyscale_fast =
NULL;
1541 c->hcscale_fast =
NULL;
1542 #if COMPILE_TEMPLATE_MMXEXT
#define YSCALEYUV2RGB1_ALPHA(index)
#define ALP_MMX_FILTER_OFFSET
#define YSCALEYUV2PACKED1(index, c)
void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
int dstY
Last destination vertical line output from last slice.
#define YSCALEYUV2PACKEDX_END
void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
ptrdiff_t uv_off
offset (in pixels) between u and v planes
#define SWS_FULL_CHR_H_INT
#define SWS_FAST_BILINEAR
enum AVPixelFormat dstFormat
Destination pixel format.
#define WRITERGB15(dst, dstw, index)
#define YSCALEYUV2PACKEDX
static const uint8_t dither[8][8]
#define WRITEBGR24(dst, dstw, index)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
#define YSCALEYUV2RGB1b(index, c)
static const uint8_t offset[127][2]
#define YSCALEYUV2RGB_YA(index, c, b1, b2)
#define YSCALEYUV2PACKED(index, c)
#define WRITERGB16(dst, dstw, index)
static av_cold void sws_init_swscale(SwsContext *c)
as above, but U and V bytes are swapped
#define YSCALEYUV2PACKEDX_ACCURATE
static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
#define YSCALEYUV2PACKEDX_YA(offset, coeff, src1, src2, dst1, dst2)
packed RGB 8:8:8, 24bpp, BGRBGR...
int dstW
Width of destination luma/alpha planes.
static av_always_inline void dither_8to16(const uint8_t *srcDither, int rot)
#define YSCALEYUV2RGB(index, c)
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
#define YSCALEYUV2PACKED1b(index, c)
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
#define AV_PIX_FMT_RGB555
#define YSCALEYUV2PACKEDX_ACCURATE_YA(offset)
#define AV_PIX_FMT_RGB565
#define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
#define WRITEYUY2(dst, dstw, index)
AVPixelFormat
Pixel format.
#define YSCALEYUV2RGB1(index, c)
#define NAMED_CONSTRAINTS_ADD(...)