checkasm: vvc: Use checkasm_check for printing failing output

Share the checkasm_check_pixel macro from hevc_pel in checkasm.h,
to allow other tests to use the same. (To use it in other tests,
those tests need to have a similar setup for high bitdepth pixels,
with a local variable named "bit_depth".)

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.

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/391/head
Martin Storsjö 1 month ago
parent 4a2fb1781c
commit 47b1e1bd84
  1. 12
      tests/checkasm/checkasm.h
  2. 9
      tests/checkasm/hevc_pel.c
  3. 10
      tests/checkasm/vvc_alf.c

@ -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 */

@ -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]; \

@ -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);
}

Loading…
Cancel
Save