From: David Christle via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: David Christle <dev@christle.is>
Subject: [FFmpeg-devel] [PATCH v2 3/3] tests/checkasm/sw_yuv2rgb: test multi-row conversion with padded strides
Date: Sun, 08 Feb 2026 21:16:24 +0000
Message-ID: <20260208211537.91515-4-dev@christle.is> (raw)
In-Reply-To: <20260208211537.91515-1-dev@christle.is>
Increase test height from 2 to 4 rows and add 32 bytes of source stride
padding. This exercises chroma row sharing across multiple luma row pairs
in YUV420P and the stride increment arithmetic in SIMD implementations,
both of which were previously untested.
Signed-off-by: David Christle <dev@christle.is>
---
tests/checkasm/sw_yuv2rgb.c | 96 +++++++++++++++++++------------------
1 file changed, 49 insertions(+), 47 deletions(-)
diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c
index c6c1ad934b..ba579d0545 100644
--- a/tests/checkasm/sw_yuv2rgb.c
+++ b/tests/checkasm/sw_yuv2rgb.c
@@ -104,6 +104,8 @@ static void check_yuv2rgb(int src_pix_fmt)
{
const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
#define MAX_LINE_SIZE 1920
+#define SRC_STRIDE_PAD 32
+#define NUM_LINES 4
static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
@@ -111,36 +113,26 @@ static void check_yuv2rgb(int src_pix_fmt)
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *const dst[], const int dstStride[]);
- LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * 2]);
- LOCAL_ALIGNED_8(uint8_t, src_u, [MAX_LINE_SIZE]);
- LOCAL_ALIGNED_8(uint8_t, src_v, [MAX_LINE_SIZE]);
- LOCAL_ALIGNED_8(uint8_t, src_a, [MAX_LINE_SIZE * 2]);
+ LOCAL_ALIGNED_8(uint8_t, src_y, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]);
+ LOCAL_ALIGNED_8(uint8_t, src_u, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]);
+ LOCAL_ALIGNED_8(uint8_t, src_v, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]);
+ LOCAL_ALIGNED_8(uint8_t, src_a, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]);
const uint8_t *src[4] = { src_y, src_u, src_v, src_a };
- LOCAL_ALIGNED_8(uint8_t, dst0_0, [2 * MAX_LINE_SIZE * 6]);
- LOCAL_ALIGNED_8(uint8_t, dst0_1, [2 * MAX_LINE_SIZE]);
- LOCAL_ALIGNED_8(uint8_t, dst0_2, [2 * MAX_LINE_SIZE]);
+ LOCAL_ALIGNED_8(uint8_t, dst0_0, [NUM_LINES * MAX_LINE_SIZE * 6]);
+ LOCAL_ALIGNED_8(uint8_t, dst0_1, [NUM_LINES * MAX_LINE_SIZE]);
+ LOCAL_ALIGNED_8(uint8_t, dst0_2, [NUM_LINES * MAX_LINE_SIZE]);
uint8_t *dst0[4] = { dst0_0, dst0_1, dst0_2 };
- uint8_t *lines0[4][2] = {
- { dst0_0, dst0_0 + MAX_LINE_SIZE * 6 },
- { dst0_1, dst0_1 + MAX_LINE_SIZE },
- { dst0_2, dst0_2 + MAX_LINE_SIZE }
- };
-
- LOCAL_ALIGNED_8(uint8_t, dst1_0, [2 * MAX_LINE_SIZE * 6]);
- LOCAL_ALIGNED_8(uint8_t, dst1_1, [2 * MAX_LINE_SIZE]);
- LOCAL_ALIGNED_8(uint8_t, dst1_2, [2 * MAX_LINE_SIZE]);
+
+ LOCAL_ALIGNED_8(uint8_t, dst1_0, [NUM_LINES * MAX_LINE_SIZE * 6]);
+ LOCAL_ALIGNED_8(uint8_t, dst1_1, [NUM_LINES * MAX_LINE_SIZE]);
+ LOCAL_ALIGNED_8(uint8_t, dst1_2, [NUM_LINES * MAX_LINE_SIZE]);
uint8_t *dst1[4] = { dst1_0, dst1_1, dst1_2 };
- uint8_t *lines1[4][2] = {
- { dst1_0, dst1_0 + MAX_LINE_SIZE * 6 },
- { dst1_1, dst1_1 + MAX_LINE_SIZE },
- { dst1_2, dst1_2 + MAX_LINE_SIZE }
- };
- randomize_buffers(src_y, MAX_LINE_SIZE * 2);
- randomize_buffers(src_u, MAX_LINE_SIZE);
- randomize_buffers(src_v, MAX_LINE_SIZE);
- randomize_buffers(src_a, MAX_LINE_SIZE * 2);
+ randomize_buffers(src_y, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES);
+ randomize_buffers(src_u, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES);
+ randomize_buffers(src_v, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES);
+ randomize_buffers(src_a, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES);
for (int dfi = 0; dfi < FF_ARRAY_ELEMS(dst_fmts); dfi++) {
int dst_pix_fmt = dst_fmts[dfi];
@@ -152,12 +144,12 @@ static void check_yuv2rgb(int src_pix_fmt)
int log_level;
int width = input_sizes[isi];
int srcSliceY = 0;
- int srcSliceH = 2;
+ int srcSliceH = NUM_LINES;
int srcStride[4] = {
- width,
- width >> src_desc->log2_chroma_w,
- width >> src_desc->log2_chroma_w,
- width,
+ width + SRC_STRIDE_PAD,
+ (width >> src_desc->log2_chroma_w) + SRC_STRIDE_PAD,
+ (width >> src_desc->log2_chroma_w) + SRC_STRIDE_PAD,
+ width + SRC_STRIDE_PAD,
};
int dstStride[4] = {
MAX_LINE_SIZE * 6,
@@ -178,13 +170,13 @@ static void check_yuv2rgb(int src_pix_fmt)
c = sws_internal(sws);
if (check_func(c->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) {
- memset(dst0_0, 0xFF, 2 * MAX_LINE_SIZE * 6);
- memset(dst1_0, 0xFF, 2 * MAX_LINE_SIZE * 6);
+ memset(dst0_0, 0xFF, NUM_LINES * MAX_LINE_SIZE * 6);
+ memset(dst1_0, 0xFF, NUM_LINES * MAX_LINE_SIZE * 6);
if (dst_pix_fmt == AV_PIX_FMT_GBRP) {
- memset(dst0_1, 0xFF, MAX_LINE_SIZE);
- memset(dst0_2, 0xFF, MAX_LINE_SIZE);
- memset(dst1_1, 0xFF, MAX_LINE_SIZE);
- memset(dst1_2, 0xFF, MAX_LINE_SIZE);
+ memset(dst0_1, 0xFF, NUM_LINES * MAX_LINE_SIZE);
+ memset(dst0_2, 0xFF, NUM_LINES * MAX_LINE_SIZE);
+ memset(dst1_1, 0xFF, NUM_LINES * MAX_LINE_SIZE);
+ memset(dst1_2, 0xFF, NUM_LINES * MAX_LINE_SIZE);
}
call_ref(c, src, srcStride, srcSliceY,
@@ -198,23 +190,31 @@ static void check_yuv2rgb(int src_pix_fmt)
dst_pix_fmt == AV_PIX_FMT_BGRA ||
dst_pix_fmt == AV_PIX_FMT_RGB24 ||
dst_pix_fmt == AV_PIX_FMT_BGR24) {
- if (cmp_off_by_n(lines0[0][0], lines1[0][0], width * sample_size, 3) ||
- cmp_off_by_n(lines0[0][1], lines1[0][1], width * sample_size, 3))
- fail();
+ for (int row = 0; row < srcSliceH; row++)
+ if (cmp_off_by_n(dst0_0 + row * dstStride[0],
+ dst1_0 + row * dstStride[0],
+ width * sample_size, 3))
+ fail();
} else if (dst_pix_fmt == AV_PIX_FMT_RGB565 ||
dst_pix_fmt == AV_PIX_FMT_BGR565) {
- if (cmp_565_by_n(lines0[0][0], lines1[0][0], width, 2) ||
- cmp_565_by_n(lines0[0][1], lines1[0][1], width, 2))
- fail();
+ for (int row = 0; row < srcSliceH; row++)
+ if (cmp_565_by_n(dst0_0 + row * dstStride[0],
+ dst1_0 + row * dstStride[0],
+ width, 2))
+ fail();
} else if (dst_pix_fmt == AV_PIX_FMT_RGB555 ||
dst_pix_fmt == AV_PIX_FMT_BGR555) {
- if (cmp_555_by_n(lines0[0][0], lines1[0][0], width, 2) ||
- cmp_555_by_n(lines0[0][1], lines1[0][1], width, 2))
- fail();
+ for (int row = 0; row < srcSliceH; row++)
+ if (cmp_555_by_n(dst0_0 + row * dstStride[0],
+ dst1_0 + row * dstStride[0],
+ width, 2))
+ fail();
} else if (dst_pix_fmt == AV_PIX_FMT_GBRP) {
for (int p = 0; p < 3; p++)
- for (int l = 0; l < 2; l++)
- if (cmp_off_by_n(lines0[p][l], lines1[p][l], width, 3))
+ for (int row = 0; row < srcSliceH; row++)
+ if (cmp_off_by_n(dst0[p] + row * dstStride[p],
+ dst1[p] + row * dstStride[p],
+ width, 3))
fail();
} else {
fail();
@@ -228,6 +228,8 @@ static void check_yuv2rgb(int src_pix_fmt)
}
}
+#undef NUM_LINES
+#undef SRC_STRIDE_PAD
#undef MAX_LINE_SIZE
void checkasm_check_sw_yuv2rgb(void)
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
next prev parent reply other threads:[~2026-02-08 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 6:45 [FFmpeg-devel] [PATCH 1/2] swscale/aarch64: add NEON YUV420P/YUV422P/YUVA420P to RGB conversion David Christle via ffmpeg-devel
2026-02-06 6:46 ` [FFmpeg-devel] [PATCH 2/2] tests/checkasm/sw_yuv2rgb: test multi-row conversion with padded strides David Christle via ffmpeg-devel
2026-02-08 21:15 ` [FFmpeg-devel] [PATCH v2 0/3] swscale: NEON YUV2RGB + LoongArch LASX multi-row fix David Christle via ffmpeg-devel
2026-02-08 21:16 ` [FFmpeg-devel] [PATCH v2 1/3] swscale/loongarch: fix LASX YUV2RGB residual for multi-row slices David Christle via ffmpeg-devel
2026-02-08 21:16 ` [FFmpeg-devel] [PATCH v2 2/3] swscale/aarch64: add NEON YUV420P/YUV422P/YUVA420P to RGB conversion David Christle via ffmpeg-devel
2026-02-08 21:16 ` David Christle via ffmpeg-devel [this message]
2026-02-08 21:35 ` [FFmpeg-devel] Re: [PATCH v2 0/3] swscale: NEON YUV2RGB + LoongArch LASX multi-row fix Martin Storsjö via ffmpeg-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260208211537.91515-4-dev@christle.is \
--to=ffmpeg-devel@ffmpeg.org \
--cc=dev@christle.is \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git