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

Git pushed a commit to branch master
in repository ffmpeg.

commit 33d183a4735f170d91456e0ce59ebcaf4b4a9480
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Jun 12 12:14:25 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Tue Jul 14 12:24:01 2026 +0000

    swscale/ops_dispatch: add SwsOpBackend.compile_uops()
    
    This can be used as an alternative to the existing compile() backend, that
    takes SwsUOpList instead of SwsOpList.
    
    Down the line, I plan on also moving the uops translation to the dispatch
    layer itself, but this requires some further changes which have not yet
    been merged, so this commit represents a stopgap solution.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.h |  6 ++++++
 libswscale/uops_backend.c | 40 +++++++++++++++++++++++-----------------
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/libswscale/ops_dispatch.h b/libswscale/ops_dispatch.h
index 584e2a123e..f88ba63825 100644
--- a/libswscale/ops_dispatch.h
+++ b/libswscale/ops_dispatch.h
@@ -25,6 +25,7 @@
 
 #include "libavutil/frame.h"
 #include "graph.h"
+#include "uops.h"
 
 /**
  * Global execution context for all compiled functions.
@@ -141,6 +142,11 @@ typedef struct SwsOpBackend {
      */
     int (*compile)(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out);
 
+    /**
+     * Alternative to `compile` that takes a list of micro-ops directly.
+     */
+    int (*compile_uops)(SwsContext *ctx, const SwsUOpList *uops, SwsCompiledOp 
*out);
+
     /**
      * If NONE, backend only supports software frames.
      * Otherwise, frame hardware format must match hw_format for the backend
diff --git a/libswscale/uops_backend.c b/libswscale/uops_backend.c
index 69d607c958..d0d05ee42f 100644
--- a/libswscale/uops_backend.c
+++ b/libswscale/uops_backend.c
@@ -135,7 +135,7 @@ static void process(const SwsOpExec *exec, const void *priv,
     }
 }
 
-static int compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
+static int compile_uops_c(SwsContext *ctx, const SwsUOpList *uops, 
SwsCompiledOp *out)
 {
     int ret;
 
@@ -143,16 +143,6 @@ static int compile(SwsContext *ctx, const SwsOpList *ops, 
SwsCompiledOp *out)
     if (!chain)
         return AVERROR(ENOMEM);
 
-    SwsUOpList *uops = ff_sws_uop_list_alloc();
-    if (!uops) {
-        ret = AVERROR(ENOMEM);
-        goto fail;
-    }
-
-    ret = ff_sws_ops_translate(ctx, ops, 0, uops);
-    if (ret < 0)
-        goto fail;
-
     av_assert0(uops->num_ops > 0);
     for (int i = 0; i < uops->num_ops; i++) {
         const SwsUOpTable *table = &uop_table;
@@ -181,18 +171,34 @@ static int compile(SwsContext *ctx, const SwsOpList *ops, 
SwsCompiledOp *out)
         av_log(ctx, AV_LOG_DEBUG, "    %s\n", name);
     }
 
-    ff_sws_uop_list_free(&uops);
     return 0;
 
 fail:
-    ff_sws_uop_list_free(&uops);
     ff_sws_op_chain_free(chain);
     return ret;
 }
 
+static int compile_c(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out)
+{
+    SwsUOpList *uops = ff_sws_uop_list_alloc();
+    if (!uops)
+        return AVERROR(ENOMEM);
+
+    int ret = ff_sws_ops_translate(ctx, ops, 0, uops);
+    if (ret < 0)
+        goto fail;
+
+    ret = compile_uops_c(ctx, uops, out);
+
+fail:
+    ff_sws_uop_list_free(&uops);
+    return ret;
+}
+
 const SwsOpBackend backend_c = {
-    .name       = "c",
-    .flags      = SWS_BACKEND_C,
-    .compile    = compile,
-    .hw_format  = AV_PIX_FMT_NONE,
+    .name           = "c",
+    .flags          = SWS_BACKEND_C,
+    .compile        = compile_c,
+    .compile_uops   = compile_uops_c,
+    .hw_format      = AV_PIX_FMT_NONE,
 };

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

Reply via email to