From d8002f1dde94771952b301f4ebe331c52bc71871 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2020 17:56:44 +0200 Subject: 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. --- test/tests.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/tests.c') 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(); +} -- cgit v1.2.3