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

Git pushed a commit to branch master
in repository ffmpeg.

commit 902144885740567301d44d2026204ff741e2c728
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Apr 22 18:56:43 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Fri May 15 18:53:05 2026 +0200

    swscale/ops_dispatch: merge ff_sws_ops_compile_backend() and compile()
    
    Passing backend == NULL now loops over the backends as before.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c | 14 +++++++++-----
 libswscale/ops_dispatch.h | 14 ++++----------
 tests/checkasm/sw_ops.c   |  4 ++--
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index 37daf95b43..fa60888272 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -54,8 +54,8 @@ typedef struct SwsOpPass {
     unsigned int tail_buf_size;
 } SwsOpPass;
 
-int ff_sws_ops_compile_backend(SwsContext *ctx, const SwsOpBackend *backend,
-                               const SwsOpList *ops, SwsCompiledOp *out)
+static int compile_backend(SwsContext *ctx, const SwsOpBackend *backend,
+                           const SwsOpList *ops, SwsCompiledOp *out)
 {
     SwsOpList *copy;
     SwsCompiledOp compiled = {0};
@@ -90,14 +90,18 @@ fail:
     return ret;
 }
 
-int ff_sws_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp 
*out)
+int ff_sws_ops_compile(SwsContext *ctx, const SwsOpBackend *backend,
+                       const SwsOpList *ops, SwsCompiledOp *out)
 {
+    if (backend)
+        return compile_backend(ctx, backend, ops, out);
+
     for (int n = 0; ff_sws_op_backends[n]; n++) {
         const SwsOpBackend *backend = ff_sws_op_backends[n];
         if (ops->src.hw_format != backend->hw_format ||
             ops->dst.hw_format != backend->hw_format)
             continue;
-        if (ff_sws_ops_compile_backend(ctx, backend, ops, out) < 0)
+        if (compile_backend(ctx, backend, ops, out) < 0)
             continue;
 
         return 0;
@@ -474,7 +478,7 @@ static int compile(SwsGraph *graph, const SwsOpList *ops, 
SwsPass *input,
     if (!p)
         return AVERROR(ENOMEM);
 
-    int ret = ff_sws_ops_compile(ctx, ops, &p->comp);
+    int ret = ff_sws_ops_compile(ctx, NULL, ops, &p->comp);
     if (ret < 0)
         goto fail;
 
diff --git a/libswscale/ops_dispatch.h b/libswscale/ops_dispatch.h
index 715f51139d..d5c5c4ecb7 100644
--- a/libswscale/ops_dispatch.h
+++ b/libswscale/ops_dispatch.h
@@ -150,19 +150,13 @@ typedef struct SwsOpBackend {
 extern const SwsOpBackend *const ff_sws_op_backends[];
 
 /**
- * Attempt to compile a list of operations using a specific backend.
+ * Attempt to compile a list of operations using a specific backend, or
+ * the best available backend if `backend` is NULL.
  *
  * Returns 0 on success, or a negative error code on failure.
  */
-int ff_sws_ops_compile_backend(SwsContext *ctx, const SwsOpBackend *backend,
-                               const SwsOpList *ops, SwsCompiledOp *out);
-
-/**
- * Compile a list of operations using the best available backend.
- *
- * Returns 0 on success, or a negative error code on failure.
- */
-int ff_sws_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp 
*out);
+int ff_sws_ops_compile(SwsContext *ctx, const SwsOpBackend *backend,
+                       const SwsOpList *ops, SwsCompiledOp *out);
 
 /**
  * Resolves an operation list to a graph pass. The first and last operations
diff --git a/tests/checkasm/sw_ops.c b/tests/checkasm/sw_ops.c
index 82415574f4..1dc7d1f528 100644
--- a/tests/checkasm/sw_ops.c
+++ b/tests/checkasm/sw_ops.c
@@ -297,7 +297,7 @@ static void check_ops(const char *name, const unsigned 
ranges[NB_PLANES],
 
     /* Always compile `ops` using the C backend as a reference */
     SwsCompiledOp comp_ref = {0};
-    int ret = ff_sws_ops_compile_backend(ctx, backend_ref, &oplist, &comp_ref);
+    int ret = ff_sws_ops_compile(ctx, backend_ref, &oplist, &comp_ref);
     if (ret < 0) {
         av_assert0(ret != AVERROR(ENOTSUP));
         fail();
@@ -316,7 +316,7 @@ static void check_ops(const char *name, const unsigned 
ranges[NB_PLANES],
         }
 
         SwsCompiledOp comp_new = {0};
-        int ret = ff_sws_ops_compile_backend(ctx, backend, &oplist, &comp_new);
+        int ret = ff_sws_ops_compile(ctx, backend, &oplist, &comp_new);
         if (ret == AVERROR(ENOTSUP)) {
             continue;
         } else if (ret < 0) {

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

Reply via email to