This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 1d841635a4a54237a17cca8776532fb1c7144adf
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue May 5 19:15:42 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Fri May 15 18:53:05 2026 +0200

    swscale/ops: also include scaling ops in ff_sws_enum_op_lists()
    
    Using the configured scaler from the SwsContext implicitly. This does affect
    the output of libswscale/tests/sws_ops.c, which now prints about 4x as much
    data (taking roughly 4x as long, but still within a second on my machine).
    
    We can make this process a lot faster by forcing SWS_SCALE_POINT as the
    scaler, which skips calculating any actual filter weights in favor of
    generating a trivial 1-tap filter.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c            | 50 ++++++++++++++++++++++++++++++---------------
 libswscale/tests/sws_ops.c  |  7 +++++--
 tests/ref/fate/sws-ops-list |  2 +-
 3 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index 53baaee13a..7a313dfa3b 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -1009,31 +1009,47 @@ void ff_sws_op_list_print(void *log, int lev, int 
lev_extra,
     av_log(log, lev, "    (X = unused, z = byteswapped, + = exact, 0 = 
zero)\n");
 }
 
+#define DUMMY_SIZE 16
+
 static int enum_ops_fmt(SwsContext *ctx, void *opaque,
                         enum AVPixelFormat src_fmt, enum AVPixelFormat dst_fmt,
                         int (*cb)(SwsContext *ctx, void *opaque, SwsOpList 
*ops))
 {
+    int ret = 0;
+    SwsOpList *ops = NULL;
     SwsFormat src, dst;
     ff_fmt_from_pixfmt(src_fmt, &src);
     ff_fmt_from_pixfmt(dst_fmt, &dst);
     bool incomplete = ff_infer_colors(&src.color, &dst.color);
-    src.width  = dst.width  = 16;
-    src.height = dst.height = 16;
-
-    SwsOpList *ops;
-    int ret = ff_sws_op_list_generate(ctx, &src, &dst, &ops, &incomplete);
-    if (ret == AVERROR(ENOTSUP))
-        return 0; /* silently skip unsupported formats */
-    else if (ret < 0)
-        return ret;
-
-    ret = ff_sws_op_list_optimize(ops);
-    if (ret < 0)
-        goto fail;
-
-    ret = cb(ctx, opaque, ops);
-    if (ret < 0)
-        goto fail;
+    src.width = src.height = DUMMY_SIZE;
+
+    static const int dst_sizes[][2] = {
+        { DUMMY_SIZE,     DUMMY_SIZE     },
+        { DUMMY_SIZE,     DUMMY_SIZE * 2 },
+        { DUMMY_SIZE * 2, DUMMY_SIZE     },
+        { DUMMY_SIZE * 2, DUMMY_SIZE * 2 },
+    };
+
+    for (int i = 0; i < FF_ARRAY_ELEMS(dst_sizes); i++) {
+        dst.width  = dst_sizes[i][0];
+        dst.height = dst_sizes[i][1];
+
+        ret = ff_sws_op_list_generate(ctx, &src, &dst, &ops, &incomplete);
+        if (ret == AVERROR(ENOTSUP))
+            return 0; /* silently skip unsupported formats */
+        else if (ret < 0)
+            return ret;
+
+        ret = ff_sws_op_list_optimize(ops);
+        if (ret < 0)
+            goto fail;
+
+        ret = cb(ctx, opaque, ops);
+        if (ret < 0)
+            goto fail;
+
+        ff_sws_op_list_free(&ops);
+    }
 
 fail:
     ff_sws_op_list_free(&ops);
diff --git a/libswscale/tests/sws_ops.c b/libswscale/tests/sws_ops.c
index 1256c73ec6..0bf4f17d23 100644
--- a/libswscale/tests/sws_ops.c
+++ b/libswscale/tests/sws_ops.c
@@ -33,9 +33,11 @@
 
 static int print_ops(SwsContext *const ctx, void *opaque, SwsOpList *ops)
 {
-    av_log(opaque, AV_LOG_INFO, "%s -> %s:\n",
+    av_log(opaque, AV_LOG_INFO, "%s %dx%d -> %s %dx%d:\n",
            av_get_pix_fmt_name(ops->src.format),
-           av_get_pix_fmt_name(ops->dst.format));
+           ops->src.width, ops->src.height,
+           av_get_pix_fmt_name(ops->dst.format),
+           ops->dst.width, ops->dst.height);
 
     if (ff_sws_op_list_is_noop(ops))
         av_log(opaque, AV_LOG_INFO, "  (no-op)\n");
@@ -183,6 +185,7 @@ bad_option:
     SwsContext *ctx = sws_alloc_context();
     if (!ctx)
         goto fail;
+    ctx->scaler = SWS_SCALE_POINT; /* reduce filter generation overhead */
 
     av_log_set_callback(log_stdout);
 
diff --git a/tests/ref/fate/sws-ops-list b/tests/ref/fate/sws-ops-list
index 0dc23800a6..6411980b41 100644
--- a/tests/ref/fate/sws-ops-list
+++ b/tests/ref/fate/sws-ops-list
@@ -1 +1 @@
-374319dfd2b74cb5b69dac68b627fa9b
+e8d02618e7d3d275e65e9adb8499e6a7

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

Reply via email to