[FFmpeg-devel] [PATCH] checkasm: vvc: Use checkasm_check for printing failing output
Martin Storsjö
martin at martin.st
Mon Dec 9 14:24:53 EET 2024
This simplifies the code for checking the output, and can print
the failing output (including a map of matching/mismatching
elements) if checkasm is run with the -v/--verbose option.
This is similar to what was done for hevc_pel in
8ff4a4a4f4f73c5e276fa0cbe6cd5a148ebdd4ae.
---
tests/checkasm/vvc_alf.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c
index 15e79289cd..0d05fb034d 100644
--- a/tests/checkasm/vvc_alf.c
+++ b/tests/checkasm/vvc_alf.c
@@ -39,6 +39,15 @@ static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
#define DST_BUF_SIZE (DST_PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2)
#define LUMA_PARAMS_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE * ALF_NUM_COEFF_LUMA)
+#define checkasm_check_pixel(buf1, stride1, buf2, stride2, ...) \
+ ((bit_depth > 8) ? \
+ checkasm_check(uint16_t, (const uint16_t*)buf1, stride1, \
+ (const uint16_t*)buf2, stride2, \
+ __VA_ARGS__) : \
+ checkasm_check(uint8_t, (const uint8_t*) buf1, stride1, \
+ (const uint8_t*) buf2, stride2, \
+ __VA_ARGS__))
+
#define randomize_buffers(buf0, buf1, size) \
do { \
uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
@@ -108,10 +117,7 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth)
memset(dst1, 0, DST_BUF_SIZE);
call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
- for (int i = 0; i < (h + 1); i++) {
- if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, (w + 1) * SIZEOF_PIXEL))
- fail();
- }
+ checkasm_check_pixel(dst0, dst_stride, dst1, dst_stride, w + 1, h + 1, "dst");
// Bench only square sizes, and ones with dimensions being a power of two.
if (w == h && (w & (w - 1)) == 0)
bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
@@ -125,10 +131,7 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth)
memset(dst1, 0, DST_BUF_SIZE);
call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
- for (int i = 0; i < (h + 1); i++) {
- if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, (w + 1) * SIZEOF_PIXEL))
- fail();
- }
+ checkasm_check_pixel(dst0, dst_stride, dst1, dst_stride, w + 1, h + 1, "dst");
if (w == h && (w & (w - 1)) == 0)
bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
}
--
2.39.5 (Apple Git-154)
More information about the ffmpeg-devel
mailing list