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
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/checkasm.c42
-rw-r--r--tests/checkasm/checkasm.h6
2 files changed, 34 insertions, 14 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 69cb9d9..ab93a32 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -768,29 +768,39 @@ void checkasm_set_signal_handler_state(const int enabled) {
#endif
}
+static int check_err(const char *const file, const int line,
+ const char *const name, const int w, const int h,
+ int *const err)
+{
+ if (*err)
+ return 0;
+ if (!checkasm_fail_func("%s:%d", file, line))
+ return 1;
+ *err = 1;
+ fprintf(stderr, "%s (%dx%d):\n", name, w, h);
+ return 0;
+}
+
#define DEF_CHECKASM_CHECK_FUNC(type, fmt) \
int checkasm_check_##type(const char *const file, const int line, \
const type *buf1, ptrdiff_t stride1, \
const type *buf2, ptrdiff_t stride2, \
const int w, int h, const char *const name, \
+ const int align_w, const int align_h, \
const int padding) \
{ \
+ int aligned_w = (w + align_w - 1) & ~(align_w - 1); \
+ int aligned_h = (h + align_h - 1) & ~(align_h - 1); \
+ int err = 0; \
stride1 /= sizeof(*buf1); \
stride2 /= sizeof(*buf2); \
int y = 0; \
- for (y = -padding; y < h + padding; y++) \
- if (memcmp(&buf1[y*stride1 - padding], &buf2[y*stride2 - padding], \
- (w + 2*padding)*sizeof(*buf1))) \
- break; \
- if (y == h + padding) \
- return 0; \
- if (!checkasm_fail_func("%s:%d", file, line)) \
- return 1; \
- fprintf(stderr, "%s (%dx%d):\n", name, w, h); \
for (y = 0; y < h; y++) \
if (memcmp(&buf1[y*stride1], &buf2[y*stride2], w*sizeof(*buf1))) \
break; \
if (y != h) { \
+ if (check_err(file, line, name, w, h, &err)) \
+ return 1; \
for (y = 0; y < h; y++) { \
for (int x = 0; x < w; x++) \
fprintf(stderr, " " fmt, buf1[x]); \
@@ -810,28 +820,36 @@ int checkasm_check_##type(const char *const file, const int line, \
for (y = -padding; y < 0; y++) \
if (memcmp(&buf1[y*stride1 - padding], &buf2[y*stride2 - padding], \
(w + 2*padding)*sizeof(*buf1))) { \
+ if (check_err(file, line, name, w, h, &err)) \
+ return 1; \
fprintf(stderr, " overwrite above\n"); \
break; \
} \
- for (y = h; y < h + padding; y++) \
+ for (y = aligned_h; y < aligned_h + padding; y++) \
if (memcmp(&buf1[y*stride1 - padding], &buf2[y*stride2 - padding], \
(w + 2*padding)*sizeof(*buf1))) { \
+ if (check_err(file, line, name, w, h, &err)) \
+ return 1; \
fprintf(stderr, " overwrite below\n"); \
break; \
} \
for (y = 0; y < h; y++) \
if (memcmp(&buf1[y*stride1 - padding], &buf2[y*stride2 - padding], \
padding*sizeof(*buf1))) { \
+ if (check_err(file, line, name, w, h, &err)) \
+ return 1; \
fprintf(stderr, " overwrite left\n"); \
break; \
} \
for (y = 0; y < h; y++) \
- if (memcmp(&buf1[y*stride1 + w], &buf2[y*stride2 + w], \
+ if (memcmp(&buf1[y*stride1 + aligned_w], &buf2[y*stride2 + aligned_w], \
padding*sizeof(*buf1))) { \
+ if (check_err(file, line, name, w, h, &err)) \
+ return 1; \
fprintf(stderr, " overwrite right\n"); \
break; \
} \
- return 1; \
+ return err; \
}
DEF_CHECKASM_CHECK_FUNC(uint8_t, "%02x")
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index b22a9f0..ae51d61 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -322,6 +322,7 @@ int checkasm_check_##type(const char *const file, const int line, \
const type *const buf1, const ptrdiff_t stride1, \
const type *const buf2, const ptrdiff_t stride2, \
const int w, const int h, const char *const name, \
+ const int align_w, const int align_h, \
const int padding)
DECL_CHECKASM_CHECK_FUNC(uint8_t);
@@ -333,11 +334,12 @@ DECL_CHECKASM_CHECK_FUNC(int32_t);
#define CONCAT(a,b) a ## b
#define checkasm_check2(prefix, ...) CONCAT(checkasm_check_, prefix)(__FILE__, __LINE__, __VA_ARGS__)
-#define checkasm_check(prefix, ...) checkasm_check2(prefix, __VA_ARGS__, 0)
+#define checkasm_check(prefix, ...) checkasm_check2(prefix, __VA_ARGS__, 0, 0, 0)
#ifdef BITDEPTH
#define checkasm_check_pixel(...) checkasm_check(PIXEL_TYPE, __VA_ARGS__)
-#define checkasm_check_pixel_padded(...) checkasm_check2(PIXEL_TYPE, __VA_ARGS__, 8)
+#define checkasm_check_pixel_padded(...) checkasm_check2(PIXEL_TYPE, __VA_ARGS__, 1, 1, 8)
+#define checkasm_check_pixel_padded_align(...) checkasm_check2(PIXEL_TYPE, __VA_ARGS__, 8)
#define checkasm_check_coef(...) checkasm_check(COEF_TYPE, __VA_ARGS__)
#endif