diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-02-14 22:14:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-02-15 23:07:44 +0100 |
commit | f7770ec9a4c9f3db3dcc198a390edc8780e1bb89 (patch) | |
tree | a5e6db1770216f744e7ca26c057ddf1f37734ef1 /libswscale/tests/swscale.c | |
parent | 885a802f245430480c0685c3d2c50bf366933570 (diff) | |
download | ffmpeg-f7770ec9a4c9f3db3dcc198a390edc8780e1bb89.tar.gz |
swscale/tests/swscale: Allow comparing a subset of cases to a reference file
Testing all cases exhaustively is slow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/tests/swscale.c')
-rw-r--r-- | libswscale/tests/swscale.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index 07d0af4377..68434fb7ba 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -33,6 +33,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/lfg.h" +#include "libavutil/sfc64.h" #include "libswscale/swscale.h" @@ -56,6 +57,9 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) return desc->flags & AV_PIX_FMT_FLAG_ALPHA; } +static double prob = 1; +FFSFC64 prng_state; + static uint64_t getSSD(const uint8_t *src1, const uint8_t *src2, int stride1, int stride2, int w, int h) { @@ -117,6 +121,9 @@ static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, uint32_t crc = 0; int res = 0; + if (ff_sfc64_get(&prng_state) > UINT64_MAX * prob) + return 0; + if (cur_srcFormat != srcFormat || cur_srcW != srcW || cur_srcH != srcH) { struct SwsContext *srcContext = NULL; int p; @@ -449,6 +456,8 @@ int main(int argc, char **argv) fprintf(stderr, "invalid pixel format %s\n", argv[i + 1]); return -1; } + } else if (!strcmp(argv[i], "-p")) { + prob = atof(argv[i + 1]); } else { bad_option: fprintf(stderr, "bad option or argument missing (%s)\n", argv[i]); @@ -456,6 +465,8 @@ bad_option: } } + ff_sfc64_init(&prng_state, 0, 0, 0, 12); + sws = sws_getContext(W / 12, H / 12, AV_PIX_FMT_RGB32, W, H, AV_PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL); |