This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 21e69d0f08fbdfb1fce38863e9ab33b5c6e26153 Author: Jun Zhao <[email protected]> AuthorDate: Thu Nov 26 22:33:25 2026 +0800 Commit: Jun Zhao <[email protected]> CommitDate: Sat Nov 28 06:33:48 2026 +0000 checkasm/sw_rgb: cover odd heights in rgb24toyv12 The existing cases use even heights and allow a one-unit difference across the entire output buffer, including padding. Add AArch64 cases for single rows, larger odd heights, aligned and remainder widths, and negative strides. Round up the chroma height and check that the scalar tail matches C exactly in all three planes. Require unchanged guard rows and padding, and keep the one-unit tolerance for the other active pixels. Signed-off-by: Jun Zhao <[email protected]> --- tests/checkasm/sw_rgb.c | 67 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c index 723f810411..9a4a1bb4bc 100644 --- a/tests/checkasm/sw_rgb.c +++ b/tests/checkasm/sw_rgb.c @@ -123,18 +123,34 @@ static void check_interleaved_to_planar(void *func, const char *report, int odd_ #define MAX_LINE_SIZE 1920 #define BUFSIZE (NUM_LINES * MAX_LINE_SIZE) -static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy) +static int check_rgb24toyv12_plane(const uint8_t *ref, const uint8_t *test, + int size, int stride, int width, int height, + int guard_rows, int odd_height) { - for (size_t i = 0; i < n; i++) { - if (abs(ref[i] - test[i]) > accuracy) + /* The scalar last row must match exactly, including with negative strides. */ + int exact_row = odd_height ? guard_rows + (stride > 0 ? height - 1 : 0) : -1; + + stride = FFABS(stride); + for (int i = 0; i < size; i++) { + if (i < guard_rows * stride || i >= (height + guard_rows) * stride || + i % stride >= width) { + if (ref[i] != 0xFF || test[i] != 0xFF) + return 1; + } else if (abs(ref[i] - test[i]) > (i / stride != exact_row)) { return 1; + } } return 0; } static void check_rgb24toyv12(SwsContext *sws) { - static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE}; + static const struct { int width, height; } sizes[] = { + { 16, 0 }, { 128, 0 }, { 512, 0 }, { MAX_LINE_SIZE, 0 }, { -MAX_LINE_SIZE, 0 }, +#if ARCH_AARCH64 + { 16, 1 }, { 22, 1 }, { 14, 17 }, { 32, 17 }, { 38, 17 }, { -38, 17 }, { 38, 16 }, +#endif + }; SwsInternal *ctx = sws_internal(sws); LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]); @@ -151,32 +167,34 @@ static void check_rgb24toyv12(SwsContext *sws) randomize_buffers(src, BUFSIZE * 3); - for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { - int input_size = input_sizes[isi]; - int negstride = input_size < 0; + for (int i = 0; i < FF_ARRAY_ELEMS(sizes); i++) { + int negstride = sizes[i].width < 0; const char *negstride_str = negstride ? "_negstride" : ""; - int width = FFABS(input_size); + int width = FFABS(sizes[i].width); int linesize = width + 32; - /* calculate height based on specified width to use the entire buffer. */ - int height = (BUFSIZE / linesize) & ~1; + int height = sizes[i].height ? sizes[i].height : (BUFSIZE / linesize) & ~1; + int chrom_height = (height + 1) / 2; + /* The small boundary cases have room for guard rows at both ends. */ + int guard_rows = !!sizes[i].height; + int guard = guard_rows * linesize; uint8_t *src0 = src; uint8_t *src1 = src; - uint8_t *dst_y_0 = buf_y_0; - uint8_t *dst_y_1 = buf_y_1; - uint8_t *dst_u_0 = buf_u_0; - uint8_t *dst_u_1 = buf_u_1; - uint8_t *dst_v_0 = buf_v_0; - uint8_t *dst_v_1 = buf_v_1; + uint8_t *dst_y_0 = buf_y_0 + guard; + uint8_t *dst_y_1 = buf_y_1 + guard; + uint8_t *dst_u_0 = buf_u_0 + guard / 2; + uint8_t *dst_u_1 = buf_u_1 + guard / 2; + uint8_t *dst_v_0 = buf_v_0 + guard / 2; + uint8_t *dst_v_1 = buf_v_1 + guard / 2; if (negstride) { src0 += (height - 1) * (linesize * 3); src1 += (height - 1) * (linesize * 3); dst_y_0 += (height - 1) * linesize; dst_y_1 += (height - 1) * linesize; - dst_u_0 += ((height / 2) - 1) * (linesize / 2); - dst_u_1 += ((height / 2) - 1) * (linesize / 2); - dst_v_0 += ((height / 2) - 1) * (linesize / 2); - dst_v_1 += ((height / 2) - 1) * (linesize / 2); + dst_u_0 += (chrom_height - 1) * (linesize / 2); + dst_u_1 += (chrom_height - 1) * (linesize / 2); + dst_v_0 += (chrom_height - 1) * (linesize / 2); + dst_v_1 += (chrom_height - 1) * (linesize / 2); linesize *= -1; } @@ -192,9 +210,12 @@ static void check_rgb24toyv12(SwsContext *sws) linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); call_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height, linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); - if (cmp_off_by_n(buf_y_0, buf_y_1, BUFSIZE, 1) || - cmp_off_by_n(buf_u_0, buf_u_1, BUFSIZE / 4, 1) || - cmp_off_by_n(buf_v_0, buf_v_1, BUFSIZE / 4, 1)) + if (check_rgb24toyv12_plane(buf_y_0, buf_y_1, BUFSIZE, linesize, + width, height, guard_rows, height & 1) || + check_rgb24toyv12_plane(buf_u_0, buf_u_1, BUFSIZE / 4, linesize / 2, + width / 2, chrom_height, guard_rows, height & 1) || + check_rgb24toyv12_plane(buf_v_0, buf_v_1, BUFSIZE / 4, linesize / 2, + width / 2, chrom_height, guard_rows, height & 1)) fail(); bench_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height, linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
