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.
Unified · Split
| @@ -392,4 +392,16 @@ DECL_CHECKASM_CHECK_FUNC(int32_t); · 391 unmodified lines | ||
| 392 | 392 | |
| 393 | 393 | #define checkasm_check(prefix, ...) CONCAT(checkasm_check_, prefix)(__FILE__, __LINE__, __VA_ARGS__) |
| 394 | 394 | |
| 395 | +/* This assumes that there is a local variable named "bit_depth". | |
| 396 | + * For tests that don't have that and only operate on a single | |
| 397 | + * bitdepth, just call checkasm_check(uint8_t, ...) directly. */ | |
| 398 | +#define checkasm_check_pixel(buf1, stride1, buf2, stride2, ...) \ | |
| 399 | + ((bit_depth > 8) ? \ | |
| 400 | + checkasm_check(uint16_t, (const uint16_t*)buf1, stride1, \ | |
| 401 | + (const uint16_t*)buf2, stride2, \ | |
| 402 | + __VA_ARGS__) : \ | |
| 403 | + checkasm_check(uint8_t, (const uint8_t*) buf1, stride1, \ | |
| 404 | + (const uint8_t*) buf2, stride2, \ | |
| 405 | + __VA_ARGS__)) | |
| 406 | + | |
| 395 | 407 | #endif /* TESTS_CHECKASM_CHECKASM_H */ |
| @@ -36,15 +36,6 @@ static const int offsets[] = {0, 255, -1 }; · 35 unmodified lines | ||
| 36 | 36 | #define SIZEOF_PIXEL ((bit_depth + 7) / 8) |
| 37 | 37 | #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE)) |
| 38 | 38 | |
| 39 | −#define checkasm_check_pixel(buf1, stride1, buf2, stride2, ...) \ | |
| 40 | − ((bit_depth > 8) ? \ | |
| 41 | − checkasm_check(uint16_t, (const uint16_t*)buf1, stride1, \ | |
| 42 | − (const uint16_t*)buf2, stride2, \ | |
| 43 | − __VA_ARGS__) : \ | |
| 44 | − checkasm_check(uint8_t, (const uint8_t*) buf1, stride1, \ | |
| 45 | − (const uint8_t*) buf2, stride2, \ | |
| 46 | − __VA_ARGS__)) | |
| 47 | − | |
| 48 | 39 | #define randomize_buffers() \ |
| 49 | 40 | do { \ |
| 50 | 41 | uint32_t mask = pixel_mask[bit_depth - 8]; \ |
| @@ -108,10 +108,7 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth) · 107 unmodified lines | ||
| 108 | 108 | memset(dst1, 0, DST_BUF_SIZE); |
| 109 | 109 | call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos); |
| 110 | 110 | call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos); |
| 111 | − for (int i = 0; i < (h + 1); i++) { | |
| 112 | − if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, (w + 1) * SIZEOF_PIXEL)) | |
| 113 | − fail(); | |
| 114 | − } | |
| 111 | + checkasm_check_pixel(dst0, dst_stride, dst1, dst_stride, w + 1, h + 1, "dst"); | |
| 115 | 112 | // Bench only square sizes, and ones with dimensions being a power of two. |
| 116 | 113 | if (w == h && (w & (w - 1)) == 0) |
| 117 | 114 | 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) · 7 unmodified lines | ||
| 125 | 122 | memset(dst1, 0, DST_BUF_SIZE); |
| 126 | 123 | call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos); |
| 127 | 124 | call_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos); |
| 128 | − for (int i = 0; i < (h + 1); i++) { | |
| 129 | − if (memcmp(dst0 + i * dst_stride, dst1 + i * dst_stride, (w + 1) * SIZEOF_PIXEL)) | |
| 130 | − fail(); | |
| 131 | − } | |
| 125 | + checkasm_check_pixel(dst0, dst_stride, dst1, dst_stride, w + 1, h + 1, "dst"); | |
| 132 | 126 | if (w == h && (w & (w - 1)) == 0) |
| 133 | 127 | bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos); |
| 134 | 128 | } |