summaryrefslogtreecommitdiffstats
path: root/test/tests.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-09 17:56:44 +0200
committerwm4 <wm4@nowhere>2020-05-09 18:02:57 +0200
commitd8002f1dde94771952b301f4ebe331c52bc71871 (patch)
tree446e52500afe9548d4a88b128b32c415c1909972 /test/tests.c
parentd61ced37ae39b4a2dcd49e783f3c292a8d97b14a (diff)
downloadmpv-d8002f1dde94771952b301f4ebe331c52bc71871.tar.bz2
mpv-d8002f1dde94771952b301f4ebe331c52bc71871.tar.xz
video: separate repacking code from zimg and make it independent
For whatever purpose. If anything, this makes the zimg wrapper cleaner. The added tests are not particular exhaustive, but nice to have. This also makes the scale_zimg.c test pretty useless, because it only tests repacking (going through the zimg wrapper). In theory, the repack_tests things could also be used on scalers, but I guess it doesn't matter. Some things are added over the previous zimg wrapper code. For example, some fringe formats can now be expanded to 8 bit per component for convenience.
Diffstat (limited to 'test/tests.c')
-rw-r--r--test/tests.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/tests.c b/test/tests.c
index 9ef88f4a8d..d8df43f319 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -12,6 +12,7 @@ static const struct unittest *unittests[] = {
&test_paths,
&test_repack_sws,
#if HAVE_ZIMG
+ &test_repack, // zimg only due to cross-checking with zimg.c
&test_repack_zimg,
#endif
NULL
@@ -128,3 +129,25 @@ void assert_text_files_equal_impl(const char *file, int line,
abort();
}
}
+
+static void hexdump(const uint8_t *d, size_t size)
+{
+ printf("|");
+ while (size--) {
+ printf(" %02x", d[0]);
+ d++;
+ }
+ printf(" |\n");
+}
+
+void assert_memcmp_impl(const char *file, int line,
+ const void *a, const void *b, size_t size)
+{
+ if (memcmp(a, b, size) == 0)
+ return;
+
+ printf("%s:%d: mismatching data:\n", file, line);
+ hexdump(a, size);
+ hexdump(b, size);
+ abort();
+}