PR #22840 opened by Ramiro Polla (ramiro)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22840
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22840.patch


>From 71391c78fb629ea82c96be63e5f3a61e17e3fa17 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Thu, 16 Apr 2026 22:01:59 +0200
Subject: [PATCH 1/3] swscale/tests/swscale: improve help text for -p option

---
 libswscale/tests/swscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 8d500cefce..efbb32000f 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -828,7 +828,7 @@ static int parse_options(int argc, char **argv, struct 
options *opts, FILE **fp)
                     "   -ref <file>\n"
                     "       Uses file as reference to compare tests against. 
Tests that have become worse will contain the string worse or WORSE\n"
                     "   -p <number between 0.0 and 1.0>\n"
-                    "       The percentage of tests or comparisons to perform. 
Doing all tests will take long and generate over a hundred MB text output\n"
+                    "       The proportion of tests or comparisons to 
perform.\n"
                     "       It is often convenient to perform a random 
subset\n"
                     "   -dst <pixfmt>\n"
                     "       Only test the specified destination pixel format\n"
-- 
2.52.0


>From 339b3e6971a9b8a4c338247e7e9017dff526746d Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Thu, 16 Apr 2026 17:16:18 +0200
Subject: [PATCH 2/3] swscale/tests/swscale: fix -p option when -flags and/or
 -unscaled are used

The -p, -flags, and -unscaled options all affected the decision to
select a subsample of the tests to run. When specifying -p 0.1, about
57% of the tests would run instead of the expect 10%.

This commit fixes this by separating -p from -flags and -unscaled.
---
 libswscale/tests/swscale.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index efbb32000f..b00e7555b2 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -682,13 +682,12 @@ static int run_self_tests(const AVFrame *ref, const 
struct options *opts)
                             .dither = opts->dither >= 0 ? opts->dither : 
SWS_DITHER_AUTO,
                         };
 
-                        if (ff_sfc64_get(&prng_state) > UINT64_MAX * 
opts->prob)
-                            continue;
-
-                        ret = run_test(src_fmt, dst_fmt, dst_w[w], dst_h[h],
-                                       &mode, opts, ref, src, NULL);
-                        if (ret < 0)
-                            goto error;
+                        if (ff_sfc64_get(&prng_state) <= UINT64_MAX * 
opts->prob) {
+                            ret = run_test(src_fmt, dst_fmt, dst_w[w], 
dst_h[h],
+                                           &mode, opts, ref, src, NULL);
+                            if (ret < 0)
+                                goto error;
+                        }
 
                         if (opts->flags >= 0 || opts->unscaled)
                             break;
-- 
2.52.0


>From c902c7fc9bebbcfba632707cd8cfef11ea75078d Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Thu, 16 Apr 2026 17:21:48 +0200
Subject: [PATCH 3/3] tests/fate: add fate-sws-unstable test

The fate test for unscaled conversions (fate-sws-unscaled) does not
test the filtering (scaling) paths.

This commit adds a test for the all scaling paths for the new swscale
code, but only runs 10% of the tests (otherwise this test alone could
take close to a minute on a modern x86_64 machine).
---
 tests/fate/libswscale.mak   | 5 +++++
 tests/ref/fate/sws-unstable | 0
 2 files changed, 5 insertions(+)
 create mode 100644 tests/ref/fate/sws-unstable

diff --git a/tests/fate/libswscale.mak b/tests/fate/libswscale.mak
index bd037a83dd..3d1b7ee8fd 100644
--- a/tests/fate/libswscale.mak
+++ b/tests/fate/libswscale.mak
@@ -36,6 +36,11 @@ FATE_LIBSWSCALE-$(CONFIG_UNSTABLE) += fate-sws-unscaled
 fate-sws-unscaled: libswscale/tests/swscale$(EXESUF)
 fate-sws-unscaled: CMD = run libswscale/tests/swscale$(EXESUF) -unscaled 1 
-flags unstable -v 16
 
+# Run only 10% of swscale tests to keep the run time short, and only check for 
failure
+FATE_LIBSWSCALE-$(CONFIG_UNSTABLE) += fate-sws-unstable
+fate-sws-unstable: libswscale/tests/swscale$(EXESUF)
+fate-sws-unstable: CMD = run libswscale/tests/swscale$(EXESUF) -p 0.1 -flags 
unstable -v 16
+
 ifneq ($(HAVE_BIGENDIAN),yes)
 # Disable on big endian because big endian platforms generate different op
 # lists for le vs be formats; this breaks the checksum otherwise
diff --git a/tests/ref/fate/sws-unstable b/tests/ref/fate/sws-unstable
new file mode 100644
index 0000000000..e69de29bb2
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to