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

Git pushed a commit to branch master
in repository ffmpeg.

commit a0032fb40fef1a8bf83530c5d4f8a294a7782674
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Dec 22 14:58:42 2025 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Wed Dec 24 16:37:22 2025 +0000

    swscale/ops: use switch/case for updating SwsComps ranges
    
    A bit more readable and makes it clear what the special cases are.
---
 libswscale/ops.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index 0b07b21158..2166461b72 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -232,15 +232,17 @@ void ff_sws_op_list_update_comps(SwsOpList *ops)
     for (int n = 0; n < ops->num_ops; n++) {
         SwsOp *op = &ops->ops[n];
 
-        if (op->op != SWS_OP_READ) {
-            /* Prefill min/max values automatically; may have to be fixed in
-             * special cases */
+        switch (op->op) {
+        case SWS_OP_READ:
+        case SWS_OP_LINEAR:
+        case SWS_OP_SWAP_BYTES:
+            break; /* special cases, handled below */
+        default:
             memcpy(op->comps.min, prev.min, sizeof(prev.min));
             memcpy(op->comps.max, prev.max, sizeof(prev.max));
-            if (op->op != SWS_OP_SWAP_BYTES) {
-                ff_sws_apply_op_q(op, op->comps.min);
-                ff_sws_apply_op_q(op, op->comps.max);
-            }
+            ff_sws_apply_op_q(op, op->comps.min);
+            ff_sws_apply_op_q(op, op->comps.max);
+            break;
         }
 
         switch (op->op) {
@@ -275,8 +277,11 @@ void ff_sws_op_list_update_comps(SwsOpList *ops)
             }
             break;
         case SWS_OP_SWAP_BYTES:
-            for (int i = 0; i < 4; i++)
+            for (int i = 0; i < 4; i++) {
                 op->comps.flags[i] = prev.flags[i] ^ SWS_COMP_SWAPPED;
+                op->comps.min[i]   = prev.min[i];
+                op->comps.max[i]   = prev.max[i];
+            }
             break;
         case SWS_OP_WRITE:
             for (int i = 0; i < op->rw.elems; i++)

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

Reply via email to