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

Git pushed a commit to branch master
in repository ffmpeg.

commit 258dbfdbc92dcc1c52a0057e7ae441b38e03484c
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Dec 16 13:12:46 2025 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Dec 20 13:52:45 2025 +0000

    swscale/format: only generate SHIFT ops when needed
    
    Otherwise, we may spuriously generate illegal combinations like
    SWS_OP_LSHIFT on SWS_PIXEL_F32.
---
 libswscale/format.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/libswscale/format.c b/libswscale/format.c
index be03adcdca..9e1121f484 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -935,11 +935,13 @@ int ff_sws_decode_pixfmt(SwsOpList *ops, enum 
AVPixelFormat fmt)
         .swizzle = swizzle_inv(swizzle),
     }));
 
-    RET(ff_sws_op_list_append(ops, &(SwsOp) {
-        .op   = SWS_OP_RSHIFT,
-        .type = pixel_type,
-        .c.u  = shift,
-    }));
+    if (shift) {
+        RET(ff_sws_op_list_append(ops, &(SwsOp) {
+            .op   = SWS_OP_RSHIFT,
+            .type = pixel_type,
+            .c.u  = shift,
+        }));
+    }
 
     RET(ff_sws_op_list_append(ops, &(SwsOp) {
         .op   = SWS_OP_CLEAR,
@@ -962,11 +964,13 @@ int ff_sws_encode_pixfmt(SwsOpList *ops, enum 
AVPixelFormat fmt)
     RET(fmt_analyze(fmt, &rw_op, &pack, &swizzle, &shift,
                     &pixel_type, &raw_type));
 
-    RET(ff_sws_op_list_append(ops, &(SwsOp) {
-        .op   = SWS_OP_LSHIFT,
-        .type = pixel_type,
-        .c.u  = shift,
-    }));
+    if (shift) {
+        RET(ff_sws_op_list_append(ops, &(SwsOp) {
+            .op   = SWS_OP_LSHIFT,
+            .type = pixel_type,
+            .c.u  = shift,
+        }));
+    }
 
     if (rw_op.elems > desc->nb_components) {
         /* Format writes unused alpha channel, clear it explicitly for sanity 
*/

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

Reply via email to