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 #define REAL_NEXT_PIXEL_BLOCK(dstw, index, step_back) \
42 "add $16, "#index" \n\t"\
43 "cmp "dstw", "#index" \n\t"\
44 "lea -8("#index"), "#index" \n\t"\
46 "cmp "dstw", "#index" \n\t"\
48 "add $8, "#index" \n\t"\
49 "sub "dstw", "#index" \n\t"\
51 "mov "dstw", "#index" \n\t"\
52 "sub $8, "#index" \n\t"\
55 #define NEXT_PIXEL_BLOCK(dstw, index, step_back) REAL_NEXT_PIXEL_BLOCK(dstw, index, step_back)
57 #define YSCALEYUV2PACKEDX_UV \
59 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"\
63 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"FF_REG_d" \n\t"\
64 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
65 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
66 "movq %%mm3, %%mm4 \n\t"\
69 "movq 8(%%"FF_REG_d"), %%mm0 \n\t"
\
70 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm2 \n\t"
\
71 "add %6, %%"FF_REG_S" \n\t" \
72 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm5 \n\t"
\
73 "add $16, %%"FF_REG_d" \n\t"\
74 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
75 "pmulhw %%mm0, %%mm2 \n\t"\
76 "pmulhw %%mm0, %%mm5 \n\t"\
77 "paddw %%mm2, %%mm3 \n\t"\
78 "paddw %%mm5, %%mm4 \n\t"\
79 "test %%"FF_REG_S", %%"FF_REG_S" \n\t"\
82 #define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \
83 "lea "offset"(%0), %%"FF_REG_d" \n\t"\
84 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
85 "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\
86 "movq "#dst1", "#dst2" \n\t"\
89 "movq 8(%%"FF_REG_d"), "#coeff" \n\t"
\
90 "movq (%%"FF_REG_S", %%"FF_REG_a", 2), "#src1" \n\t"
\
91 "movq 8(%%"FF_REG_S", %%"FF_REG_a", 2), "#src2" \n\t"
\
92 "add $16, %%"FF_REG_d" \n\t"\
93 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
94 "pmulhw "#coeff", "#src1" \n\t"\
95 "pmulhw "#coeff", "#src2" \n\t"\
96 "paddw "#src1", "#dst1" \n\t"\
97 "paddw "#src2", "#dst2" \n\t"\
98 "test %%"FF_REG_S", %%"FF_REG_S" \n\t"\
101 #define YSCALEYUV2PACKEDX \
102 YSCALEYUV2PACKEDX_UV \
103 YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \
105 #define YSCALEYUV2PACKEDX_END \
106 :: "r" (&c->redDither), \
107 "m" (dummy), "m" (dummy), "m" (dummy),\
108 "r" (dest), "m" (dstW_reg), "m"(uv_off) \
109 NAMED_CONSTRAINTS_ADD(bF8,bFC) \
110 : "%"FF_REG_a, "%"FF_REG_d, "%"FF_REG_S \
113 #define YSCALEYUV2PACKEDX_ACCURATE_UV \
115 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"\
119 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"FF_REG_d" \n\t"\
120 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
121 "pxor %%mm4, %%mm4 \n\t"\
122 "pxor %%mm5, %%mm5 \n\t"\
123 "pxor %%mm6, %%mm6 \n\t"\
124 "pxor %%mm7, %%mm7 \n\t"\
127 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm0 \n\t"
\
128 "add %6, %%"FF_REG_S" \n\t" \
129 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm2 \n\t"
\
130 "mov "STR(APCK_PTR2)"(%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
131 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm1 \n\t"
\
132 "movq %%mm0, %%mm3 \n\t"\
133 "punpcklwd %%mm1, %%mm0 \n\t"\
134 "punpckhwd %%mm1, %%mm3 \n\t"\
135 "movq "STR(APCK_COEF)"(%%"FF_REG_d"),%%mm1 \n\t"
\
136 "pmaddwd %%mm1, %%mm0 \n\t"\
137 "pmaddwd %%mm1, %%mm3 \n\t"\
138 "paddd %%mm0, %%mm4 \n\t"\
139 "paddd %%mm3, %%mm5 \n\t"\
140 "add %6, %%"FF_REG_S" \n\t" \
141 "movq (%%"FF_REG_S", %%"FF_REG_a"), %%mm3 \n\t"
\
142 "mov "STR(APCK_SIZE)"(%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
143 "add $"STR(APCK_SIZE)", %%"FF_REG_d" \n\t"\
144 "test %%"FF_REG_S", %%"FF_REG_S" \n\t"\
145 "movq %%mm2, %%mm0 \n\t"\
146 "punpcklwd %%mm3, %%mm2 \n\t"\
147 "punpckhwd %%mm3, %%mm0 \n\t"\
148 "pmaddwd %%mm1, %%mm2 \n\t"\
149 "pmaddwd %%mm1, %%mm0 \n\t"\
150 "paddd %%mm2, %%mm6 \n\t"\
151 "paddd %%mm0, %%mm7 \n\t"\
153 "psrad $16, %%mm4 \n\t"\
154 "psrad $16, %%mm5 \n\t"\
155 "psrad $16, %%mm6 \n\t"\
156 "psrad $16, %%mm7 \n\t"\
157 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
158 "packssdw %%mm5, %%mm4 \n\t"\
159 "packssdw %%mm7, %%mm6 \n\t"\
160 "paddw %%mm0, %%mm4 \n\t"\
161 "paddw %%mm0, %%mm6 \n\t"\
162 "movq %%mm4, "U_TEMP"(%0) \n\t"\
163 "movq %%mm6, "V_TEMP"(%0) \n\t"\
165 #define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \
166 "lea "offset"(%0), %%"FF_REG_d" \n\t"\
167 "mov (%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
168 "pxor %%mm1, %%mm1 \n\t"\
169 "pxor %%mm5, %%mm5 \n\t"\
170 "pxor %%mm7, %%mm7 \n\t"\
171 "pxor %%mm6, %%mm6 \n\t"\
174 "movq (%%"FF_REG_S", %%"FF_REG_a", 2), %%mm0 \n\t"
\
175 "movq 8(%%"FF_REG_S", %%"FF_REG_a", 2), %%mm2 \n\t"
\
176 "mov "STR(APCK_PTR2)"(%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
177 "movq (%%"FF_REG_S", %%"FF_REG_a", 2), %%mm4 \n\t"
\
178 "movq %%mm0, %%mm3 \n\t"\
179 "punpcklwd %%mm4, %%mm0 \n\t"\
180 "punpckhwd %%mm4, %%mm3 \n\t"\
181 "movq "STR(APCK_COEF)"(%%"FF_REG_d"), %%mm4 \n\t"
\
182 "pmaddwd %%mm4, %%mm0 \n\t"\
183 "pmaddwd %%mm4, %%mm3 \n\t"\
184 "paddd %%mm0, %%mm1 \n\t"\
185 "paddd %%mm3, %%mm5 \n\t"\
186 "movq 8(%%"FF_REG_S", %%"FF_REG_a", 2), %%mm3 \n\t"
\
187 "mov "STR(APCK_SIZE)"(%%"FF_REG_d"), %%"FF_REG_S" \n\t"\
188 "add $"STR(APCK_SIZE)", %%"FF_REG_d" \n\t"\
189 "test %%"FF_REG_S", %%"FF_REG_S" \n\t"\
190 "movq %%mm2, %%mm0 \n\t"\
191 "punpcklwd %%mm3, %%mm2 \n\t"\
192 "punpckhwd %%mm3, %%mm0 \n\t"\
193 "pmaddwd %%mm4, %%mm2 \n\t"\
194 "pmaddwd %%mm4, %%mm0 \n\t"\
195 "paddd %%mm2, %%mm7 \n\t"\
196 "paddd %%mm0, %%mm6 \n\t"\
198 "psrad $16, %%mm1 \n\t"\
199 "psrad $16, %%mm5 \n\t"\
200 "psrad $16, %%mm7 \n\t"\
201 "psrad $16, %%mm6 \n\t"\
202 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
203 "packssdw %%mm5, %%mm1 \n\t"\
204 "packssdw %%mm6, %%mm7 \n\t"\
205 "paddw %%mm0, %%mm1 \n\t"\
206 "paddw %%mm0, %%mm7 \n\t"\
207 "movq "U_TEMP"(%0), %%mm3 \n\t"\
208 "movq "V_TEMP"(%0), %%mm4 \n\t"\
210 #define YSCALEYUV2PACKEDX_ACCURATE \
211 YSCALEYUV2PACKEDX_ACCURATE_UV \
212 YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET)
214 #define YSCALEYUV2RGBX \
215 "psubw "U_OFFSET"(%0), %%mm3 \n\t"
\
216 "psubw "V_OFFSET"(%0), %%mm4 \n\t"
\
217 "movq %%mm3, %%mm2 \n\t" \
218 "movq %%mm4, %%mm5 \n\t" \
219 "pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\
220 "pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\
222 "pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\
223 "pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\
224 "psubw "Y_OFFSET"(%0), %%mm1 \n\t"
\
225 "psubw "Y_OFFSET"(%0), %%mm7 \n\t"
\
226 "pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\
227 "pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\
229 "paddw %%mm3, %%mm4 \n\t"\
230 "movq %%mm2, %%mm0 \n\t"\
231 "movq %%mm5, %%mm6 \n\t"\
232 "movq %%mm4, %%mm3 \n\t"\
233 "punpcklwd %%mm2, %%mm2 \n\t"\
234 "punpcklwd %%mm5, %%mm5 \n\t"\
235 "punpcklwd %%mm4, %%mm4 \n\t"\
236 "paddw %%mm1, %%mm2 \n\t"\
237 "paddw %%mm1, %%mm5 \n\t"\
238 "paddw %%mm1, %%mm4 \n\t"\
239 "punpckhwd %%mm0, %%mm0 \n\t"\
240 "punpckhwd %%mm6, %%mm6 \n\t"\
241 "punpckhwd %%mm3, %%mm3 \n\t"\
242 "paddw %%mm7, %%mm0 \n\t"\
243 "paddw %%mm7, %%mm6 \n\t"\
244 "paddw %%mm7, %%mm3 \n\t"\
246 "packuswb %%mm0, %%mm2 \n\t"\
247 "packuswb %%mm6, %%mm5 \n\t"\
248 "packuswb %%mm3, %%mm4 \n\t"\
250 #define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \
251 "movq "#b", "#q2" \n\t"
\
252 "movq "#r", "#t" \n\t"
\
253 "punpcklbw "#g", "#b" \n\t"
\
254 "punpcklbw "#a", "#r" \n\t"
\
255 "punpckhbw "#g", "#q2" \n\t"
\
256 "punpckhbw "#a", "#t" \n\t"
\
257 "movq "#b", "#q0" \n\t"
\
258 "movq "#q2", "#q3" \n\t"
\
259 "punpcklwd "#r", "#q0" \n\t"
\
260 "punpckhwd "#r", "#b" \n\t"
\
261 "punpcklwd "#t", "#q2" \n\t"
\
262 "punpckhwd "#t", "#q3" \n\t"
\
264 MOVNTQ( q0, (dst, index, 4))\
265 MOVNTQ( b, 8(dst, index, 4))\
266 MOVNTQ( q2, 16(dst, index, 4))\
267 MOVNTQ( q3, 24(dst, index, 4))\
269 NEXT_PIXEL_BLOCK(dstw, index, )
270 #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)
273 const int16_t **lumSrc,
int lumFilterSize,
274 const int16_t *chrFilter,
const int16_t **chrUSrc,
275 const int16_t **chrVSrc,
276 int chrFilterSize,
const int16_t **alpSrc,
277 uint8_t *dest,
int dstW,
int dstY)
286 "movq %%mm2, "U_TEMP"(%0) \n\t"
287 "movq %%mm4, "V_TEMP"(%0) \n\t"
288 "movq %%mm5, "Y_TEMP"(%0) \n\t"
290 "movq "Y_TEMP"(%0), %%mm5 \n\t"
291 "psraw $3, %%mm1 \n\t"
292 "psraw $3, %%mm7 \n\t"
293 "packuswb %%mm7, %%mm1 \n\t"
294 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
299 "pcmpeqd %%mm7, %%mm7 \n\t"
300 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
306 const int16_t **lumSrc,
int lumFilterSize,
307 const int16_t *chrFilter,
const int16_t **chrUSrc,
308 const int16_t **chrVSrc,
309 int chrFilterSize,
const int16_t **alpSrc,
310 uint8_t *dest,
int dstW,
int dstY)
320 "psraw $3, %%mm1 \n\t"
321 "psraw $3, %%mm7 \n\t"
322 "packuswb %%mm7, %%mm1 \n\t"
323 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
328 "pcmpeqd %%mm7, %%mm7 \n\t"
329 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
335 const int16_t **lumSrc,
int lumFilterSize,
336 const int16_t *chrFilter,
const int16_t **chrUSrc,
337 const int16_t **chrVSrc,
338 int chrFilterSize,
const int16_t **alpSrc,
339 uint8_t *dest,
int dstW,
int dstY)
349 "psraw $3, %%mm1 \n\t"
350 "psraw $3, %%mm7 \n\t"
351 "packuswb %%mm7, %%mm1 \n\t"
352 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm5, %%mm4, %%mm2, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
357 "pcmpeqd %%mm7, %%mm7 \n\t"
358 WRITEBGR32(%4,
"%5", %%FF_REGa, %%mm5, %%mm4, %%mm2, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
363 #define REAL_WRITERGB16(dst, dstw, index) \
364 "pand "MANGLE(bF8)", %%mm2 \n\t"
\
365 "pand "MANGLE(bFC)", %%mm4 \n\t"
\
366 "pand "MANGLE(bF8)", %%mm5 \n\t"
\
367 "psrlq $3, %%mm2 \n\t"\
369 "movq %%mm2, %%mm1 \n\t"\
370 "movq %%mm4, %%mm3 \n\t"\
372 "punpcklbw %%mm7, %%mm3 \n\t"\
373 "punpcklbw %%mm5, %%mm2 \n\t"\
374 "punpckhbw %%mm7, %%mm4 \n\t"\
375 "punpckhbw %%mm5, %%mm1 \n\t"\
377 "psllq $3, %%mm3 \n\t"\
378 "psllq $3, %%mm4 \n\t"\
380 "por %%mm3, %%mm2 \n\t"\
381 "por %%mm4, %%mm1 \n\t"\
383 MOVNTQ(%%mm2, (dst, index, 2))\
384 MOVNTQ(%%mm1, 8(dst, index, 2))\
386 NEXT_PIXEL_BLOCK(dstw, index, )
387 #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index)
390 const int16_t **lumSrc,
int lumFilterSize,
391 const int16_t *chrFilter,
const int16_t **chrUSrc,
392 const int16_t **chrVSrc,
393 int chrFilterSize,
const int16_t **alpSrc,
394 uint8_t *dest,
int dstW,
int dstY)
402 "pxor %%mm7, %%mm7 \n\t"
414 const int16_t **lumSrc,
int lumFilterSize,
415 const int16_t *chrFilter,
const int16_t **chrUSrc,
416 const int16_t **chrVSrc,
417 int chrFilterSize,
const int16_t **alpSrc,
418 uint8_t *dest,
int dstW,
int dstY)
426 "pxor %%mm7, %%mm7 \n\t"
437 #define REAL_WRITERGB15(dst, dstw, index) \
438 "pand "MANGLE(bF8)", %%mm2 \n\t"
\
439 "pand "MANGLE(bF8)", %%mm4 \n\t"
\
440 "pand "MANGLE(bF8)", %%mm5 \n\t"
\
441 "psrlq $3, %%mm2 \n\t"\
442 "psrlq $1, %%mm5 \n\t"\
444 "movq %%mm2, %%mm1 \n\t"\
445 "movq %%mm4, %%mm3 \n\t"\
447 "punpcklbw %%mm7, %%mm3 \n\t"\
448 "punpcklbw %%mm5, %%mm2 \n\t"\
449 "punpckhbw %%mm7, %%mm4 \n\t"\
450 "punpckhbw %%mm5, %%mm1 \n\t"\
452 "psllq $2, %%mm3 \n\t"\
453 "psllq $2, %%mm4 \n\t"\
455 "por %%mm3, %%mm2 \n\t"\
456 "por %%mm4, %%mm1 \n\t"\
458 MOVNTQ(%%mm2, (dst, index, 2))\
459 MOVNTQ(%%mm1, 8(dst, index, 2))\
461 NEXT_PIXEL_BLOCK(dstw, index, )
462 #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index)
465 const int16_t **lumSrc,
int lumFilterSize,
466 const int16_t *chrFilter,
const int16_t **chrUSrc,
467 const int16_t **chrVSrc,
468 int chrFilterSize,
const int16_t **alpSrc,
469 uint8_t *dest,
int dstW,
int dstY)
477 "pxor %%mm7, %%mm7 \n\t"
489 const int16_t **lumSrc,
int lumFilterSize,
490 const int16_t *chrFilter,
const int16_t **chrUSrc,
491 const int16_t **chrVSrc,
492 int chrFilterSize,
const int16_t **alpSrc,
493 uint8_t *dest,
int dstW,
int dstY)
501 "pxor %%mm7, %%mm7 \n\t"
512 #define WRITEBGR24MMX(dst, dstw, index) \
514 "movq %%mm2, %%mm1 \n\t" \
515 "movq %%mm5, %%mm6 \n\t" \
516 "punpcklbw %%mm4, %%mm2 \n\t" \
517 "punpcklbw %%mm7, %%mm5 \n\t" \
518 "punpckhbw %%mm4, %%mm1 \n\t" \
519 "punpckhbw %%mm7, %%mm6 \n\t" \
520 "movq %%mm2, %%mm0 \n\t" \
521 "movq %%mm1, %%mm3 \n\t" \
522 "punpcklwd %%mm5, %%mm0 \n\t" \
523 "punpckhwd %%mm5, %%mm2 \n\t" \
524 "punpcklwd %%mm6, %%mm1 \n\t" \
525 "punpckhwd %%mm6, %%mm3 \n\t" \
527 "movq %%mm0, %%mm4 \n\t" \
528 "movq %%mm2, %%mm6 \n\t" \
529 "movq %%mm1, %%mm5 \n\t" \
530 "movq %%mm3, %%mm7 \n\t" \
532 "psllq $40, %%mm0 \n\t" \
533 "psllq $40, %%mm2 \n\t" \
534 "psllq $40, %%mm1 \n\t" \
535 "psllq $40, %%mm3 \n\t" \
537 "punpckhdq %%mm4, %%mm0 \n\t" \
538 "punpckhdq %%mm6, %%mm2 \n\t" \
539 "punpckhdq %%mm5, %%mm1 \n\t" \
540 "punpckhdq %%mm7, %%mm3 \n\t" \
542 "psrlq $8, %%mm0 \n\t" \
543 "movq %%mm2, %%mm6 \n\t" \
544 "psllq $40, %%mm2 \n\t" \
545 "por %%mm2, %%mm0 \n\t" \
546 MOVNTQ(%%mm0, (dst))\
548 "psrlq $24, %%mm6 \n\t" \
549 "movq %%mm1, %%mm5 \n\t" \
550 "psllq $24, %%mm1 \n\t" \
551 "por %%mm1, %%mm6 \n\t" \
552 MOVNTQ(%%mm6, 8(dst))\
554 "psrlq $40, %%mm5 \n\t" \
555 "psllq $8, %%mm3 \n\t" \
556 "por %%mm3, %%mm5 \n\t" \
557 MOVNTQ(%%mm5, 16(dst))\
559 "add $24, "#dst" \n\t"\
561 NEXT_PIXEL_BLOCK(dstw, index, "sub "#index", "#dst" \n\t"\
562 "sub "#index", "#dst" \n\t"\
563 "sub "#index", "#dst" \n\t")
565 #define WRITEBGR24MMXEXT(dst, dstw, index) \
567 "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
568 "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
569 "pshufw $0x50, %%mm2, %%mm1 \n\t"
\
570 "pshufw $0x50, %%mm4, %%mm3 \n\t" \
571 "pshufw $0x00, %%mm5, %%mm6 \n\t" \
573 "pand %%mm0, %%mm1 \n\t" \
574 "pand %%mm0, %%mm3 \n\t" \
575 "pand %%mm7, %%mm6 \n\t" \
577 "psllq $8, %%mm3 \n\t" \
578 "por %%mm1, %%mm6 \n\t"\
579 "por %%mm3, %%mm6 \n\t"\
580 MOVNTQ(%%mm6, (dst))\
582 "psrlq $8, %%mm4 \n\t"
\
583 "pshufw $0xA5, %%mm2, %%mm1 \n\t" \
584 "pshufw $0x55, %%mm4, %%mm3 \n\t" \
585 "pshufw $0xA5, %%mm5, %%mm6 \n\t" \
587 "pand "MANGLE(ff_M24B)", %%mm1 \n\t"
\
588 "pand %%mm7, %%mm3 \n\t" \
589 "pand %%mm0, %%mm6 \n\t" \
591 "por %%mm1, %%mm3 \n\t" \
592 "por %%mm3, %%mm6 \n\t"\
593 MOVNTQ(%%mm6, 8(dst))\
595 "pshufw $0xFF, %%mm2, %%mm1 \n\t"
\
596 "pshufw $0xFA, %%mm4, %%mm3 \n\t" \
597 "pshufw $0xFA, %%mm5, %%mm6 \n\t" \
599 "pand %%mm7, %%mm1 \n\t" \
600 "pand %%mm0, %%mm3 \n\t" \
601 "pand "MANGLE(ff_M24B)", %%mm6 \n\t"
\
603 "por %%mm1, %%mm3 \n\t"\
604 "por %%mm3, %%mm6 \n\t"\
605 MOVNTQ(%%mm6, 16(dst))\
607 "add $24, "#dst" \n\t"\
609 NEXT_PIXEL_BLOCK(dstw, index, "sub "#index", "#dst" \n\t"\
610 "sub "#index", "#dst" \n\t"\
611 "sub "#index", "#dst" \n\t")
613 #if COMPILE_TEMPLATE_MMXEXT
615 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMXEXT(dst, dstw, index)
618 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
623 const int16_t **lumSrc,
int lumFilterSize,
624 const int16_t *chrFilter,
const int16_t **chrUSrc,
625 const int16_t **chrVSrc,
626 int chrFilterSize,
const int16_t **alpSrc,
627 uint8_t *dest,
int dstW,
int dstY)
635 "pxor %%mm7, %%mm7 \n\t"
636 "lea (%%"FF_REG_a
", %%"FF_REG_a
", 2), %%"FF_REG_c
"\n\t"
637 "add %4, %%"FF_REG_c
" \n\t"
639 ::
"r" (&
c->redDither),
641 "r" (dest),
"m" (dstW_reg),
"m"(uv_off)
643 :
"%"FF_REG_a,
"%"FF_REG_c,
"%"FF_REG_d,
"%"FF_REG_S
648 const int16_t **lumSrc,
int lumFilterSize,
649 const int16_t *chrFilter,
const int16_t **chrUSrc,
650 const int16_t **chrVSrc,
651 int chrFilterSize,
const int16_t **alpSrc,
652 uint8_t *dest,
int dstW,
int dstY)
660 "pxor %%mm7, %%mm7 \n\t"
661 "lea (%%"FF_REG_a
", %%"FF_REG_a
", 2), %%"FF_REG_c
" \n\t"
662 "add %4, %%"FF_REG_c
" \n\t"
664 ::
"r" (&
c->redDither),
666 "r" (dest),
"m" (dstW_reg),
"m"(uv_off)
668 :
"%"FF_REG_a,
"%"FF_REG_c,
"%"FF_REG_d,
"%"FF_REG_S
673 #define REAL_WRITEYUY2(dst, dstw, index) \
674 "packuswb %%mm3, %%mm3 \n\t"\
675 "packuswb %%mm4, %%mm4 \n\t"\
676 "packuswb %%mm7, %%mm1 \n\t"\
677 "punpcklbw %%mm4, %%mm3 \n\t"\
678 "movq %%mm1, %%mm7 \n\t"\
679 "punpcklbw %%mm3, %%mm1 \n\t"\
680 "punpckhbw %%mm3, %%mm7 \n\t"\
682 MOVNTQ(%%mm1, (dst, index, 2))\
683 MOVNTQ(%%mm7, 8(dst, index, 2))\
685 NEXT_PIXEL_BLOCK(dstw, index, )
686 #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index)
689 const int16_t **lumSrc,
int lumFilterSize,
690 const int16_t *chrFilter,
const int16_t **chrUSrc,
691 const int16_t **chrVSrc,
692 int chrFilterSize,
const int16_t **alpSrc,
693 uint8_t *dest,
int dstW,
int dstY)
701 "psraw $3, %%mm3 \n\t"
702 "psraw $3, %%mm4 \n\t"
703 "psraw $3, %%mm1 \n\t"
704 "psraw $3, %%mm7 \n\t"
710 const int16_t **lumSrc,
int lumFilterSize,
711 const int16_t *chrFilter,
const int16_t **chrUSrc,
712 const int16_t **chrVSrc,
713 int chrFilterSize,
const int16_t **alpSrc,
714 uint8_t *dest,
int dstW,
int dstY)
722 "psraw $3, %%mm3 \n\t"
723 "psraw $3, %%mm4 \n\t"
724 "psraw $3, %%mm1 \n\t"
725 "psraw $3, %%mm7 \n\t"
730 #define REAL_YSCALEYUV2RGB_UV(index, c) \
731 "xor "#index", "#index" \n\t"\
734 "movq (%2, "#index"), %%mm2 \n\t"
\
735 "movq (%3, "#index"), %%mm3 \n\t"
\
736 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
737 "movq (%2, "#index"), %%mm5 \n\t"
\
738 "movq (%3, "#index"), %%mm4 \n\t"
\
739 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
740 "psubw %%mm3, %%mm2 \n\t"
\
741 "psubw %%mm4, %%mm5 \n\t" \
742 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
743 "pmulhw %%mm0, %%mm2 \n\t"
\
744 "pmulhw %%mm0, %%mm5 \n\t" \
745 "psraw $4, %%mm3 \n\t" \
746 "psraw $4, %%mm4 \n\t" \
747 "paddw %%mm2, %%mm3 \n\t" \
748 "paddw %%mm5, %%mm4 \n\t" \
749 "psubw "U_OFFSET"("#c"), %%mm3 \n\t"
\
750 "psubw "V_OFFSET"("#c"), %%mm4 \n\t"
\
751 "movq %%mm3, %%mm2 \n\t" \
752 "movq %%mm4, %%mm5 \n\t" \
753 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
754 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
757 #define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \
758 "movq ("#b1", "#index", 2), %%mm0 \n\t"
\
759 "movq ("#b2", "#index", 2), %%mm1 \n\t"
\
760 "movq 8("#b1", "#index", 2), %%mm6 \n\t"
\
761 "movq 8("#b2", "#index", 2), %%mm7 \n\t"
\
762 "psubw %%mm1, %%mm0 \n\t" \
763 "psubw %%mm7, %%mm6 \n\t" \
764 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"
\
765 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t"
\
766 "psraw $4, %%mm1 \n\t" \
767 "psraw $4, %%mm7 \n\t" \
768 "paddw %%mm0, %%mm1 \n\t" \
769 "paddw %%mm6, %%mm7 \n\t" \
771 #define REAL_YSCALEYUV2RGB_COEFF(c) \
772 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
773 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
774 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t"
\
775 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t"
\
776 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
777 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
779 "paddw %%mm3, %%mm4 \n\t"\
780 "movq %%mm2, %%mm0 \n\t"\
781 "movq %%mm5, %%mm6 \n\t"\
782 "movq %%mm4, %%mm3 \n\t"\
783 "punpcklwd %%mm2, %%mm2 \n\t"\
784 "punpcklwd %%mm5, %%mm5 \n\t"\
785 "punpcklwd %%mm4, %%mm4 \n\t"\
786 "paddw %%mm1, %%mm2 \n\t"\
787 "paddw %%mm1, %%mm5 \n\t"\
788 "paddw %%mm1, %%mm4 \n\t"\
789 "punpckhwd %%mm0, %%mm0 \n\t"\
790 "punpckhwd %%mm6, %%mm6 \n\t"\
791 "punpckhwd %%mm3, %%mm3 \n\t"\
792 "paddw %%mm7, %%mm0 \n\t"\
793 "paddw %%mm7, %%mm6 \n\t"\
794 "paddw %%mm7, %%mm3 \n\t"\
796 "packuswb %%mm0, %%mm2 \n\t"\
797 "packuswb %%mm6, %%mm5 \n\t"\
798 "packuswb %%mm3, %%mm4 \n\t"\
800 #define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2)
802 #define YSCALEYUV2RGB(index, c) \
803 REAL_YSCALEYUV2RGB_UV(index, c) \
804 REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \
805 REAL_YSCALEYUV2RGB_COEFF(c)
811 const int16_t *ubuf[2],
const int16_t *vbuf[2],
812 const int16_t *abuf[2],
uint8_t *dest,
813 int dstW,
int yalpha,
int uvalpha,
int y)
815 const int16_t *buf0 = buf[0], *buf1 = buf[1],
816 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
819 const int16_t *abuf0 = abuf[0], *abuf1 = abuf[1];
824 "psraw $3, %%mm1 \n\t"
825 "psraw $3, %%mm7 \n\t"
826 "packuswb %%mm7, %%mm1 \n\t"
827 WRITEBGR32(%4,
DSTW_OFFSET"(%5)", %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
828 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"r" (dest),
830 "r" (abuf0),
"r" (abuf1)
834 c->u_temp=(intptr_t)abuf0;
835 c->v_temp=(intptr_t)abuf1;
838 "mov %4, %%"FF_REG_b
" \n\t"
839 "push %%"FF_REG_BP
" \n\t"
843 "mov "U_TEMP"(%5), %0 \n\t"
844 "mov "V_TEMP"(%5), %1 \n\t"
846 "psraw $3, %%mm1 \n\t"
847 "psraw $3, %%mm7 \n\t"
848 "packuswb %%mm7, %%mm1 \n\t"
851 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
852 "pop %%"FF_REG_BP
" \n\t"
854 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
861 "mov %4, %%"FF_REG_b
" \n\t"
862 "push %%"FF_REG_BP
" \n\t"
864 "pcmpeqd %%mm7, %%mm7 \n\t"
865 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
866 "pop %%"FF_REG_BP
" \n\t"
868 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
875 const int16_t *ubuf[2],
const int16_t *vbuf[2],
876 const int16_t *abuf[2],
uint8_t *dest,
877 int dstW,
int yalpha,
int uvalpha,
int y)
879 const int16_t *buf0 = buf[0], *buf1 = buf[1],
880 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
884 "mov %4, %%"FF_REG_b
" \n\t"
885 "push %%"FF_REG_BP
" \n\t"
887 "pxor %%mm7, %%mm7 \n\t"
889 "pop %%"FF_REG_BP
" \n\t"
891 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
898 const int16_t *ubuf[2],
const int16_t *vbuf[2],
899 const int16_t *abuf[2],
uint8_t *dest,
900 int dstW,
int yalpha,
int uvalpha,
int y)
902 const int16_t *buf0 = buf[0], *buf1 = buf[1],
903 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
907 "mov %4, %%"FF_REG_b
" \n\t"
908 "push %%"FF_REG_BP
" \n\t"
910 "pxor %%mm7, %%mm7 \n\t"
918 "pop %%"FF_REG_BP
" \n\t"
920 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
927 const int16_t *ubuf[2],
const int16_t *vbuf[2],
928 const int16_t *abuf[2],
uint8_t *dest,
929 int dstW,
int yalpha,
int uvalpha,
int y)
931 const int16_t *buf0 = buf[0], *buf1 = buf[1],
932 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
936 "mov %4, %%"FF_REG_b
" \n\t"
937 "push %%"FF_REG_BP
" \n\t"
939 "pxor %%mm7, %%mm7 \n\t"
947 "pop %%"FF_REG_BP
" \n\t"
949 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
955 #define REAL_YSCALEYUV2PACKED(index, c) \
956 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
957 "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\
958 "psraw $3, %%mm0 \n\t"\
959 "psraw $3, %%mm1 \n\t"\
960 "movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
961 "movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
962 "xor "#index", "#index" \n\t"\
965 "movq (%2, "#index"), %%mm2 \n\t"
\
966 "movq (%3, "#index"), %%mm3 \n\t"
\
967 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
968 "movq (%2, "#index"), %%mm5 \n\t"
\
969 "movq (%3, "#index"), %%mm4 \n\t"
\
970 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
971 "psubw %%mm3, %%mm2 \n\t"
\
972 "psubw %%mm4, %%mm5 \n\t" \
973 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
974 "pmulhw %%mm0, %%mm2 \n\t"
\
975 "pmulhw %%mm0, %%mm5 \n\t" \
976 "psraw $7, %%mm3 \n\t" \
977 "psraw $7, %%mm4 \n\t" \
978 "paddw %%mm2, %%mm3 \n\t" \
979 "paddw %%mm5, %%mm4 \n\t" \
980 "movq (%0, "#index", 2), %%mm0 \n\t"
\
981 "movq (%1, "#index", 2), %%mm1 \n\t"
\
982 "movq 8(%0, "#index", 2), %%mm6 \n\t"
\
983 "movq 8(%1, "#index", 2), %%mm7 \n\t"
\
984 "psubw %%mm1, %%mm0 \n\t" \
985 "psubw %%mm7, %%mm6 \n\t" \
986 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"
\
987 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t"
\
988 "psraw $7, %%mm1 \n\t" \
989 "psraw $7, %%mm7 \n\t" \
990 "paddw %%mm0, %%mm1 \n\t" \
991 "paddw %%mm6, %%mm7 \n\t" \
993 #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c)
996 const int16_t *ubuf[2],
const int16_t *vbuf[2],
997 const int16_t *abuf[2],
uint8_t *dest,
998 int dstW,
int yalpha,
int uvalpha,
int y)
1000 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1001 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
1005 "mov %4, %%"FF_REG_b
" \n\t"
1006 "push %%"FF_REG_BP
" \n\t"
1009 "pop %%"FF_REG_BP
" \n\t"
1011 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1016 #define REAL_YSCALEYUV2RGB1(index, c) \
1017 "xor "#index", "#index" \n\t"\
1020 "movq (%2, "#index"), %%mm3 \n\t"
\
1021 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1022 "movq (%2, "#index"), %%mm4 \n\t"
\
1023 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1024 "psraw $4, %%mm3 \n\t"
\
1025 "psraw $4, %%mm4 \n\t" \
1026 "psubw "U_OFFSET"("#c"), %%mm3 \n\t"
\
1027 "psubw "V_OFFSET"("#c"), %%mm4 \n\t"
\
1028 "movq %%mm3, %%mm2 \n\t" \
1029 "movq %%mm4, %%mm5 \n\t" \
1030 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1031 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1033 "movq (%0, "#index", 2), %%mm1 \n\t"
\
1034 "movq 8(%0, "#index", 2), %%mm7 \n\t"
\
1035 "psraw $4, %%mm1 \n\t" \
1036 "psraw $4, %%mm7 \n\t" \
1037 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1038 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1039 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t"
\
1040 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t"
\
1041 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1042 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1044 "paddw %%mm3, %%mm4 \n\t"\
1045 "movq %%mm2, %%mm0 \n\t"\
1046 "movq %%mm5, %%mm6 \n\t"\
1047 "movq %%mm4, %%mm3 \n\t"\
1048 "punpcklwd %%mm2, %%mm2 \n\t"\
1049 "punpcklwd %%mm5, %%mm5 \n\t"\
1050 "punpcklwd %%mm4, %%mm4 \n\t"\
1051 "paddw %%mm1, %%mm2 \n\t"\
1052 "paddw %%mm1, %%mm5 \n\t"\
1053 "paddw %%mm1, %%mm4 \n\t"\
1054 "punpckhwd %%mm0, %%mm0 \n\t"\
1055 "punpckhwd %%mm6, %%mm6 \n\t"\
1056 "punpckhwd %%mm3, %%mm3 \n\t"\
1057 "paddw %%mm7, %%mm0 \n\t"\
1058 "paddw %%mm7, %%mm6 \n\t"\
1059 "paddw %%mm7, %%mm3 \n\t"\
1061 "packuswb %%mm0, %%mm2 \n\t"\
1062 "packuswb %%mm6, %%mm5 \n\t"\
1063 "packuswb %%mm3, %%mm4 \n\t"\
1065 #define YSCALEYUV2RGB1(index, c) REAL_YSCALEYUV2RGB1(index, c)
1068 #define REAL_YSCALEYUV2RGB1b(index, c) \
1069 "xor "#index", "#index" \n\t"\
1072 "movq (%2, "#index"), %%mm2 \n\t"
\
1073 "movq (%3, "#index"), %%mm3 \n\t"
\
1074 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1075 "movq (%2, "#index"), %%mm5 \n\t"
\
1076 "movq (%3, "#index"), %%mm4 \n\t"
\
1077 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1078 "paddw %%mm2, %%mm3 \n\t"
\
1079 "paddw %%mm5, %%mm4 \n\t" \
1080 "psrlw $5, %%mm3 \n\t" \
1081 "psrlw $5, %%mm4 \n\t" \
1082 "psubw "U_OFFSET"("#c"), %%mm3 \n\t"
\
1083 "psubw "V_OFFSET"("#c"), %%mm4 \n\t"
\
1084 "movq %%mm3, %%mm2 \n\t" \
1085 "movq %%mm4, %%mm5 \n\t" \
1086 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
1087 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
1089 "movq (%0, "#index", 2), %%mm1 \n\t"
\
1090 "movq 8(%0, "#index", 2), %%mm7 \n\t"
\
1091 "psraw $4, %%mm1 \n\t" \
1092 "psraw $4, %%mm7 \n\t" \
1093 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
1094 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
1095 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t"
\
1096 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t"
\
1097 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
1098 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
1100 "paddw %%mm3, %%mm4 \n\t"\
1101 "movq %%mm2, %%mm0 \n\t"\
1102 "movq %%mm5, %%mm6 \n\t"\
1103 "movq %%mm4, %%mm3 \n\t"\
1104 "punpcklwd %%mm2, %%mm2 \n\t"\
1105 "punpcklwd %%mm5, %%mm5 \n\t"\
1106 "punpcklwd %%mm4, %%mm4 \n\t"\
1107 "paddw %%mm1, %%mm2 \n\t"\
1108 "paddw %%mm1, %%mm5 \n\t"\
1109 "paddw %%mm1, %%mm4 \n\t"\
1110 "punpckhwd %%mm0, %%mm0 \n\t"\
1111 "punpckhwd %%mm6, %%mm6 \n\t"\
1112 "punpckhwd %%mm3, %%mm3 \n\t"\
1113 "paddw %%mm7, %%mm0 \n\t"\
1114 "paddw %%mm7, %%mm6 \n\t"\
1115 "paddw %%mm7, %%mm3 \n\t"\
1117 "packuswb %%mm0, %%mm2 \n\t"\
1118 "packuswb %%mm6, %%mm5 \n\t"\
1119 "packuswb %%mm3, %%mm4 \n\t"\
1121 #define YSCALEYUV2RGB1b(index, c) REAL_YSCALEYUV2RGB1b(index, c)
1123 #define REAL_YSCALEYUV2RGB1_ALPHA(index) \
1124 "movq (%1, "#index", 2), %%mm7 \n\t"
\
1125 "movq 8(%1, "#index", 2), %%mm1 \n\t"
\
1126 "psraw $7, %%mm7 \n\t" \
1127 "psraw $7, %%mm1 \n\t" \
1128 "packuswb %%mm1, %%mm7 \n\t"
1129 #define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index)
1135 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1136 const int16_t *abuf0,
uint8_t *dest,
1137 int dstW,
int uvalpha,
int y)
1139 const int16_t *ubuf0 = ubuf[0];
1140 const int16_t *buf1= buf0;
1142 if (uvalpha < 2048) {
1143 const int16_t *ubuf1 = ubuf[0];
1147 "mov %4, %%"FF_REG_b
" \n\t"
1148 "push %%"FF_REG_BP
" \n\t"
1151 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1152 "pop %%"FF_REG_BP
" \n\t"
1154 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1160 "mov %4, %%"FF_REG_b
" \n\t"
1161 "push %%"FF_REG_BP
" \n\t"
1163 "pcmpeqd %%mm7, %%mm7 \n\t"
1164 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1165 "pop %%"FF_REG_BP
" \n\t"
1167 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1172 const int16_t *ubuf1 = ubuf[1];
1176 "mov %4, %%"FF_REG_b
" \n\t"
1177 "push %%"FF_REG_BP
" \n\t"
1180 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1181 "pop %%"FF_REG_BP
" \n\t"
1183 ::
"c" (buf0),
"d" (abuf0),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1189 "mov %4, %%"FF_REG_b
" \n\t"
1190 "push %%"FF_REG_BP
" \n\t"
1192 "pcmpeqd %%mm7, %%mm7 \n\t"
1193 WRITEBGR32(%%FF_REGb,
DSTW_OFFSET"(%5)", %%FF_REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
1194 "pop %%"FF_REG_BP
" \n\t"
1196 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1204 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1205 const int16_t *abuf0,
uint8_t *dest,
1206 int dstW,
int uvalpha,
int y)
1208 const int16_t *ubuf0 = ubuf[0];
1209 const int16_t *buf1= buf0;
1211 if (uvalpha < 2048) {
1212 const int16_t *ubuf1 = ubuf[0];
1215 "mov %4, %%"FF_REG_b
" \n\t"
1216 "push %%"FF_REG_BP
" \n\t"
1218 "pxor %%mm7, %%mm7 \n\t"
1220 "pop %%"FF_REG_BP
" \n\t"
1222 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1227 const int16_t *ubuf1 = ubuf[1];
1230 "mov %4, %%"FF_REG_b
" \n\t"
1231 "push %%"FF_REG_BP
" \n\t"
1233 "pxor %%mm7, %%mm7 \n\t"
1235 "pop %%"FF_REG_BP
" \n\t"
1237 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1245 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1246 const int16_t *abuf0,
uint8_t *dest,
1247 int dstW,
int uvalpha,
int y)
1249 const int16_t *ubuf0 = ubuf[0];
1250 const int16_t *buf1= buf0;
1252 if (uvalpha < 2048) {
1253 const int16_t *ubuf1 = ubuf[0];
1256 "mov %4, %%"FF_REG_b
" \n\t"
1257 "push %%"FF_REG_BP
" \n\t"
1259 "pxor %%mm7, %%mm7 \n\t"
1267 "pop %%"FF_REG_BP
" \n\t"
1269 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1274 const int16_t *ubuf1 = ubuf[1];
1277 "mov %4, %%"FF_REG_b
" \n\t"
1278 "push %%"FF_REG_BP
" \n\t"
1280 "pxor %%mm7, %%mm7 \n\t"
1288 "pop %%"FF_REG_BP
" \n\t"
1290 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1298 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1299 const int16_t *abuf0,
uint8_t *dest,
1300 int dstW,
int uvalpha,
int y)
1302 const int16_t *ubuf0 = ubuf[0];
1303 const int16_t *buf1= buf0;
1305 if (uvalpha < 2048) {
1306 const int16_t *ubuf1 = ubuf[0];
1309 "mov %4, %%"FF_REG_b
" \n\t"
1310 "push %%"FF_REG_BP
" \n\t"
1312 "pxor %%mm7, %%mm7 \n\t"
1320 "pop %%"FF_REG_BP
" \n\t"
1322 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1327 const int16_t *ubuf1 = ubuf[1];
1330 "mov %4, %%"FF_REG_b
" \n\t"
1331 "push %%"FF_REG_BP
" \n\t"
1333 "pxor %%mm7, %%mm7 \n\t"
1341 "pop %%"FF_REG_BP
" \n\t"
1343 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1350 #define REAL_YSCALEYUV2PACKED1(index, c) \
1351 "xor "#index", "#index" \n\t"\
1354 "movq (%2, "#index"), %%mm3 \n\t"
\
1355 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1356 "movq (%2, "#index"), %%mm4 \n\t"
\
1357 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1358 "psraw $7, %%mm3 \n\t" \
1359 "psraw $7, %%mm4 \n\t" \
1360 "movq (%0, "#index", 2), %%mm1 \n\t"
\
1361 "movq 8(%0, "#index", 2), %%mm7 \n\t"
\
1362 "psraw $7, %%mm1 \n\t" \
1363 "psraw $7, %%mm7 \n\t" \
1365 #define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c)
1367 #define REAL_YSCALEYUV2PACKED1b(index, c) \
1368 "xor "#index", "#index" \n\t"\
1371 "movq (%2, "#index"), %%mm2 \n\t"
\
1372 "movq (%3, "#index"), %%mm3 \n\t"
\
1373 "add "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1374 "movq (%2, "#index"), %%mm5 \n\t"
\
1375 "movq (%3, "#index"), %%mm4 \n\t"
\
1376 "sub "UV_OFF_BYTE"("#c"), "#index" \n\t" \
1377 "paddw %%mm2, %%mm3 \n\t"
\
1378 "paddw %%mm5, %%mm4 \n\t" \
1379 "psrlw $8, %%mm3 \n\t" \
1380 "psrlw $8, %%mm4 \n\t" \
1381 "movq (%0, "#index", 2), %%mm1 \n\t"
\
1382 "movq 8(%0, "#index", 2), %%mm7 \n\t"
\
1383 "psraw $7, %%mm1 \n\t" \
1384 "psraw $7, %%mm7 \n\t"
1385 #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c)
1388 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1389 const int16_t *abuf0,
uint8_t *dest,
1390 int dstW,
int uvalpha,
int y)
1392 const int16_t *ubuf0 = ubuf[0];
1393 const int16_t *buf1= buf0;
1395 if (uvalpha < 2048) {
1396 const int16_t *ubuf1 = ubuf[0];
1399 "mov %4, %%"FF_REG_b
" \n\t"
1400 "push %%"FF_REG_BP
" \n\t"
1403 "pop %%"FF_REG_BP
" \n\t"
1405 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1409 const int16_t *ubuf1 = ubuf[1];
1412 "mov %4, %%"FF_REG_b
" \n\t"
1413 "push %%"FF_REG_BP
" \n\t"
1416 "pop %%"FF_REG_BP
" \n\t"
1418 ::
"c" (buf0),
"d" (buf1),
"S" (ubuf0),
"D" (ubuf1),
"m" (dest),
1427 c->dstW >= 8 && !(
c->dstW & 1);
1429 c->use_mmx_vfilter= 0;
1434 if (use_mmxext_packed_writers) {
1435 switch (
c->dstFormat) {
1447 c->use_mmx_vfilter= 1;
1448 if (use_mmxext_packed_writers) {
1449 switch (
c->dstFormat) {
1462 if (use_mmxext_packed_writers) {
1463 switch (
c->dstFormat) {
1490 if (
c->srcBpc == 8 &&
c->dstBpc <= 14) {
1492 #if COMPILE_TEMPLATE_MMXEXT
1498 c->hyscale_fast =
NULL;
1499 c->hcscale_fast =
NULL;
1500 #if COMPILE_TEMPLATE_MMXEXT
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
#define CONFIG_SWSCALE_ALPHA
#define SWS_FULL_CHR_H_INT
#define SWS_FAST_BILINEAR
#define NAMED_CONSTRAINTS_ADD(...)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB555
#define ALP_MMX_FILTER_OFFSET
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt)
void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
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 isNBPS(enum AVPixelFormat pix_fmt)
#define WRITEBGR24(dst, dstw, index)
#define YSCALEYUV2PACKED(index, c)
#define YSCALEYUV2RGB1_ALPHA(index)
static void RENAME() yuv2rgb565_X(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2yuyv422_1(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
#define YSCALEYUV2PACKEDX
#define YSCALEYUV2PACKEDX_YA(offset, coeff, src1, src2, dst1, dst2)
static av_cold void RENAME() sws_init_swscale(SwsContext *c)
static void RENAME() yuv2bgr24_2(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
static void RENAME() yuv2rgb555_2(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
#define YSCALEYUV2RGB1(index, c)
static void RENAME() yuv2rgb565_2(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
static void RENAME() yuv2bgr24_1(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
#define YSCALEYUV2PACKED1(index, c)
static void RENAME() yuv2yuyv422_2(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
static void RENAME() yuv2rgb565_X_ar(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2rgb32_2(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
vertical bilinear scale YV12 to RGB
static void RENAME() yuv2yuyv422_X(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2rgb555_X_ar(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
#define WRITERGB16(dst, dstw, index)
static void RENAME() yuv2rgb555_1(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
#define YSCALEYUV2RGB_YA(index, c, b1, b2)
#define YSCALEYUV2RGB1b(index, c)
static void RENAME() yuv2rgb565_1(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
static void RENAME() yuv2bgr32_X(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2rgb555_X(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2yuyv422_X_ar(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
static void RENAME() yuv2rgb32_X_ar(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
#define WRITERGB15(dst, dstw, index)
#define YSCALEYUV2RGB(index, c)
#define WRITEYUY2(dst, dstw, index)
static void RENAME() yuv2rgb32_X(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int dstY)
#define YSCALEYUV2PACKEDX_END
#define YSCALEYUV2PACKEDX_ACCURATE
static void RENAME() yuv2rgb32_1(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
YV12 to RGB without scaling or interpolating.
#define YSCALEYUV2PACKED1b(index, c)
#define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
#define YSCALEYUV2PACKEDX_ACCURATE_YA(offset)