History

checkasm: hevc_pel: Use checkasm_check for printing failing output

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 2 years ago

Commit 8ff4a4a1 parent 3ad3ada1 file · +41 −30Browse files

Unified · Split

tests/checkasm/hevc_pel.c+41−30
@@ -36,6 +36,15 @@ static const int offsets[] = {0, 255, -1 }; · 35 unmodified lines
36#define SIZEOF_PIXEL ((bit_depth + 7) / 8)36#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
37#define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE))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
39#define randomize_buffers() \48#define randomize_buffers() \
40 do { \49 do { \
41 uint32_t mask = pixel_mask[bit_depth - 8]; \50 uint32_t mask = pixel_mask[bit_depth - 8]; \
@@ -78,7 +87,7 @@ static void checkasm_check_hevc_qpel(void) · 36 unmodified lines
78 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);87 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
79 88
80 HEVCDSPContext h;89 HEVCDSPContext h;
81 int size, bit_depth, i, j, row;90 int size, bit_depth, i, j;
82 declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,91 declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
83 int height, intptr_t mx, intptr_t my, int width);92 int height, intptr_t mx, intptr_t my, int width);
84 93
@@ -102,12 +111,9 @@ static void checkasm_check_hevc_qpel(void) · 17 unmodified lines
102 randomize_buffers();111 randomize_buffers();
103 call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);112 call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
104 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);113 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
105 for (row = 0; row < size[sizes]; row++) {114 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
106 if (memcmp(dstw0 + row * MAX_PB_SIZE,115 dstw1, MAX_PB_SIZE * sizeof(int16_t),
107 dstw1 + row * MAX_PB_SIZE,116 size[sizes], size[sizes], "dst");
108 sizes[size] * sizeof(int16_t)))
109 fail();
110 }
111 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);117 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
112 }118 }
113 }119 }
@@ -152,8 +158,9 @@ static void checkasm_check_hevc_qpel_uni(void) · 38 unmodified lines
152 call_new(dst1, sizes[size] * SIZEOF_PIXEL,158 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
153 src1, sizes[size] * SIZEOF_PIXEL,159 src1, sizes[size] * SIZEOF_PIXEL,
154 sizes[size], i, j, sizes[size]);160 sizes[size], i, j, sizes[size]);
155 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))161 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
156 fail();162 dst1, sizes[size] * SIZEOF_PIXEL,
163 size[sizes], size[sizes], "dst");
157 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,164 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
158 src1, sizes[size] * SIZEOF_PIXEL,165 src1, sizes[size] * SIZEOF_PIXEL,
159 sizes[size], i, j, sizes[size]);166 sizes[size], i, j, sizes[size]);
@@ -204,8 +211,9 @@ static void checkasm_check_hevc_qpel_uni_w(void) · 44 unmodified lines
204 call_new(dst1, sizes[size] * SIZEOF_PIXEL,211 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
205 src1, sizes[size] * SIZEOF_PIXEL,212 src1, sizes[size] * SIZEOF_PIXEL,
206 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);213 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
207 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))214 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
208 fail();215 dst1, sizes[size] * SIZEOF_PIXEL,
216 size[sizes], size[sizes], "dst");
209 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,217 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
210 src1, sizes[size] * SIZEOF_PIXEL,218 src1, sizes[size] * SIZEOF_PIXEL,
211 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);219 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
@@ -258,8 +266,9 @@ static void checkasm_check_hevc_qpel_bi(void) · 46 unmodified lines
258 call_new(dst1, sizes[size] * SIZEOF_PIXEL,266 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
259 src1, sizes[size] * SIZEOF_PIXEL,267 src1, sizes[size] * SIZEOF_PIXEL,
260 ref1, sizes[size], i, j, sizes[size]);268 ref1, sizes[size], i, j, sizes[size]);
261 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))269 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
262 fail();270 dst1, sizes[size] * SIZEOF_PIXEL,
271 size[sizes], size[sizes], "dst");
263 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,272 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
264 src1, sizes[size] * SIZEOF_PIXEL,273 src1, sizes[size] * SIZEOF_PIXEL,
265 ref1, sizes[size], i, j, sizes[size]);274 ref1, sizes[size], i, j, sizes[size]);
@@ -314,8 +323,9 @@ static void checkasm_check_hevc_qpel_bi_w(void) · 48 unmodified lines
314 call_new(dst1, sizes[size] * SIZEOF_PIXEL,323 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
315 src1, sizes[size] * SIZEOF_PIXEL,324 src1, sizes[size] * SIZEOF_PIXEL,
316 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);325 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
317 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))326 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
318 fail();327 dst1, sizes[size] * SIZEOF_PIXEL,
328 size[sizes], size[sizes], "dst");
319 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,329 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
320 src1, sizes[size] * SIZEOF_PIXEL,330 src1, sizes[size] * SIZEOF_PIXEL,
321 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);331 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
@@ -341,7 +351,7 @@ static void checkasm_check_hevc_epel(void) · 19 unmodified lines
341 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);351 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
342 352
343 HEVCDSPContext h;353 HEVCDSPContext h;
344 int size, bit_depth, i, j, row;354 int size, bit_depth, i, j;
345 declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,355 declare_func(void, int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
346 int height, intptr_t mx, intptr_t my, int width);356 int height, intptr_t mx, intptr_t my, int width);
347 357
@@ -365,12 +375,9 @@ static void checkasm_check_hevc_epel(void) · 17 unmodified lines
365 randomize_buffers();375 randomize_buffers();
366 call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);376 call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
367 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);377 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
368 for (row = 0; row < size[sizes]; row++) {378 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
369 if (memcmp(dstw0 + row * MAX_PB_SIZE,379 dstw1, MAX_PB_SIZE * sizeof(int16_t),
370 dstw1 + row * MAX_PB_SIZE,380 size[sizes], size[sizes], "dst");
371 sizes[size] * sizeof(int16_t)))
372 fail();
373 }
374 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);381 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
375 }382 }
376 }383 }
@@ -415,8 +422,9 @@ static void checkasm_check_hevc_epel_uni(void) · 38 unmodified lines
415 call_new(dst1, sizes[size] * SIZEOF_PIXEL,422 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
416 src1, sizes[size] * SIZEOF_PIXEL,423 src1, sizes[size] * SIZEOF_PIXEL,
417 sizes[size], i, j, sizes[size]);424 sizes[size], i, j, sizes[size]);
418 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))425 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
419 fail();426 dst1, sizes[size] * SIZEOF_PIXEL,
427 size[sizes], size[sizes], "dst");
420 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,428 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
421 src1, sizes[size] * SIZEOF_PIXEL,429 src1, sizes[size] * SIZEOF_PIXEL,
422 sizes[size], i, j, sizes[size]);430 sizes[size], i, j, sizes[size]);
@@ -467,8 +475,9 @@ static void checkasm_check_hevc_epel_uni_w(void) · 44 unmodified lines
467 call_new(dst1, sizes[size] * SIZEOF_PIXEL,475 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
468 src1, sizes[size] * SIZEOF_PIXEL,476 src1, sizes[size] * SIZEOF_PIXEL,
469 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);477 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
470 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))478 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
471 fail();479 dst1, sizes[size] * SIZEOF_PIXEL,
480 size[sizes], size[sizes], "dst");
472 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,481 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
473 src1, sizes[size] * SIZEOF_PIXEL,482 src1, sizes[size] * SIZEOF_PIXEL,
474 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);483 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
@@ -521,8 +530,9 @@ static void checkasm_check_hevc_epel_bi(void) · 46 unmodified lines
521 call_new(dst1, sizes[size] * SIZEOF_PIXEL,530 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
522 src1, sizes[size] * SIZEOF_PIXEL,531 src1, sizes[size] * SIZEOF_PIXEL,
523 ref1, sizes[size], i, j, sizes[size]);532 ref1, sizes[size], i, j, sizes[size]);
524 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))533 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
525 fail();534 dst1, sizes[size] * SIZEOF_PIXEL,
535 size[sizes], size[sizes], "dst");
526 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,536 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
527 src1, sizes[size] * SIZEOF_PIXEL,537 src1, sizes[size] * SIZEOF_PIXEL,
528 ref1, sizes[size], i, j, sizes[size]);538 ref1, sizes[size], i, j, sizes[size]);
@@ -577,8 +587,9 @@ static void checkasm_check_hevc_epel_bi_w(void) · 48 unmodified lines
577 call_new(dst1, sizes[size] * SIZEOF_PIXEL,587 call_new(dst1, sizes[size] * SIZEOF_PIXEL,
578 src1, sizes[size] * SIZEOF_PIXEL,588 src1, sizes[size] * SIZEOF_PIXEL,
579 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);589 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
580 if (memcmp(dst0, dst1, sizes[size] * sizes[size] * SIZEOF_PIXEL))590 checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
581 fail();591 dst1, sizes[size] * SIZEOF_PIXEL,
592 size[sizes], size[sizes], "dst");
582 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,593 bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
583 src1, sizes[size] * SIZEOF_PIXEL,594 src1, sizes[size] * SIZEOF_PIXEL,
584 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);595 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);

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