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

Git pushed a commit to branch master
in repository ffmpeg.

commit 911176c880e5a277a0350f00db90e19914b8ebe9
Author:     Niklas Haas <[email protected]>
AuthorDate: Sat Mar 7 01:37:23 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Mon Mar 9 12:01:51 2026 +0100

    swscale/ops_dispatch: add SwsCompiledFunc.opaque
    
    Allows compiled functions to opt out of the ops_dispatch execution harness
    altogether and just get dispatched directly as the pass run() function.
    
    Useful in particular for Vulkan.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c |  8 ++++++++
 libswscale/ops_dispatch.h | 20 +++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index 4ad1f2e70b..dd52806750 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -329,6 +329,14 @@ static int compile(SwsGraph *graph, const SwsOpList *ops,
     if (ret < 0)
         goto fail;
 
+    if (p->comp.opaque) {
+        SwsCompiledOp c = p->comp;
+        av_free(p);
+        return ff_sws_graph_add_pass(graph, dst->format, dst->width, 
dst->height,
+                                     input, c.slice_align, c.func_opaque,
+                                     NULL, c.priv, c.free, output);
+    }
+
     const SwsOp *read  = ff_sws_op_list_input(ops);
     const SwsOp *write = ff_sws_op_list_output(ops);
     p->planes_in  = rw_planes(read);
diff --git a/libswscale/ops_dispatch.h b/libswscale/ops_dispatch.h
index 270ff09e31..c2171a406e 100644
--- a/libswscale/ops_dispatch.h
+++ b/libswscale/ops_dispatch.h
@@ -78,13 +78,27 @@ typedef void (*SwsOpFunc)(const SwsOpExec *exec, const void 
*priv,
     void NAME(const SwsOpExec *, const void *, int, int, int, int)
 
 typedef struct SwsCompiledOp {
-    SwsOpFunc func;
-
+    /* Function to execute */
+    union {
+        SwsOpFunc func;
+        SwsPassFunc func_opaque;
+    };
+
+    /**
+     * If `opaque` is true, then `func_opaque`, `priv` and `free` are directly
+     * forwarded as `SwsPass.run`, `SwsPass.priv` and `SwsPass.free`
+     * respectively.
+     */
+    bool opaque;
+
+    /* Execution parameters for all functions */
     int slice_align; /* slice height alignment */
+    int cpu_flags;   /* active set of CPU flags (informative) */
+
+    /* Execution parameters for non-opaque functions only */
     int block_size;  /* number of pixels processed per iteration */
     int over_read;   /* implementation over-reads input by this many bytes */
     int over_write;  /* implementation over-writes output by this many bytes */
-    int cpu_flags;   /* active set of CPU flags (informative) */
 
     /* Arbitrary private data */
     void *priv;

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

Reply via email to