35 0x0200020002000200LL,};
39 0x0004000400040004LL,};
56 #if HAVE_MMXEXT_INLINE
58 #undef COMPILE_TEMPLATE_MMXEXT
59 #define COMPILE_TEMPLATE_MMXEXT 1
60 #define RENAME(a) a ## _mmxext
66 const int dstH=
c->dstH;
69 SwsPlane *lumPlane = &
c->slice[
c->numSlice-2].plane[0];
70 SwsPlane *chrUPlane = &
c->slice[
c->numSlice-2].plane[1];
71 SwsPlane *alpPlane = &
c->slice[
c->numSlice-2].plane[3];
73 int hasAlpha =
c->needAlpha;
74 int32_t *vLumFilterPos=
c->vLumFilterPos;
75 int32_t *vChrFilterPos=
c->vChrFilterPos;
76 int16_t *vLumFilter=
c->vLumFilter;
77 int16_t *vChrFilter=
c->vChrFilter;
78 int32_t *lumMmxFilter=
c->lumMmxFilter;
79 int32_t *chrMmxFilter=
c->chrMmxFilter;
81 const int vLumFilterSize=
c->vLumFilterSize;
82 const int vChrFilterSize=
c->vChrFilterSize;
83 const int chrDstY= dstY>>
c->chrDstVSubSample;
84 const int firstLumSrcY= vLumFilterPos[dstY];
85 const int firstChrSrcY= vChrFilterPos[chrDstY];
93 if (dstY < dstH - 2) {
94 const int16_t **lumSrcPtr = (
const int16_t **)(
void*) lumPlane->
line + firstLumSrcY - lumPlane->
sliceY;
95 const int16_t **chrUSrcPtr = (
const int16_t **)(
void*) chrUPlane->
line + firstChrSrcY - chrUPlane->
sliceY;
96 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (
const int16_t **)(
void*) alpPlane->
line + firstLumSrcY - alpPlane->
sliceY :
NULL;
99 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize >
c->srcH) {
100 const int16_t **tmpY = (
const int16_t **) lumPlane->
tmp;
102 int neg = -firstLumSrcY,
i, end =
FFMIN(
c->srcH - firstLumSrcY, vLumFilterSize);
103 for (
i = 0;
i < neg;
i++)
104 tmpY[
i] = lumSrcPtr[neg];
105 for ( ;
i < end;
i++)
106 tmpY[
i] = lumSrcPtr[
i];
107 for ( ;
i < vLumFilterSize;
i++)
112 const int16_t **tmpA = (
const int16_t **) alpPlane->
tmp;
114 tmpA[
i] = alpSrcPtr[neg];
115 for ( ;
i < end;
i++)
116 tmpA[
i] = alpSrcPtr[
i];
117 for ( ;
i < vLumFilterSize;
i++)
118 tmpA[
i] = tmpA[
i - 1];
122 if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize >
c->chrSrcH) {
123 const int16_t **tmpU = (
const int16_t **) chrUPlane->
tmp;
124 int neg = -firstChrSrcY,
i, end =
FFMIN(
c->chrSrcH - firstChrSrcY, vChrFilterSize);
125 for (
i = 0;
i < neg;
i++) {
126 tmpU[
i] = chrUSrcPtr[neg];
128 for ( ;
i < end;
i++) {
129 tmpU[
i] = chrUSrcPtr[
i];
131 for ( ;
i < vChrFilterSize;
i++) {
132 tmpU[
i] = tmpU[
i - 1];
139 for (
i=0;
i<vLumFilterSize;
i+=2) {
140 *(
const void**)&lumMmxFilter[
s*
i ]= lumSrcPtr[
i ];
141 *(
const void**)&lumMmxFilter[
s*
i+
APCK_PTR2/4 ]= lumSrcPtr[
i+(vLumFilterSize>1)];
143 lumMmxFilter[
s*
i+
APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize +
i ]
144 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize +
i + 1] * (1 << 16) : 0);
145 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
146 *(
const void**)&alpMmxFilter[
s*
i ]= alpSrcPtr[
i ];
147 *(
const void**)&alpMmxFilter[
s*
i+
APCK_PTR2/4 ]= alpSrcPtr[
i+(vLumFilterSize>1)];
152 for (
i=0;
i<vChrFilterSize;
i+=2) {
153 *(
const void**)&chrMmxFilter[
s*
i ]= chrUSrcPtr[
i ];
154 *(
const void**)&chrMmxFilter[
s*
i+
APCK_PTR2/4 ]= chrUSrcPtr[
i+(vChrFilterSize>1)];
156 chrMmxFilter[
s*
i+
APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize +
i ]
157 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize +
i + 1] * (1 << 16) : 0);
160 for (
i=0;
i<vLumFilterSize;
i++) {
161 *(
const void**)&lumMmxFilter[4*
i+0]= lumSrcPtr[
i];
164 ((uint16_t)vLumFilter[dstY*vLumFilterSize +
i])*0x10001
U;
165 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
166 *(
const void**)&alpMmxFilter[4*
i+0]= alpSrcPtr[
i];
168 alpMmxFilter[4*
i+3]= lumMmxFilter[4*
i+2];
171 for (
i=0;
i<vChrFilterSize;
i++) {
172 *(
const void**)&chrMmxFilter[4*
i+0]= chrUSrcPtr[
i];
175 ((uint16_t)vChrFilter[chrDstY*vChrFilterSize +
i])*0x10001
U;
182 #define YUV2YUVX_FUNC_MMX(opt, step) \
183 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
184 uint8_t *dest, int dstW, \
185 const uint8_t *dither, int offset); \
186 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
187 const int16_t **src, uint8_t *dest, int dstW, \
188 const uint8_t *dither, int offset) \
191 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
195 #define YUV2YUVX_FUNC(opt, step) \
196 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
197 uint8_t *dest, int dstW, \
198 const uint8_t *dither, int offset); \
199 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
200 const int16_t **src, uint8_t *dest, int dstW, \
201 const uint8_t *dither, int offset) \
203 int remainder = (dstW % step); \
204 int pixelsProcessed = dstW - remainder; \
205 if(((uintptr_t)dest) & 15){ \
206 yuv2yuvX_mmxext(filter, filterSize, src, dest, dstW, dither, offset); \
209 if(pixelsProcessed > 0) \
210 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
212 ff_yuv2yuvX_mmxext(filter, filterSize - 1, pixelsProcessed, dest - offset, pixelsProcessed + remainder + offset, dither, offset); \
217 #if HAVE_MMXEXT_EXTERNAL
220 #if HAVE_SSE3_EXTERNAL
223 #if HAVE_AVX2_EXTERNAL
227 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
228 void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
229 SwsInternal *c, int16_t *data, \
230 int dstW, const uint8_t *src, \
231 const int16_t *filter, \
232 const int32_t *filterPos, int filterSize)
234 #define SCALE_FUNCS(filter_n, opt) \
235 SCALE_FUNC(filter_n, 8, 15, opt); \
236 SCALE_FUNC(filter_n, 9, 15, opt); \
237 SCALE_FUNC(filter_n, 10, 15, opt); \
238 SCALE_FUNC(filter_n, 12, 15, opt); \
239 SCALE_FUNC(filter_n, 14, 15, opt); \
240 SCALE_FUNC(filter_n, 16, 15, opt); \
241 SCALE_FUNC(filter_n, 8, 19, opt); \
242 SCALE_FUNC(filter_n, 9, 19, opt); \
243 SCALE_FUNC(filter_n, 10, 19, opt); \
244 SCALE_FUNC(filter_n, 12, 19, opt); \
245 SCALE_FUNC(filter_n, 14, 19, opt); \
246 SCALE_FUNC(filter_n, 16, 19, opt)
248 #define SCALE_FUNCS_MMX(opt) \
249 SCALE_FUNCS(4, opt); \
250 SCALE_FUNCS(8, opt); \
253 #define SCALE_FUNCS_SSE(opt) \
254 SCALE_FUNCS(4, opt); \
255 SCALE_FUNCS(8, opt); \
256 SCALE_FUNCS(X4, opt); \
266 #define VSCALEX_FUNC(size, opt) \
267 void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
268 const int16_t **src, uint8_t *dest, int dstW, \
269 const uint8_t *dither, int offset)
270 #define VSCALEX_FUNCS(opt) \
271 VSCALEX_FUNC(8, opt); \
272 VSCALEX_FUNC(9, opt); \
273 VSCALEX_FUNC(10, opt)
281 #define VSCALE_FUNC(size, opt) \
282 void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
283 const uint8_t *dither, int offset)
284 #define VSCALE_FUNCS(opt1, opt2) \
285 VSCALE_FUNC(8, opt1); \
286 VSCALE_FUNC(9, opt2); \
287 VSCALE_FUNC(10, opt2); \
288 VSCALE_FUNC(16, opt1)
294 #define INPUT_Y_FUNC(fmt, opt) \
295 void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
296 const uint8_t *unused1, const uint8_t *unused2, \
297 int w, uint32_t *unused, void *opq)
298 #define INPUT_UV_FUNC(fmt, opt) \
299 void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
300 const uint8_t *unused0, \
301 const uint8_t *src1, \
302 const uint8_t *src2, \
303 int w, uint32_t *unused, void *opq)
304 #define INPUT_FUNC(fmt, opt) \
305 INPUT_Y_FUNC(fmt, opt); \
306 INPUT_UV_FUNC(fmt, opt)
307 #define INPUT_FUNCS(opt) \
308 INPUT_FUNC(uyvy, opt); \
309 INPUT_FUNC(yuyv, opt); \
310 INPUT_UV_FUNC(nv12, opt); \
311 INPUT_UV_FUNC(nv21, opt); \
312 INPUT_FUNC(rgba, opt); \
313 INPUT_FUNC(bgra, opt); \
314 INPUT_FUNC(argb, opt); \
315 INPUT_FUNC(abgr, opt); \
316 INPUT_FUNC(rgb24, opt); \
317 INPUT_FUNC(bgr24, opt)
330 #define YUV2NV_DECL(fmt, opt) \
331 void ff_yuv2 ## fmt ## cX_ ## opt(enum AVPixelFormat format, const uint8_t *dither, \
332 const int16_t *filter, int filterSize, \
333 const int16_t **u, const int16_t **v, \
334 uint8_t *dst, int dstWidth)
336 YUV2NV_DECL(nv12, avx2);
337 YUV2NV_DECL(nv21, avx2);
339 #define YUV2GBRP_FN_DECL(fmt, opt) \
340 void ff_yuv2##fmt##_full_X_ ##opt(SwsInternal *c, const int16_t *lumFilter, \
341 const int16_t **lumSrcx, int lumFilterSize, \
342 const int16_t *chrFilter, const int16_t **chrUSrcx, \
343 const int16_t **chrVSrcx, int chrFilterSize, \
344 const int16_t **alpSrcx, uint8_t **dest, \
347 #define YUV2GBRP_DECL(opt) \
348 YUV2GBRP_FN_DECL(gbrp, opt); \
349 YUV2GBRP_FN_DECL(gbrap, opt); \
350 YUV2GBRP_FN_DECL(gbrp9le, opt); \
351 YUV2GBRP_FN_DECL(gbrp10le, opt); \
352 YUV2GBRP_FN_DECL(gbrap10le, opt); \
353 YUV2GBRP_FN_DECL(gbrp12le, opt); \
354 YUV2GBRP_FN_DECL(gbrap12le, opt); \
355 YUV2GBRP_FN_DECL(gbrp14le, opt); \
356 YUV2GBRP_FN_DECL(gbrp16le, opt); \
357 YUV2GBRP_FN_DECL(gbrap16le, opt); \
358 YUV2GBRP_FN_DECL(gbrpf32le, opt); \
359 YUV2GBRP_FN_DECL(gbrapf32le, opt); \
360 YUV2GBRP_FN_DECL(gbrp9be, opt); \
361 YUV2GBRP_FN_DECL(gbrp10be, opt); \
362 YUV2GBRP_FN_DECL(gbrap10be, opt); \
363 YUV2GBRP_FN_DECL(gbrp12be, opt); \
364 YUV2GBRP_FN_DECL(gbrap12be, opt); \
365 YUV2GBRP_FN_DECL(gbrp14be, opt); \
366 YUV2GBRP_FN_DECL(gbrp16be, opt); \
367 YUV2GBRP_FN_DECL(gbrap16be, opt); \
368 YUV2GBRP_FN_DECL(gbrpf32be, opt); \
369 YUV2GBRP_FN_DECL(gbrapf32be, opt)
375 #define INPUT_PLANAR_RGB_Y_FN_DECL(fmt, opt) \
376 void ff_planar_##fmt##_to_y_##opt(uint8_t *dst, \
377 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
380 #define INPUT_PLANAR_RGB_UV_FN_DECL(fmt, opt) \
381 void ff_planar_##fmt##_to_uv_##opt(uint8_t *dstU, uint8_t *dstV, \
382 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
385 #define INPUT_PLANAR_RGB_A_FN_DECL(fmt, opt) \
386 void ff_planar_##fmt##_to_a_##opt(uint8_t *dst, \
387 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
391 #define INPUT_PLANAR_RGBXX_A_DECL(fmt, opt) \
392 INPUT_PLANAR_RGB_A_FN_DECL(fmt##le, opt); \
393 INPUT_PLANAR_RGB_A_FN_DECL(fmt##be, opt)
395 #define INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt) \
396 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##le, opt); \
397 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##be, opt)
399 #define INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt) \
400 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##le, opt); \
401 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##be, opt)
403 #define INPUT_PLANAR_RGBXX_YUVA_DECL(fmt, opt) \
404 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
405 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
406 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
408 #define INPUT_PLANAR_RGBXX_YUV_DECL(fmt, opt) \
409 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
410 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt)
412 #define INPUT_PLANAR_RGBXX_UVA_DECL(fmt, opt) \
413 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
414 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
416 #define INPUT_PLANAR_RGB_A_ALL_DECL(opt) \
417 INPUT_PLANAR_RGB_A_FN_DECL(rgb, opt); \
418 INPUT_PLANAR_RGBXX_A_DECL(rgb10, opt); \
419 INPUT_PLANAR_RGBXX_A_DECL(rgb12, opt); \
420 INPUT_PLANAR_RGBXX_A_DECL(rgb16, opt); \
421 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, opt)
423 #define INPUT_PLANAR_RGB_Y_ALL_DECL(opt) \
424 INPUT_PLANAR_RGB_Y_FN_DECL(rgb, opt); \
425 INPUT_PLANAR_RGBXX_Y_DECL(rgb9, opt); \
426 INPUT_PLANAR_RGBXX_Y_DECL(rgb10, opt); \
427 INPUT_PLANAR_RGBXX_Y_DECL(rgb12, opt); \
428 INPUT_PLANAR_RGBXX_Y_DECL(rgb14, opt); \
429 INPUT_PLANAR_RGBXX_Y_DECL(rgb16, opt); \
430 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, opt)
432 #define INPUT_PLANAR_RGB_UV_ALL_DECL(opt) \
433 INPUT_PLANAR_RGB_UV_FN_DECL(rgb, opt); \
434 INPUT_PLANAR_RGBXX_UV_DECL(rgb9, opt); \
435 INPUT_PLANAR_RGBXX_UV_DECL(rgb10, opt); \
436 INPUT_PLANAR_RGBXX_UV_DECL(rgb12, opt); \
437 INPUT_PLANAR_RGBXX_UV_DECL(rgb14, opt); \
438 INPUT_PLANAR_RGBXX_UV_DECL(rgb16, opt); \
439 INPUT_PLANAR_RGBXX_UV_DECL(rgbf32, opt)
441 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, sse2);
442 INPUT_PLANAR_RGB_UV_ALL_DECL(sse2);
443 INPUT_PLANAR_RGB_A_ALL_DECL(sse2);
445 INPUT_PLANAR_RGB_Y_ALL_DECL(sse4);
446 INPUT_PLANAR_RGB_UV_ALL_DECL(sse4);
447 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, sse4);
449 INPUT_PLANAR_RGB_Y_ALL_DECL(avx2);
450 INPUT_PLANAR_RGB_UV_ALL_DECL(avx2);
451 INPUT_PLANAR_RGB_A_ALL_DECL(avx2);
454 #define RANGE_CONVERT_FUNCS(opt) do { \
455 if (c->dstBpc <= 14) { \
457 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \
458 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \
460 c->lumConvertRange = ff_lumRangeToJpeg_ ##opt; \
461 c->chrConvertRange = ff_chrRangeToJpeg_ ##opt; \
466 #define RANGE_CONVERT_FUNCS_DECL(opt) \
467 void ff_lumRangeFromJpeg_ ##opt(int16_t *dst, int width); \
468 void ff_chrRangeFromJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
469 void ff_lumRangeToJpeg_ ##opt(int16_t *dst, int width); \
470 void ff_chrRangeToJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
489 #if HAVE_MMXEXT_INLINE
491 sws_init_swscale_mmxext(
c);
494 #if HAVE_MMXEXT_EXTERNAL
496 c->yuv2planeX = yuv2yuvX_mmxext;
498 #if HAVE_SSE3_EXTERNAL
500 c->yuv2planeX = yuv2yuvX_sse3;
502 #if HAVE_AVX2_EXTERNAL
504 c->yuv2planeX = yuv2yuvX_avx2;
507 #if ARCH_X86_32 && !HAVE_ALIGNED_STACK
511 if (
c->dstBpc == 8 && !
c->use_mmx_vfilter)
512 c->yuv2planeX = ff_yuv2planeX_8_mmxext;
516 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
517 if (c->srcBpc == 8) { \
518 hscalefn = c->dstBpc <= 14 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
519 ff_hscale8to19_ ## filtersize ## _ ## opt1; \
520 } else if (c->srcBpc == 9) { \
521 hscalefn = c->dstBpc <= 14 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
522 ff_hscale9to19_ ## filtersize ## _ ## opt1; \
523 } else if (c->srcBpc == 10) { \
524 hscalefn = c->dstBpc <= 14 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
525 ff_hscale10to19_ ## filtersize ## _ ## opt1; \
526 } else if (c->srcBpc == 12) { \
527 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
528 ff_hscale12to19_ ## filtersize ## _ ## opt1; \
529 } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \
530 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
531 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
533 av_assert0(c->srcBpc == 16);\
534 hscalefn = c->dstBpc <= 14 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
535 ff_hscale16to19_ ## filtersize ## _ ## opt1; \
538 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
540 case 16: do_16_case; break; \
541 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
542 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
543 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
545 #define ASSIGN_VSCALE_FUNC(vscalefn, opt) \
547 case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
548 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2plane1_10_ ## opt; break; \
549 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
550 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \
551 default: av_assert0(c->dstBpc>8); \
553 #define case_rgb(x, X, opt) \
554 case AV_PIX_FMT_ ## X: \
555 c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
556 if (!c->chrSrcHSubSample) \
557 c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
559 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
560 switch (filtersize) { \
561 case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
562 case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
563 default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
564 else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
571 HAVE_ALIGNED_STACK || ARCH_X86_64);
575 switch (
c->srcFormat) {
577 c->lumToYV12 = ff_yuyvToY_sse2;
579 c->alpToYV12 = ff_uyvyToY_sse2;
582 c->lumToYV12 = ff_yuyvToY_sse2;
583 c->chrToYV12 = ff_yuyvToUV_sse2;
586 c->lumToYV12 = ff_uyvyToY_sse2;
587 c->chrToYV12 = ff_uyvyToUV_sse2;
590 c->chrToYV12 = ff_nv12ToUV_sse2;
593 c->chrToYV12 = ff_nv21ToUV_sse2;
608 switch (
c->srcFormat) {
620 if (!
isBE(
c->dstFormat))
c->yuv2planeX = ff_yuv2planeX_16_sse4,
621 HAVE_ALIGNED_STACK || ARCH_X86_64);
623 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
628 HAVE_ALIGNED_STACK || ARCH_X86_64);
632 switch (
c->srcFormat) {
634 c->chrToYV12 = ff_yuyvToUV_avx;
637 c->chrToYV12 = ff_uyvyToUV_avx;
640 c->chrToYV12 = ff_nv12ToUV_avx;
643 c->chrToYV12 = ff_nv21ToUV_avx;
657 #define ASSIGN_AVX2_SCALE_FUNC(hscalefn, filtersize) \
658 switch (filtersize) { \
659 case 4: hscalefn = ff_hscale8to15_4_avx2; break; \
660 default: hscalefn = ff_hscale8to15_X4_avx2; break; \
665 if ((
c->srcBpc == 8) && (
c->dstBpc <= 14)) {
666 ASSIGN_AVX2_SCALE_FUNC(
c->hcScale,
c->hChrFilterSize);
667 ASSIGN_AVX2_SCALE_FUNC(
c->hyScale,
c->hLumFilterSize);
673 switch (
c->srcFormat) {
681 switch (
c->dstFormat) {
684 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;
688 c->yuv2nv12cX = ff_yuv2nv21cX_avx2;
696 #define INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(fmt, name, opt) \
698 c->readAlpPlanar = ff_planar_##name##_to_a_##opt;
700 #define INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
703 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
704 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
707 #define INPUT_PLANER_RGB_YUV_FUNC_CASE(fmt, name, opt) \
709 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
710 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
713 #define INPUT_PLANER_RGB_UV_FUNC_CASE(fmt, name, opt) \
715 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
718 #define INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
719 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
720 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
721 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
722 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
724 #define INPUT_PLANER_RGBAXX_UVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
725 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
726 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
727 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
728 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
730 #define INPUT_PLANER_RGBAXX_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
731 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##LE, rgba_fmt##LE, name##le, opt) \
732 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##BE, rgba_fmt##BE, name##be, opt)
734 #define INPUT_PLANER_RGBXX_YUV_FUNC_CASE(rgb_fmt, name, opt) \
735 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
736 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
738 #define INPUT_PLANER_RGBXX_UV_FUNC_CASE(rgb_fmt, name, opt) \
739 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
740 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
742 #define INPUT_PLANER_RGB_YUVA_ALL_CASES(opt) \
743 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, opt) \
744 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, opt) \
745 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, opt) \
746 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, rgb10, opt) \
747 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, rgb12, opt) \
748 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP14, rgb14, opt) \
749 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, rgb16, opt) \
750 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, rgbf32, opt)
754 switch (
c->srcFormat) {
769 switch (
c->srcFormat) {
784 switch (
c->srcFormat) {
785 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)
797 #define YUV2ANYX_FUNC_CASE(fmt, name, opt) \
799 c->yuv2anyX = ff_yuv2##name##_full_X_##opt; \
802 #define YUV2ANYX_GBRAP_CASES(opt) \
803 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP, gbrp, opt) \
804 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP, gbrap, opt) \
805 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9LE, gbrp9le, opt) \
806 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10LE, gbrp10le, opt) \
807 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10LE, gbrap10le, opt) \
808 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12LE, gbrp12le, opt) \
809 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12LE, gbrap12le, opt) \
810 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14LE, gbrp14le, opt) \
811 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16LE, gbrp16le, opt) \
812 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16LE, gbrap16le, opt) \
813 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32LE, gbrpf32le, opt) \
814 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32LE, gbrapf32le, opt) \
815 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9BE, gbrp9be, opt) \
816 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10BE, gbrp10be, opt) \
817 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10BE, gbrap10be, opt) \
818 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12BE, gbrp12be, opt) \
819 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12BE, gbrap12be, opt) \
820 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14BE, gbrp14be, opt) \
821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16BE, gbrp16be, opt) \
822 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16BE, gbrap16be, opt) \
823 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32BE, gbrpf32be, opt) \
824 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)
827 switch (
c->dstFormat) {
828 YUV2ANYX_GBRAP_CASES(sse2)
835 switch (
c->dstFormat) {
836 YUV2ANYX_GBRAP_CASES(sse4)
843 switch (
c->dstFormat) {
844 YUV2ANYX_GBRAP_CASES(avx2)