Go to the documentation of this file.
35 0x0200020002000200LL,};
39 0x0004000400040004LL,};
58 #if HAVE_MMXEXT_INLINE
60 #undef COMPILE_TEMPLATE_MMXEXT
61 #define COMPILE_TEMPLATE_MMXEXT 1
62 #define RENAME(a) a ## _mmxext
68 const int dstH=
c->dstH;
71 SwsPlane *lumPlane = &
c->slice[
c->numSlice-2].plane[0];
72 SwsPlane *chrUPlane = &
c->slice[
c->numSlice-2].plane[1];
73 SwsPlane *alpPlane = &
c->slice[
c->numSlice-2].plane[3];
75 int hasAlpha =
c->needAlpha;
85 const int chrDstY=
dstY>>
c->chrDstVSubSample;
96 const int16_t **lumSrcPtr = (
const int16_t **)(
void*) lumPlane->
line + firstLumSrcY - lumPlane->
sliceY;
97 const int16_t **chrUSrcPtr = (
const int16_t **)(
void*) chrUPlane->
line + firstChrSrcY - chrUPlane->
sliceY;
98 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (
const int16_t **)(
void*) alpPlane->
line + firstLumSrcY - alpPlane->
sliceY :
NULL;
101 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize >
c->srcH) {
102 const int16_t **tmpY = (
const int16_t **) lumPlane->
tmp;
105 for (
i = 0;
i < neg;
i++)
106 tmpY[
i] = lumSrcPtr[neg];
107 for ( ;
i < end;
i++)
108 tmpY[
i] = lumSrcPtr[
i];
114 const int16_t **tmpA = (
const int16_t **) alpPlane->
tmp;
116 tmpA[
i] = alpSrcPtr[neg];
117 for ( ;
i < end;
i++)
118 tmpA[
i] = alpSrcPtr[
i];
120 tmpA[
i] = tmpA[
i - 1];
124 if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize >
c->chrSrcH) {
125 const int16_t **tmpU = (
const int16_t **) chrUPlane->
tmp;
127 for (
i = 0;
i < neg;
i++) {
128 tmpU[
i] = chrUSrcPtr[neg];
130 for ( ;
i < end;
i++) {
131 tmpU[
i] = chrUSrcPtr[
i];
134 tmpU[
i] = tmpU[
i - 1];
147 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
167 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
184 #define YUV2YUVX_FUNC_MMX(opt, step) \
185 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
186 uint8_t *dest, int dstW, \
187 const uint8_t *dither, int offset); \
188 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
189 const int16_t **src, uint8_t *dest, int dstW, \
190 const uint8_t *dither, int offset) \
193 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
197 #define YUV2YUVX_FUNC(opt, step) \
198 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
199 uint8_t *dest, int dstW, \
200 const uint8_t *dither, int offset); \
201 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
202 const int16_t **src, uint8_t *dest, int dstW, \
203 const uint8_t *dither, int offset) \
205 int remainder = (dstW % step); \
206 int pixelsProcessed = dstW - remainder; \
207 if(((uintptr_t)dest) & 15){ \
208 yuv2yuvX_mmxext(filter, filterSize, src, dest, dstW, dither, offset); \
211 if(pixelsProcessed > 0) \
212 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
214 ff_yuv2yuvX_mmxext(filter, filterSize - 1, pixelsProcessed, dest - offset, pixelsProcessed + remainder + offset, dither, offset); \
219 #if HAVE_MMXEXT_EXTERNAL
222 #if HAVE_SSE3_EXTERNAL
225 #if HAVE_AVX2_EXTERNAL
229 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
230 void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
231 SwsContext *c, int16_t *data, \
232 int dstW, const uint8_t *src, \
233 const int16_t *filter, \
234 const int32_t *filterPos, int filterSize)
236 #define SCALE_FUNCS(filter_n, opt) \
237 SCALE_FUNC(filter_n, 8, 15, opt); \
238 SCALE_FUNC(filter_n, 9, 15, opt); \
239 SCALE_FUNC(filter_n, 10, 15, opt); \
240 SCALE_FUNC(filter_n, 12, 15, opt); \
241 SCALE_FUNC(filter_n, 14, 15, opt); \
242 SCALE_FUNC(filter_n, 16, 15, opt); \
243 SCALE_FUNC(filter_n, 8, 19, opt); \
244 SCALE_FUNC(filter_n, 9, 19, opt); \
245 SCALE_FUNC(filter_n, 10, 19, opt); \
246 SCALE_FUNC(filter_n, 12, 19, opt); \
247 SCALE_FUNC(filter_n, 14, 19, opt); \
248 SCALE_FUNC(filter_n, 16, 19, opt)
250 #define SCALE_FUNCS_MMX(opt) \
251 SCALE_FUNCS(4, opt); \
252 SCALE_FUNCS(8, opt); \
255 #define SCALE_FUNCS_SSE(opt) \
256 SCALE_FUNCS(4, opt); \
257 SCALE_FUNCS(8, opt); \
258 SCALE_FUNCS(X4, opt); \
268 #define VSCALEX_FUNC(size, opt) \
269 void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
270 const int16_t **src, uint8_t *dest, int dstW, \
271 const uint8_t *dither, int offset)
272 #define VSCALEX_FUNCS(opt) \
273 VSCALEX_FUNC(8, opt); \
274 VSCALEX_FUNC(9, opt); \
275 VSCALEX_FUNC(10, opt)
283 #define VSCALE_FUNC(size, opt) \
284 void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
285 const uint8_t *dither, int offset)
286 #define VSCALE_FUNCS(opt1, opt2) \
287 VSCALE_FUNC(8, opt1); \
288 VSCALE_FUNC(9, opt2); \
289 VSCALE_FUNC(10, opt2); \
290 VSCALE_FUNC(16, opt1)
296 #define INPUT_Y_FUNC(fmt, opt) \
297 void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
298 const uint8_t *unused1, const uint8_t *unused2, \
299 int w, uint32_t *unused, void *opq)
300 #define INPUT_UV_FUNC(fmt, opt) \
301 void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
302 const uint8_t *unused0, \
303 const uint8_t *src1, \
304 const uint8_t *src2, \
305 int w, uint32_t *unused, void *opq)
306 #define INPUT_FUNC(fmt, opt) \
307 INPUT_Y_FUNC(fmt, opt); \
308 INPUT_UV_FUNC(fmt, opt)
309 #define INPUT_FUNCS(opt) \
310 INPUT_FUNC(uyvy, opt); \
311 INPUT_FUNC(yuyv, opt); \
312 INPUT_UV_FUNC(nv12, opt); \
313 INPUT_UV_FUNC(nv21, opt); \
314 INPUT_FUNC(rgba, opt); \
315 INPUT_FUNC(bgra, opt); \
316 INPUT_FUNC(argb, opt); \
317 INPUT_FUNC(abgr, opt); \
318 INPUT_FUNC(rgb24, opt); \
319 INPUT_FUNC(bgr24, opt)
332 #define YUV2NV_DECL(fmt, opt) \
333 void ff_yuv2 ## fmt ## cX_ ## opt(enum AVPixelFormat format, const uint8_t *dither, \
334 const int16_t *filter, int filterSize, \
335 const int16_t **u, const int16_t **v, \
336 uint8_t *dst, int dstWidth)
338 YUV2NV_DECL(nv12, avx2);
339 YUV2NV_DECL(nv21, avx2);
341 #define YUV2GBRP_FN_DECL(fmt, opt) \
342 void ff_yuv2##fmt##_full_X_ ##opt(SwsContext *c, const int16_t *lumFilter, \
343 const int16_t **lumSrcx, int lumFilterSize, \
344 const int16_t *chrFilter, const int16_t **chrUSrcx, \
345 const int16_t **chrVSrcx, int chrFilterSize, \
346 const int16_t **alpSrcx, uint8_t **dest, \
349 #define YUV2GBRP_DECL(opt) \
350 YUV2GBRP_FN_DECL(gbrp, opt); \
351 YUV2GBRP_FN_DECL(gbrap, opt); \
352 YUV2GBRP_FN_DECL(gbrp9le, opt); \
353 YUV2GBRP_FN_DECL(gbrp10le, opt); \
354 YUV2GBRP_FN_DECL(gbrap10le, opt); \
355 YUV2GBRP_FN_DECL(gbrp12le, opt); \
356 YUV2GBRP_FN_DECL(gbrap12le, opt); \
357 YUV2GBRP_FN_DECL(gbrp14le, opt); \
358 YUV2GBRP_FN_DECL(gbrp16le, opt); \
359 YUV2GBRP_FN_DECL(gbrap16le, opt); \
360 YUV2GBRP_FN_DECL(gbrpf32le, opt); \
361 YUV2GBRP_FN_DECL(gbrapf32le, opt); \
362 YUV2GBRP_FN_DECL(gbrp9be, opt); \
363 YUV2GBRP_FN_DECL(gbrp10be, opt); \
364 YUV2GBRP_FN_DECL(gbrap10be, opt); \
365 YUV2GBRP_FN_DECL(gbrp12be, opt); \
366 YUV2GBRP_FN_DECL(gbrap12be, opt); \
367 YUV2GBRP_FN_DECL(gbrp14be, opt); \
368 YUV2GBRP_FN_DECL(gbrp16be, opt); \
369 YUV2GBRP_FN_DECL(gbrap16be, opt); \
370 YUV2GBRP_FN_DECL(gbrpf32be, opt); \
371 YUV2GBRP_FN_DECL(gbrapf32be, opt)
377 #define INPUT_PLANAR_RGB_Y_FN_DECL(fmt, opt) \
378 void ff_planar_##fmt##_to_y_##opt(uint8_t *dst, \
379 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
382 #define INPUT_PLANAR_RGB_UV_FN_DECL(fmt, opt) \
383 void ff_planar_##fmt##_to_uv_##opt(uint8_t *dstU, uint8_t *dstV, \
384 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
387 #define INPUT_PLANAR_RGB_A_FN_DECL(fmt, opt) \
388 void ff_planar_##fmt##_to_a_##opt(uint8_t *dst, \
389 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
393 #define INPUT_PLANAR_RGBXX_A_DECL(fmt, opt) \
394 INPUT_PLANAR_RGB_A_FN_DECL(fmt##le, opt); \
395 INPUT_PLANAR_RGB_A_FN_DECL(fmt##be, opt)
397 #define INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt) \
398 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##le, opt); \
399 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##be, opt)
401 #define INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt) \
402 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##le, opt); \
403 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##be, opt)
405 #define INPUT_PLANAR_RGBXX_YUVA_DECL(fmt, opt) \
406 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
407 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
408 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
410 #define INPUT_PLANAR_RGBXX_YUV_DECL(fmt, opt) \
411 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
412 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt)
414 #define INPUT_PLANAR_RGBXX_UVA_DECL(fmt, opt) \
415 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
416 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
418 #define INPUT_PLANAR_RGB_A_ALL_DECL(opt) \
419 INPUT_PLANAR_RGB_A_FN_DECL(rgb, opt); \
420 INPUT_PLANAR_RGBXX_A_DECL(rgb10, opt); \
421 INPUT_PLANAR_RGBXX_A_DECL(rgb12, opt); \
422 INPUT_PLANAR_RGBXX_A_DECL(rgb16, opt); \
423 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, opt)
425 #define INPUT_PLANAR_RGB_Y_ALL_DECL(opt) \
426 INPUT_PLANAR_RGB_Y_FN_DECL(rgb, opt); \
427 INPUT_PLANAR_RGBXX_Y_DECL(rgb9, opt); \
428 INPUT_PLANAR_RGBXX_Y_DECL(rgb10, opt); \
429 INPUT_PLANAR_RGBXX_Y_DECL(rgb12, opt); \
430 INPUT_PLANAR_RGBXX_Y_DECL(rgb14, opt); \
431 INPUT_PLANAR_RGBXX_Y_DECL(rgb16, opt); \
432 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, opt)
434 #define INPUT_PLANAR_RGB_UV_ALL_DECL(opt) \
435 INPUT_PLANAR_RGB_UV_FN_DECL(rgb, opt); \
436 INPUT_PLANAR_RGBXX_UV_DECL(rgb9, opt); \
437 INPUT_PLANAR_RGBXX_UV_DECL(rgb10, opt); \
438 INPUT_PLANAR_RGBXX_UV_DECL(rgb12, opt); \
439 INPUT_PLANAR_RGBXX_UV_DECL(rgb14, opt); \
440 INPUT_PLANAR_RGBXX_UV_DECL(rgb16, opt); \
441 INPUT_PLANAR_RGBXX_UV_DECL(rgbf32, opt)
443 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, sse2);
444 INPUT_PLANAR_RGB_UV_ALL_DECL(sse2);
445 INPUT_PLANAR_RGB_A_ALL_DECL(sse2);
447 INPUT_PLANAR_RGB_Y_ALL_DECL(sse4);
448 INPUT_PLANAR_RGB_UV_ALL_DECL(sse4);
449 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, sse4);
451 INPUT_PLANAR_RGB_Y_ALL_DECL(avx2);
452 INPUT_PLANAR_RGB_UV_ALL_DECL(avx2);
453 INPUT_PLANAR_RGB_A_ALL_DECL(avx2);
456 #define RANGE_CONVERT_FUNCS(opt) do { \
457 if (c->dstBpc <= 14) { \
459 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \
460 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \
462 c->lumConvertRange = ff_lumRangeToJpeg_ ##opt; \
463 c->chrConvertRange = ff_chrRangeToJpeg_ ##opt; \
468 #define RANGE_CONVERT_FUNCS_DECL(opt) \
469 void ff_lumRangeFromJpeg_ ##opt(int16_t *dst, int width); \
470 void ff_chrRangeFromJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
471 void ff_lumRangeToJpeg_ ##opt(int16_t *dst, int width); \
472 void ff_chrRangeToJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
479 if (
c->srcRange !=
c->dstRange && !
isAnyRGB(
c->dstFormat)) {
493 #if HAVE_MMXEXT_INLINE
495 sws_init_swscale_mmxext(
c);
498 #if HAVE_MMXEXT_EXTERNAL
500 c->yuv2planeX = yuv2yuvX_mmxext;
502 #if HAVE_SSE3_EXTERNAL
504 c->yuv2planeX = yuv2yuvX_sse3;
506 #if HAVE_AVX2_EXTERNAL
508 c->yuv2planeX = yuv2yuvX_avx2;
511 #if ARCH_X86_32 && !HAVE_ALIGNED_STACK
515 if (
c->dstBpc == 8 && !
c->use_mmx_vfilter)
516 c->yuv2planeX = ff_yuv2planeX_8_mmxext;
520 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
521 if (c->srcBpc == 8) { \
522 hscalefn = c->dstBpc <= 14 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
523 ff_hscale8to19_ ## filtersize ## _ ## opt1; \
524 } else if (c->srcBpc == 9) { \
525 hscalefn = c->dstBpc <= 14 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
526 ff_hscale9to19_ ## filtersize ## _ ## opt1; \
527 } else if (c->srcBpc == 10) { \
528 hscalefn = c->dstBpc <= 14 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
529 ff_hscale10to19_ ## filtersize ## _ ## opt1; \
530 } else if (c->srcBpc == 12) { \
531 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
532 ff_hscale12to19_ ## filtersize ## _ ## opt1; \
533 } 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)) { \
534 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
535 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
537 av_assert0(c->srcBpc == 16);\
538 hscalefn = c->dstBpc <= 14 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
539 ff_hscale16to19_ ## filtersize ## _ ## opt1; \
542 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
544 case 16: do_16_case; break; \
545 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
546 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
547 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
549 #define ASSIGN_VSCALE_FUNC(vscalefn, opt) \
551 case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
552 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2plane1_10_ ## opt; break; \
553 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
554 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \
555 default: av_assert0(c->dstBpc>8); \
557 #define case_rgb(x, X, opt) \
558 case AV_PIX_FMT_ ## X: \
559 c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
560 if (!c->chrSrcHSubSample) \
561 c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
563 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
564 switch (filtersize) { \
565 case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
566 case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
567 default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
568 else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
575 HAVE_ALIGNED_STACK || ARCH_X86_64);
579 switch (
c->srcFormat) {
581 c->lumToYV12 = ff_yuyvToY_sse2;
583 c->alpToYV12 = ff_uyvyToY_sse2;
586 c->lumToYV12 = ff_yuyvToY_sse2;
587 c->chrToYV12 = ff_yuyvToUV_sse2;
590 c->lumToYV12 = ff_uyvyToY_sse2;
591 c->chrToYV12 = ff_uyvyToUV_sse2;
594 c->chrToYV12 = ff_nv12ToUV_sse2;
597 c->chrToYV12 = ff_nv21ToUV_sse2;
612 switch (
c->srcFormat) {
624 if (!
isBE(
c->dstFormat))
c->yuv2planeX = ff_yuv2planeX_16_sse4,
625 HAVE_ALIGNED_STACK || ARCH_X86_64);
627 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
632 HAVE_ALIGNED_STACK || ARCH_X86_64);
636 switch (
c->srcFormat) {
638 c->chrToYV12 = ff_yuyvToUV_avx;
641 c->chrToYV12 = ff_uyvyToUV_avx;
644 c->chrToYV12 = ff_nv12ToUV_avx;
647 c->chrToYV12 = ff_nv21ToUV_avx;
661 #define ASSIGN_AVX2_SCALE_FUNC(hscalefn, filtersize) \
662 switch (filtersize) { \
663 case 4: hscalefn = ff_hscale8to15_4_avx2; break; \
664 default: hscalefn = ff_hscale8to15_X4_avx2; break; \
669 if ((
c->srcBpc == 8) && (
c->dstBpc <= 14)) {
670 ASSIGN_AVX2_SCALE_FUNC(
c->hcScale,
c->hChrFilterSize);
671 ASSIGN_AVX2_SCALE_FUNC(
c->hyScale,
c->hLumFilterSize);
677 switch (
c->srcFormat) {
685 switch (
c->dstFormat) {
688 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;
692 c->yuv2nv12cX = ff_yuv2nv21cX_avx2;
700 #define INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(fmt, name, opt) \
702 c->readAlpPlanar = ff_planar_##name##_to_a_##opt;
704 #define INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
707 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
708 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
711 #define INPUT_PLANER_RGB_YUV_FUNC_CASE(fmt, name, opt) \
713 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
714 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
717 #define INPUT_PLANER_RGB_UV_FUNC_CASE(fmt, name, opt) \
719 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
722 #define INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
723 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
724 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
725 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
726 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
728 #define INPUT_PLANER_RGBAXX_UVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
729 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
730 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
731 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
732 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
734 #define INPUT_PLANER_RGBAXX_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
735 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##LE, rgba_fmt##LE, name##le, opt) \
736 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##BE, rgba_fmt##BE, name##be, opt)
738 #define INPUT_PLANER_RGBXX_YUV_FUNC_CASE(rgb_fmt, name, opt) \
739 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
740 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
742 #define INPUT_PLANER_RGBXX_UV_FUNC_CASE(rgb_fmt, name, opt) \
743 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
744 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
746 #define INPUT_PLANER_RGB_YUVA_ALL_CASES(opt) \
747 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, opt) \
748 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, opt) \
749 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, opt) \
750 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, rgb10, opt) \
751 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, rgb12, opt) \
752 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP14, rgb14, opt) \
753 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, rgb16, opt) \
754 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, rgbf32, opt)
758 switch (
c->srcFormat) {
773 switch (
c->srcFormat) {
788 switch (
c->srcFormat) {
789 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)
801 #define YUV2ANYX_FUNC_CASE(fmt, name, opt) \
803 c->yuv2anyX = ff_yuv2##name##_full_X_##opt; \
806 #define YUV2ANYX_GBRAP_CASES(opt) \
807 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP, gbrp, opt) \
808 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP, gbrap, opt) \
809 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9LE, gbrp9le, opt) \
810 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10LE, gbrp10le, opt) \
811 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10LE, gbrap10le, opt) \
812 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12LE, gbrp12le, opt) \
813 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12LE, gbrap12le, opt) \
814 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14LE, gbrp14le, opt) \
815 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16LE, gbrp16le, opt) \
816 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16LE, gbrap16le, opt) \
817 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32LE, gbrpf32le, opt) \
818 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32LE, gbrapf32le, opt) \
819 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9BE, gbrp9be, opt) \
820 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10BE, gbrp10be, opt) \
821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10BE, gbrap10be, opt) \
822 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12BE, gbrp12be, opt) \
823 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12BE, gbrap12be, opt) \
824 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14BE, gbrp14be, opt) \
825 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16BE, gbrp16be, opt) \
826 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16BE, gbrap16be, opt) \
827 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32BE, gbrpf32be, opt) \
828 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)
831 switch (
c->dstFormat) {
832 YUV2ANYX_GBRAP_CASES(sse2)
839 switch (
c->dstFormat) {
840 YUV2ANYX_GBRAP_CASES(sse4)
847 switch (
c->dstFormat) {
848 YUV2ANYX_GBRAP_CASES(avx2)
int vLumFilterSize
Vertical filter size for luma/alpha pixels.
#define AV_PIX_FMT_GBRAP16
#define DECLARE_ASM_ALIGNED(n, t, v)
uint8_t ** line
line buffer
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
int dstY
Last destination vertical line output from last slice.
#define EXTERNAL_AVX2_FAST(flags)
int16_t * vChrFilter
Array of vertical filter coefficients for chroma planes.
int32_t lumMmxFilter[4 *MAX_FILTER_SIZE]
int16_t * vLumFilter
Array of vertical filter coefficients for luma/alpha planes.
#define RANGE_CONVERT_FUNCS(opt)
#define DECLARE_ASM_CONST(n, t, v)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
static atomic_int cpu_flags
#define INPUT_FUNC(fmt, opt)
#define AV_PIX_FMT_GBRP14
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
#define AV_PIX_FMT_GBRP10
#define AV_CPU_FLAG_SLOW_GATHER
CPU has slow gathers.
av_cold void ff_sws_init_range_convert_x86(SwsContext *c)
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP12
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint8_t ** tmp
Tmp line buffer used by mmx code.
#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt)
#define VSCALE_FUNCS(opt1, opt2)
int32_t * vLumFilterPos
Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
#define VSCALEX_FUNC(size, opt)
#define AV_PIX_FMT_GBRP16
#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2)
av_cold void ff_sws_init_swscale_x86(SwsContext *c)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
#define EXTERNAL_SSE3(flags)
#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit)
int32_t alpMmxFilter[4 *MAX_FILTER_SIZE]
#define ASSIGN_VSCALE_FUNC(vscalefn, opt)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int32_t * vChrFilterPos
Array of vertical filter starting positions for each dst[i] for chroma planes.
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
#define DECLARE_ALIGNED(n, t, v)
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
#define SWS_FULL_CHR_H_INT
#define AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_BGR555
int vChrFilterSize
Vertical filter size for chroma pixels.
#define EXTERNAL_SSE2(flags)
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_GBRP12
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
#define AV_PIX_FMT_RGB555
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
const uint64_t ff_dither8[2]
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
#define EXTERNAL_AVX(flags)
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
#define EXTERNAL_SSE4(flags)
#define AV_PIX_FMT_GBRAPF32
#define YUV2YUVX_FUNC_MMX(opt, step)
#define INLINE_MMXEXT(flags)
int32_t chrMmxFilter[4 *MAX_FILTER_SIZE]
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define RANGE_CONVERT_FUNCS_DECL(opt)
int sliceY
index of first line
#define VSCALE_FUNC(size, opt)
#define case_rgb(x, X, opt)
#define flags(name, subs,...)
#define YUV2YUVX_FUNC(opt, step)
void ff_updateMMXDitherTables(SwsContext *c, int dstY)
#define EXTERNAL_SSSE3(flags)
#define SCALE_FUNCS_SSE(opt)
int dstH
Height of destination luma/alpha planes.
#define VSCALEX_FUNCS(opt)
#define EXTERNAL_MMXEXT(flags)
const uint64_t ff_dither4[2]