diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index cb6333fd5b..75c81317ba 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -392,4 +392,16 @@ DECL_CHECKASM_CHECK_FUNC(int32_t); #define checkasm_check(prefix, ...) CONCAT(checkasm_check_, prefix)(__FILE__, __LINE__, __VA_ARGS__) +/* This assumes that there is a local variable named "bit_depth". + * For tests that don't have that and only operate on a single + * bitdepth, just call checkasm_check(uint8_t, ...) directly. */ +#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__)) + #endif /* TESTS_CHECKASM_CHECKASM_H */ diff --git a/tests/checkasm/hevc_pel.c b/tests/checkasm/hevc_pel.c index d9fa56d420..b9417832e5 100644 --- a/tests/checkasm/hevc_pel.c +++ b/tests/checkasm/hevc_pel.c @@ -36,15 +36,6 @@ static const int offsets[] = {0, 255, -1 }; #define SIZEOF_PIXEL ((bit_depth + 7) / 8) #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE)) -#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() \ do { \ uint32_t mask = pixel_mask[bit_depth - 8]; \ diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c index 15e79289cd..fcb9ca0bc0 100644 --- a/tests/checkasm/vvc_alf.c +++ b/tests/checkasm/vvc_alf.c @@ -108,10 +108,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 +122,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); }