summaryrefslogtreecommitdiffstats
path: root/test/img_format.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-09 01:50:46 +0100
committerwm4 <wm4@nowhere>2019-11-09 01:55:13 +0100
commit94d853d3a3ce20593be15359fbd49e30865dabeb (patch)
tree3f055020b5c15f93e525c9cf497aaf543d0374b8 /test/img_format.c
parent27d88e4a9b56fcda82ed1113deae654d731930d2 (diff)
downloadmpv-94d853d3a3ce20593be15359fbd49e30865dabeb.tar.bz2
mpv-94d853d3a3ce20593be15359fbd49e30865dabeb.tar.xz
test: add tests for zimg RGB repacking
This tests the RGB repacker code in zimg, which deserves to be tested because it's tricky and there will be more formats. scale_test.c contains some code that can be used to test any scaler. Or at least that would be great; currently it can only test repacking of some byte-aligned-component RGB formats. It should be called repack_test.c, but I'm too lazy to change the filename now. The idea is that libswscale is used to cross-check the conversions performed by the zimg wrapper. This is why it's "OK" that scale_test.c does libswscale calls. scale_sws.c is the equivalent to scale_zimg.c, and is of course worthless (because it tests libswscale by comparing the results with libswscale), but still might help with finding bugs in scale_test.c. This borrows a sorted list of image formats from test/img_format.c, for the same reason that file sorts them. There's a slight possibility that this can be used to test vo_gpu.c too some times in the future.
Diffstat (limited to 'test/img_format.c')
-rw-r--r--test/img_format.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/img_format.c b/test/img_format.c
index ff3af4c005..cf5bbb3af2 100644
--- a/test/img_format.c
+++ b/test/img_format.c
@@ -7,8 +7,9 @@
#include "video/mp_image.h"
#include "video/sws_utils.h"
-static int imgfmts[IMGFMT_AVPIXFMT_END - IMGFMT_AVPIXFMT_START + 100];
-static int num_imgfmts;
+int imgfmts[IMGFMT_AVPIXFMT_END - IMGFMT_AVPIXFMT_START + 100];
+int num_imgfmts;
+
static enum AVPixelFormat pixfmt_unsup[100];
static int num_pixfmt_unsup;
static bool imgfmts_initialized;
@@ -21,7 +22,7 @@ static int cmp_imgfmt_name(const void *a, const void *b)
return strcmp(name_a, name_b);
}
-static void find_all_imgfmts(void)
+void init_imgfmts_list(void)
{
if (imgfmts_initialized)
return;
@@ -61,7 +62,7 @@ static const char *comp_type(enum mp_component_type type)
static void run(struct test_ctx *ctx)
{
- find_all_imgfmts();
+ init_imgfmts_list();
FILE *f = test_open_out(ctx, "img_formats.txt");