From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 0E2CA4E82C
	for <ffmpegdev@gitmailbox.com>; Mon, 17 Mar 2025 10:44:11 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A7C516881BA;
	Mon, 17 Mar 2025 12:44:07 +0200 (EET)
Received: from haasn.dev (haasn.dev [78.46.187.166])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0283C687BD0
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 12:44:00 +0200 (EET)
Received: from haasn.dev (unknown [10.30.1.1])
 by haasn.dev (Postfix) with UTF8SMTP id B9FBA406F0;
 Mon, 17 Mar 2025 11:44:00 +0100 (CET)
From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Date: Mon, 17 Mar 2025 11:43:47 +0100
Message-ID: <20250317104357.307832-1-ffmpeg@haasn.xyz>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 01/11] tests/swscale: allow choosing specific
 flags and dither mode
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Niklas Haas <git@haasn.dev>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250317104357.307832-1-ffmpeg@haasn.xyz/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

From: Niklas Haas <git@haasn.dev>

So I can quickly iterate on the new swscale code.
---
 libswscale/tests/swscale.c | 42 ++++++++++++++++++++++++++++----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 2e83197694..0027139154 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -47,6 +47,8 @@ struct options {
     int threads;
     int iters;
     int bench;
+    int flags;
+    int dither;
 };
 
 struct mode {
@@ -54,15 +56,15 @@ struct mode {
     SwsDither dither;
 };
 
-const struct mode modes[] = {
-    { SWS_FAST_BILINEAR },
-    { SWS_BILINEAR },
-    { SWS_BICUBIC },
-    { SWS_X | SWS_BITEXACT },
-    { SWS_POINT },
-    { SWS_AREA | SWS_ACCURATE_RND },
-    { SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP },
-    {0}, // test defaults
+const SwsFlags flags[] = {
+    SWS_FAST_BILINEAR,
+    SWS_BILINEAR,
+    SWS_BICUBIC,
+    SWS_X | SWS_BITEXACT,
+    SWS_POINT,
+    SWS_AREA | SWS_ACCURATE_RND,
+    SWS_BICUBIC | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP,
+    0, // test defaults
 };
 
 static FFSFC64 prng_state;
@@ -277,13 +279,21 @@ static int run_self_tests(const AVFrame *ref, struct options opts)
                 continue;
             for (int h = 0; h < FF_ARRAY_ELEMS(dst_h); h++)
                 for (int w = 0; w < FF_ARRAY_ELEMS(dst_w); w++)
-                    for (int m = 0; m < FF_ARRAY_ELEMS(modes); m++) {
+                    for (int f = 0; f < FF_ARRAY_ELEMS(flags); f++) {
+                        struct mode mode = {
+                            .flags  = opts.flags  >= 0 ? opts.flags  : flags[f],
+                            .dither = opts.dither >= 0 ? opts.dither : SWS_DITHER_AUTO,
+                        };
+
                         if (ff_sfc64_get(&prng_state) > UINT64_MAX * opts.prob)
                             continue;
 
                         if (run_test(src_fmt, dst_fmt, dst_w[w], dst_h[h],
-                                     modes[m], opts, ref, NULL) < 0)
+                                     mode, opts, ref, NULL) < 0)
                             return -1;
+
+                        if (opts.flags >= 0)
+                            break;
                     }
         }
     }
@@ -344,6 +354,8 @@ int main(int argc, char **argv)
         .threads = 1,
         .iters   = 1,
         .prob    = 1.0,
+        .flags   = -1,
+        .dither  = -1,
     };
 
     AVFrame *rgb = NULL, *ref = NULL;
@@ -368,6 +380,10 @@ int main(int argc, char **argv)
                     "       Only test the specified source pixel format\n"
                     "   -bench <iters>\n"
                     "       Run benchmarks with the specified number of iterations. This mode also increases the size of the test images\n"
+                    "   -flags <flags>\n"
+                    "       Test with a specific combination of flags\n"
+                    "   -dither <mode>\n"
+                    "       Test with a specific dither mode\n"
                     "   -threads <threads>\n"
                     "       Use the specified number of threads\n"
                     "   -cpuflags <cpuflags>\n"
@@ -409,6 +425,10 @@ int main(int argc, char **argv)
             opts.iters = FFMAX(opts.iters, 1);
             opts.w = 1920;
             opts.h = 1080;
+        } else if (!strcmp(argv[i], "-flags")) {
+            opts.flags = atoi(argv[i + 1]);
+        } else if (!strcmp(argv[i], "-dither")) {
+            opts.dither = atoi(argv[i + 1]);
         } else if (!strcmp(argv[i], "-threads")) {
             opts.threads = atoi(argv[i + 1]);
         } else if (!strcmp(argv[i], "-p")) {
-- 
2.48.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".