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

Git pushed a commit to branch master
in repository ffmpeg.

commit 9662d1fa970b89429a9ada9627aea6c4eef37753
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Feb 4 14:49:01 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Feb 19 19:44:46 2026 +0000

    swscale/optimizer: remove read+write optimization
    
    This optimization is lossy, since it removes important information about the
    number of planes to be copied. Subsumed by the more correct
    
    Instead, move this code to the new ff_sws_op_list_is_noop().
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c           | 16 +++++++++++++++-
 libswscale/ops_optimizer.c | 11 -----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index bb8d0ee7db..caba6b85e3 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -544,7 +544,21 @@ int ff_sws_op_list_append(SwsOpList *ops, SwsOp *op)
 
 bool ff_sws_op_list_is_noop(const SwsOpList *ops)
 {
-    return !ops->num_ops;
+    if (!ops->num_ops)
+        return true;
+
+    const SwsOp *read  = &ops->ops[0];
+    const SwsOp *write = &ops->ops[1];
+    if (ops->num_ops != 2 ||
+        read->op != SWS_OP_READ ||
+        write->op != SWS_OP_WRITE ||
+        read->type != write->type ||
+        read->rw.packed != write->rw.packed ||
+        read->rw.elems != write->rw.elems ||
+        read->rw.frac != write->rw.frac)
+        return false;
+
+    return true;
 }
 
 int ff_sws_op_list_max_size(const SwsOpList *ops)
diff --git a/libswscale/ops_optimizer.c b/libswscale/ops_optimizer.c
index 11ee40e268..8b5a5c8e31 100644
--- a/libswscale/ops_optimizer.c
+++ b/libswscale/ops_optimizer.c
@@ -273,17 +273,6 @@ retry:
 
         switch (op->op) {
         case SWS_OP_READ:
-            /* Optimized further into refcopy / memcpy */
-            if (next->op == SWS_OP_WRITE &&
-                next->rw.elems == op->rw.elems &&
-                next->rw.packed == op->rw.packed &&
-                next->rw.frac == op->rw.frac)
-            {
-                ff_sws_op_list_remove_at(ops, n, 2);
-                av_assert1(ops->num_ops == 0);
-                return 0;
-            }
-
             /* Skip reading extra unneeded components */
             if (!op->rw.packed) {
                 int needed = op->rw.elems;

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

Reply via email to