History

checkasm/sw_rgb: add alpToYV12 check

Mirroring lumToYV12 and chrToYV12.

Niklas Haas committed 1 year ago

Commit a9ae2cc1 parent c601bb81 file · +47 −0Browse files

Unified · Split

tests/checkasm/sw_rgb.c+47−0
@@ -453,6 +453,50 @@ static void check_rgb_to_uv(SwsContext *sws) · 452 unmodified lines
453453 }
454454 }
455455
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+
456500 static const int packed_rgb_fmts[] = {
457501 AV_PIX_FMT_RGB24,
458502 AV_PIX_FMT_BGR24,
@@ -794,6 +838,9 @@ void checkasm_check_sw_rgb(void) · 335 unmodified lines
794838 check_rgb_to_uv(sws);
795839 report("rgb_to_uv");
796840
841+ check_rgba_to_a(sws);
842+ report("rgba_to_a");
843+
797844 check_rgb24toyv12(sws);
798845 report("rgb24toyv12");
799846

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t