Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-06-29 23:24:42 +0300
committerMartin Storsjö <martin@martin.st>2019-06-30 11:59:36 +0300
commit13a7d78655f8747c2cd01e8a48d44dcc7f60a8e5 (patch)
treef384adca442ed0c696405e6d974150bc0279cc47
parent7107c2f14f8fc522997148e9317171851c69af90 (diff)
checkasm: cdef: Add verbose prints for output data (and relevant input)
For the cdef_filter tests, one could also extend the buffer to contain 16*11 pixels, to simplify printing it as one rectangular section. Extend the common hex_dump function to allow dumping to an arbitrary FILE* pointer, to reuse it for printing the source pixel buffer in case of errors.
-rw-r--r--include/common/dump.h16
-rw-r--r--tests/checkasm/cdef.c17
-rw-r--r--tests/checkasm/checkasm.c9
-rw-r--r--tests/checkasm/checkasm.h2
4 files changed, 32 insertions, 12 deletions
diff --git a/include/common/dump.h b/include/common/dump.h
index 4d2b1ba..9ffab6a 100644
--- a/include/common/dump.h
+++ b/include/common/dump.h
@@ -45,19 +45,25 @@ static inline void append_plane_to_file(const pixel *buf, ptrdiff_t stride,
fclose(f);
}
-static inline void hex_dump(const pixel *buf, ptrdiff_t stride,
- int w, int h, const char *what)
+static inline void hex_fdump(FILE *out, const pixel *buf, ptrdiff_t stride,
+ int w, int h, const char *what)
{
- printf("%s\n", what);
+ fprintf(out, "%s\n", what);
while (h--) {
int x;
for (x = 0; x < w; x++)
- printf(" " PIX_HEX_FMT, buf[x]);
+ fprintf(out, " " PIX_HEX_FMT, buf[x]);
buf += PXSTRIDE(stride);
- printf("\n");
+ fprintf(out, "\n");
}
}
+static inline void hex_dump(const pixel *buf, ptrdiff_t stride,
+ int w, int h, const char *what)
+{
+ hex_fdump(stdout, buf, stride, w, h, what);
+}
+
static inline void coef_dump(const coef *buf, const int w, const int h,
const int len, const char *what)
{
diff --git a/tests/checkasm/cdef.c b/tests/checkasm/cdef.c
index 4d444c5..b88a0a4 100644
--- a/tests/checkasm/cdef.c
+++ b/tests/checkasm/cdef.c
@@ -28,6 +28,9 @@
#include "tests/checkasm/checkasm.h"
#include <string.h>
+#include <stdio.h>
+
+#include "common/dump.h"
#include "src/levels.h"
#include "src/cdef.h"
@@ -80,7 +83,12 @@ static void check_cdef_filter(const cdef_fn fn, const int w, const int h,
(pixel *[2]) { top_ptr, top_ptr + 16 },
pri_strength, sec_strength, dir, damping, edges
HIGHBD_TAIL_SUFFIX);
- if (memcmp(a_src, c_src, (10 * 16 + 8) * sizeof(pixel))) fail();
+ checkasm_check_pixel(c_src, 16 * sizeof(pixel),
+ a_src, 16 * sizeof(pixel),
+ 16, 10, "src");
+ checkasm_check_pixel(c_src + 16 * 10, 16 * sizeof(pixel),
+ a_src + 16 * 10, 16 * sizeof(pixel),
+ 8, 1, "src last row");
bench_new(a_src_ptr, 16 * sizeof(pixel), left,
(pixel *[2]) { top_ptr, top_ptr + 16 },
pri_strength, sec_strength, dir, damping, edges
@@ -108,7 +116,12 @@ static void check_cdef_direction(const cdef_dir_fn fn) {
const int c_dir = call_ref(src, 8 * sizeof(pixel), &c_var HIGHBD_TAIL_SUFFIX);
const int a_dir = call_new(src, 8 * sizeof(pixel), &a_var HIGHBD_TAIL_SUFFIX);
- if (c_var != a_var || c_dir != a_dir) fail();
+ if (c_var != a_var || c_dir != a_dir) {
+ if (fail()) {
+ hex_fdump(stderr, src, 8 * sizeof(pixel), 8, 8, "src");
+ fprintf(stderr, "c_dir %d a_dir %d\n", c_dir, a_dir);
+ }
+ }
bench_new(src, 8 * sizeof(pixel), &a_var HIGHBD_TAIL_SUFFIX);
}
report("cdef_dir");
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 9d94e3d..7f35236 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -629,8 +629,9 @@ int checkasm_bench_func(void) {
state.bench_pattern_len);
}
-/* Indicate that the current test has failed */
-void checkasm_fail_func(const char *const msg, ...) {
+/* Indicate that the current test has failed, return whether verbose printing
+ * is requested. */
+int checkasm_fail_func(const char *const msg, ...) {
if (state.current_func_ver->cpu && state.current_func_ver->ok) {
va_list arg;
@@ -645,6 +646,7 @@ void checkasm_fail_func(const char *const msg, ...) {
state.current_func_ver->ok = 0;
state.num_failed++;
}
+ return state.verbose;
}
/* Update benchmark results of the current function */
@@ -721,8 +723,7 @@ int checkasm_check_##type(const char *const file, const int line, \
break; \
if (y == h) \
return 0; \
- checkasm_fail_func("%s:%d", file, line); \
- if (!state.verbose) \
+ if (!checkasm_fail_func("%s:%d", file, line)) \
return 1; \
fprintf(stderr, "%s:\n", name); \
while (h--) { \
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index e63877c..9c38b79 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -68,7 +68,7 @@ decl_check_bitfns(void checkasm_check_mc);
void *checkasm_check_func(void *func, const char *name, ...);
int checkasm_bench_func(void);
-void checkasm_fail_func(const char *msg, ...);
+int checkasm_fail_func(const char *msg, ...);
void checkasm_update_bench(int iterations, uint64_t cycles);
void checkasm_report(const char *name, ...);
void checkasm_set_signal_handler_state(int enabled);