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

Git pushed a commit to branch master
in repository ffmpeg.

commit e96332cb65c6103fc5ac66db5f1568e37515b50e
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Jan 9 12:47:55 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Feb 19 19:44:46 2026 +0000

    swscale/ops: add ff_sws_op_list_is_noop()
    
    And use it in ff_sws_compile_pass() instead of hard-coding the check there.
    This check will become more sophisticated in the following commits.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/graph.c |  8 --------
 libswscale/ops.c   | 11 +++++++++++
 libswscale/ops.h   |  6 ++++++
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/libswscale/graph.c b/libswscale/graph.c
index 9d9ca53b00..e47b2d07f2 100644
--- a/libswscale/graph.c
+++ b/libswscale/graph.c
@@ -515,15 +515,7 @@ static int add_convert_pass(SwsGraph *graph, SwsFormat 
src, SwsFormat dst,
     av_log(ctx, AV_LOG_DEBUG, "Unoptimized operation list:\n");
     ff_sws_op_list_print(ctx, AV_LOG_DEBUG, ops);
     av_log(ctx, AV_LOG_DEBUG, "Optimized operation list:\n");
-
     ff_sws_op_list_optimize(ops);
-    if (ops->num_ops == 0) {
-        av_log(ctx, AV_LOG_VERBOSE, "  optimized into memcpy\n");
-        ff_sws_op_list_free(&ops);
-        *output = input;
-        return 0;
-    }
-
     ff_sws_op_list_print(ctx, AV_LOG_VERBOSE, ops);
 
     ret = ff_sws_compile_pass(graph, ops, 0, dst, input, output);
diff --git a/libswscale/ops.c b/libswscale/ops.c
index 83eb8e162e..bb8d0ee7db 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -542,6 +542,11 @@ int ff_sws_op_list_append(SwsOpList *ops, SwsOp *op)
     return ff_sws_op_list_insert_at(ops, ops->num_ops, op);
 }
 
+bool ff_sws_op_list_is_noop(const SwsOpList *ops)
+{
+    return !ops->num_ops;
+}
+
 int ff_sws_op_list_max_size(const SwsOpList *ops)
 {
     int max_size = 0;
@@ -1040,6 +1045,12 @@ int ff_sws_compile_pass(SwsGraph *graph, SwsOpList *ops, 
int flags, SwsFormat ds
     SwsPass *pass;
     int ret;
 
+    /* Check if the whole operation graph is an end-to-end no-op */
+    if (ff_sws_op_list_is_noop(ops)) {
+        *output = input;
+        return 0;
+    }
+
     if (ops->num_ops < 2) {
         av_log(ctx, AV_LOG_ERROR, "Need at least two operations.\n");
         return AVERROR(EINVAL);
diff --git a/libswscale/ops.h b/libswscale/ops.h
index 0db92306a0..ad007be868 100644
--- a/libswscale/ops.h
+++ b/libswscale/ops.h
@@ -242,6 +242,12 @@ void ff_sws_op_list_free(SwsOpList **ops);
  */
 SwsOpList *ff_sws_op_list_duplicate(const SwsOpList *ops);
 
+/**
+ * Returns whether an op list represents a true no-op operation, i.e. may be
+ * eliminated entirely from an execution graph.
+ */
+bool ff_sws_op_list_is_noop(const SwsOpList *ops);
+
 /**
  * Returns the size of the largest pixel type used in `ops`.
  */

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

Reply via email to