Mirroring lumToYV12 and chrToYV12.
Unified · Split
| @@ -453,6 +453,50 @@ static void check_rgb_to_uv(SwsContext *sws) · 452 unmodified lines | ||
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | +static void check_rgba_to_a(SwsContext *sws) | |
| 457 | +{ | |
| 458 | + SwsInternal *ctx = sws_internal(sws); | |
| 459 | + | |
| 460 | + LOCAL_ALIGNED_16(uint8_t, src, [MAX_LINE_SIZE * 4]); | |
| 461 | + LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]); | |
| 462 | + LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]); | |
| 463 | + | |
| 464 | + declare_func(void, uint8_t *dst, const uint8_t *src1, | |
| 465 | + const uint8_t *src2, const uint8_t *src3, int width, | |
| 466 | + uint32_t *rgb2yuv, void *opq); | |
| 467 | + | |
| 468 | + randomize_buffers(src, MAX_LINE_SIZE * 4); | |
| 469 | + | |
| 470 | + for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) { | |
| 471 | + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]); | |
| 472 | + if (desc->nb_components < 4) | |
| 473 | + continue; | |
| 474 | + | |
| 475 | + sws->src_format = rgb_formats[i]; | |
| 476 | + ff_sws_init_scale(ctx); | |
| 477 | + | |
| 478 | + for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) { | |
| 479 | + int w = input_sizes[j]; | |
| 480 | + | |
| 481 | + if (check_func(ctx->alpToYV12, "%s_to_y_%d", desc->name, w)) { | |
| 482 | + memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 483 | + memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 484 | + | |
| 485 | + call_ref(dst0_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 486 | + call_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 487 | + | |
| 488 | + if (memcmp(dst0_y, dst1_y, w * 2)) | |
| 489 | + fail(); | |
| 490 | + | |
| 491 | + // only bench native endian formats | |
| 492 | + if (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1) | |
| 493 | + bench_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 494 | + } | |
| 495 | + } | |
| 496 | + } | |
| 497 | +} | |
| 498 | + | |
| 499 | + | |
| 456 | 500 | static const int packed_rgb_fmts[] = { |
| 457 | 501 | AV_PIX_FMT_RGB24, |
| 458 | 502 | AV_PIX_FMT_BGR24, |
| @@ -794,6 +838,9 @@ void checkasm_check_sw_rgb(void) · 335 unmodified lines | ||
| 794 | 838 | check_rgb_to_uv(sws); |
| 795 | 839 | report("rgb_to_uv"); |
| 796 | 840 | |
| 841 | + check_rgba_to_a(sws); | |
| 842 | + report("rgba_to_a"); | |
| 843 | + | |
| 797 | 844 | check_rgb24toyv12(sws); |
| 798 | 845 | report("rgb24toyv12"); |
| 799 | 846 | |