History

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.

Martin Storsjö committed 1 year ago

Commit 47b1e1b1 parent 4a2fb173 files · +14 −17Browse files

Unified · Split

3 files
  1. tests/checkasm/checkasm.h +12 −0
  2. tests/checkasm/hevc_pel.c +0 −9
  3. tests/checkasm/vvc_alf.c +2 −8
tests/checkasm/checkasm.h+12−0
@@ -392,4 +392,16 @@ DECL_CHECKASM_CHECK_FUNC(int32_t); · 391 unmodified lines
392392
393393 #define checkasm_check(prefix, ...) CONCAT(checkasm_check_, prefix)(__FILE__, __LINE__, __VA_ARGS__)
394394
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+
395407 #endif /* TESTS_CHECKASM_CHECKASM_H */
tests/checkasm/hevc_pel.c+0−9
@@ -36,15 +36,6 @@ static const int offsets[] = {0, 255, -1 }; · 35 unmodified lines
3636 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
3737 #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE))
3838
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−
4839 #define randomize_buffers() \
4940 do { \
5041 uint32_t mask = pixel_mask[bit_depth - 8]; \
tests/checkasm/vvc_alf.c+2−8
@@ -108,10 +108,7 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth) · 107 unmodified lines
108108 memset(dst1, 0, DST_BUF_SIZE);
109109 call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
110110 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");
115112 // Bench only square sizes, and ones with dimensions being a power of two.
116113 if (w == h && (w & (w - 1)) == 0)
117114 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
125122 memset(dst1, 0, DST_BUF_SIZE);
126123 call_ref(dst0, dst_stride, src0 + offset, src_stride, w, h, filter, clip, vb_pos);
127124 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");
132126 if (w == h && (w & (w - 1)) == 0)
133127 bench_new(dst1, dst_stride, src1 + offset, src_stride, w, h, filter, clip, vb_pos);
134128 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t