33 #if COMPILE_TEMPLATE_MMXEXT
34 #define MOVNTQ "movntq"
35 #define SFENCE "sfence"
38 #define SFENCE " # nop"
46 #define YUV2RGB_LOOP(depth) \
47 h_size = (c->dstW + 7) & ~7; \
48 if (h_size * depth > FFABS(dstStride[0])) \
51 if (c->srcFormat == AV_PIX_FMT_YUV422P) { \
56 __asm__ volatile ("pxor %mm4, %mm4\n\t"); \
57 for (y = 0; y < srcSliceH; y++) { \
58 uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \
59 const uint8_t *py = src[0] + y * srcStride[0]; \
60 const uint8_t *pu = src[1] + (y >> 1) * srcStride[1]; \
61 const uint8_t *pv = src[2] + (y >> 1) * srcStride[2]; \
62 x86_reg index = -h_size / 2; \
64 #define YUV2RGB_INITIAL_LOAD \
66 "movq (%5, %0, 2), %%mm6\n\t" \
67 "movd (%2, %0), %%mm0\n\t" \
68 "movd (%3, %0), %%mm1\n\t" \
89 "movq %%mm6, %%mm7\n\t" \
90 "punpcklbw %%mm4, %%mm0\n\t" \
91 "punpcklbw %%mm4, %%mm1\n\t" \
92 "pand "MANGLE(mmx_00ffw)", %%mm6\n\t" \
93 "psrlw $8, %%mm7\n\t" \
94 "psllw $3, %%mm0\n\t" \
95 "psllw $3, %%mm1\n\t" \
96 "psllw $3, %%mm6\n\t" \
97 "psllw $3, %%mm7\n\t" \
98 "psubsw "U_OFFSET"(%4), %%mm0\n\t" \
99 "psubsw "V_OFFSET"(%4), %%mm1\n\t" \
100 "psubw "Y_OFFSET"(%4), %%mm6\n\t" \
101 "psubw "Y_OFFSET"(%4), %%mm7\n\t" \
104 "movq %%mm0, %%mm2\n\t" \
105 "movq %%mm1, %%mm3\n\t" \
106 "pmulhw "UG_COEFF"(%4), %%mm2\n\t" \
107 "pmulhw "VG_COEFF"(%4), %%mm3\n\t" \
108 "pmulhw "Y_COEFF" (%4), %%mm6\n\t" \
109 "pmulhw "Y_COEFF" (%4), %%mm7\n\t" \
110 "pmulhw "UB_COEFF"(%4), %%mm0\n\t" \
111 "pmulhw "VR_COEFF"(%4), %%mm1\n\t" \
112 "paddsw %%mm3, %%mm2\n\t" \
117 "movq %%mm7, %%mm3\n\t" \
118 "movq %%mm7, %%mm5\n\t" \
119 "paddsw %%mm0, %%mm3\n\t" \
120 "paddsw %%mm1, %%mm5\n\t" \
121 "paddsw %%mm2, %%mm7\n\t" \
122 "paddsw %%mm6, %%mm0\n\t" \
123 "paddsw %%mm6, %%mm1\n\t" \
124 "paddsw %%mm6, %%mm2\n\t" \
126 #define RGB_PACK_INTERLEAVE \
128 "packuswb %%mm1, %%mm0\n\t" \
129 "packuswb %%mm5, %%mm3\n\t" \
130 "packuswb %%mm2, %%mm2\n\t" \
131 "movq %%mm0, %%mm1\n\n" \
132 "packuswb %%mm7, %%mm7\n\t" \
133 "punpcklbw %%mm3, %%mm0\n\t" \
134 "punpckhbw %%mm3, %%mm1\n\t" \
135 "punpcklbw %%mm7, %%mm2\n\t" \
137 #define YUV2RGB_ENDLOOP(depth) \
138 "movq 8 (%5, %0, 2), %%mm6\n\t" \
139 "movd 4 (%3, %0), %%mm1\n\t" \
140 "movd 4 (%2, %0), %%mm0\n\t" \
141 "add $"AV_STRINGIFY(depth * 8)", %1\n\t" \
145 #define YUV2RGB_OPERANDS \
146 : "+r" (index), "+r" (image) \
147 : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
152 #define YUV2RGB_OPERANDS_ALPHA \
153 : "+r" (index), "+r" (image) \
154 : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
155 "r" (py - 2*index), "r" (pa - 2*index) \
159 #define YUV2RGB_ENDFUNC \
160 __asm__ volatile (SFENCE"\n\t" \
167 #define RGB_PACK16(gmask, is15) \
168 "pand "MANGLE(mmx_redmask)", %%mm0\n\t" \
169 "pand "MANGLE(mmx_redmask)", %%mm1\n\t" \
170 "movq %%mm2, %%mm3\n\t" \
171 "psllw $"AV_STRINGIFY(3-is15)", %%mm2\n\t" \
172 "psrlw $"AV_STRINGIFY(5+is15)", %%mm3\n\t" \
173 "psrlw $3, %%mm0\n\t" \
174 IF##is15("psrlw $1, %%mm1\n\t") \
175 "pand "MANGLE(pb_e0)", %%mm2\n\t" \
176 "pand "MANGLE(gmask)", %%mm3\n\t" \
177 "por %%mm2, %%mm0\n\t" \
178 "por %%mm3, %%mm1\n\t" \
179 "movq %%mm0, %%mm2\n\t" \
180 "punpcklbw %%mm1, %%mm0\n\t" \
181 "punpckhbw %%mm1, %%mm2\n\t" \
182 MOVNTQ " %%mm0, (%1)\n\t" \
183 MOVNTQ " %%mm2, 8(%1)\n\t" \
186 "paddusb "BLUE_DITHER"(%4), %%mm0\n\t" \
187 "paddusb "GREEN_DITHER"(%4), %%mm2\n\t" \
188 "paddusb "RED_DITHER"(%4), %%mm1\n\t" \
190 #if !COMPILE_TEMPLATE_MMXEXT
193 int srcSliceY,
int srcSliceH,
194 uint8_t *dst[],
int dstStride[])
221 int srcSliceY,
int srcSliceH,
222 uint8_t *dst[],
int dstStride[])
248 #define RGB_PACK24(blue, red)\
249 "packuswb %%mm3, %%mm0 \n" \
250 "packuswb %%mm5, %%mm1 \n" \
251 "packuswb %%mm7, %%mm2 \n" \
252 "movq %%mm"red", %%mm3 \n"\
253 "movq %%mm"blue", %%mm6 \n"\
254 "psrlq $32, %%mm"red" \n" \
255 "punpcklbw %%mm2, %%mm3 \n" \
256 "punpcklbw %%mm"red", %%mm6 \n" \
257 "movq %%mm3, %%mm5 \n"\
258 "punpckhbw %%mm"blue", %%mm2 \n" \
259 "punpcklwd %%mm6, %%mm3 \n" \
260 "punpckhwd %%mm6, %%mm5 \n" \
263 #if COMPILE_TEMPLATE_MMXEXT
270 #define RGB_PACK24_B\
271 "pshufw $0xc6, %%mm2, %%mm1 \n"\
272 "pshufw $0x84, %%mm3, %%mm6 \n"\
273 "pshufw $0x38, %%mm5, %%mm7 \n"\
274 "pand "MANGLE(mask1101)", %%mm6 \n" \
275 "movq %%mm1, %%mm0 \n"\
276 "pand "MANGLE(mask0110)", %%mm7 \n" \
277 "movq %%mm1, %%mm2 \n"\
278 "pand "MANGLE(mask0100)", %%mm1 \n" \
279 "psrlq $48, %%mm3 \n" \
280 "pand "MANGLE(mask0010)", %%mm0 \n" \
281 "psllq $32, %%mm5 \n" \
282 "pand "MANGLE(mask1001)", %%mm2 \n" \
283 "por %%mm3, %%mm1 \n"\
284 "por %%mm6, %%mm0 \n"\
285 "por %%mm5, %%mm1 \n"\
286 "por %%mm7, %%mm2 \n"\
287 MOVNTQ" %%mm0, (%1) \n"\
288 MOVNTQ" %%mm1, 8(%1) \n"\
289 MOVNTQ" %%mm2, 16(%1) \n"\
293 #define RGB_PACK24_B\
294 "movd %%mm3, (%1) \n" \
295 "movd %%mm2, 4(%1) \n" \
296 "psrlq $32, %%mm3 \n"\
297 "psrlq $16, %%mm2 \n"\
298 "movd %%mm3, 6(%1) \n" \
299 "movd %%mm2, 10(%1) \n" \
300 "psrlq $16, %%mm2 \n"\
301 "movd %%mm5, 12(%1) \n" \
302 "movd %%mm2, 16(%1) \n" \
303 "psrlq $32, %%mm5 \n"\
304 "movd %%mm2, 20(%1) \n" \
305 "movd %%mm5, 18(%1) \n" \
311 int srcSliceY,
int srcSliceH,
312 uint8_t *dst[],
int dstStride[])
329 int srcSliceY,
int srcSliceH,
330 uint8_t *dst[],
int dstStride[])
346 #define SET_EMPTY_ALPHA \
347 "pcmpeqd %%mm"REG_ALPHA", %%mm"REG_ALPHA"\n\t" \
350 "movq (%6, %0, 2), %%mm"REG_ALPHA"\n\t" \
352 #define RGB_PACK32(red, green, blue, alpha) \
353 "movq %%mm"blue", %%mm5\n\t" \
354 "movq %%mm"red", %%mm6\n\t" \
355 "punpckhbw %%mm"green", %%mm5\n\t" \
356 "punpcklbw %%mm"green", %%mm"blue"\n\t" \
357 "punpckhbw %%mm"alpha", %%mm6\n\t" \
358 "punpcklbw %%mm"alpha", %%mm"red"\n\t" \
359 "movq %%mm"blue", %%mm"green"\n\t" \
360 "movq %%mm5, %%mm"alpha"\n\t" \
361 "punpcklwd %%mm"red", %%mm"blue"\n\t" \
362 "punpckhwd %%mm"red", %%mm"green"\n\t" \
363 "punpcklwd %%mm6, %%mm5\n\t" \
364 "punpckhwd %%mm6, %%mm"alpha"\n\t" \
365 MOVNTQ " %%mm"blue", 0(%1)\n\t" \
366 MOVNTQ " %%mm"green", 8(%1)\n\t" \
367 MOVNTQ " %%mm5, 16(%1)\n\t" \
368 MOVNTQ " %%mm"alpha", 24(%1)\n\t" \
370 #if !COMPILE_TEMPLATE_MMXEXT
373 int srcSliceY,
int srcSliceH,
374 uint8_t *dst[],
int dstStride[])
391 #if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
394 int srcSliceY,
int srcSliceH,
395 uint8_t *dst[],
int dstStride[])
401 const
uint8_t *pa = src[3] + y * srcStride[3];
416 int srcSliceY,
int srcSliceH,
417 uint8_t *dst[],
int dstStride[])
434 #if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
437 int srcSliceY,
int srcSliceH,
438 uint8_t *dst[],
int dstStride[])
444 const
uint8_t *pa = src[3] + y * srcStride[3];
const uint64_t ff_dither8[2]
#define YUV2RGB_INITIAL_LOAD
#define DECLARE_ASM_CONST(n, t, v)
static int RENAME() yuv420_rgb24(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
const uint64_t ff_dither4[2]
static int RENAME() yuv420_bgr24(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int RENAME() yuv420_rgb15(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define RGB_PACK32(red, green, blue, alpha)
static int RENAME() yuv420_rgb16(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define YUV2RGB_ENDLOOP(depth)
static int RENAME() yuv420_bgr32(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define YUV2RGB_LOOP(depth)
#define RGB_PACK16(gmask, is15)
static int RENAME() yuv420_rgb32(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define YUV2RGB_OPERANDS_ALPHA
#define RGB_PACK_INTERLEAVE
#define RGB_PACK24(blue, red)