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

Git pushed a commit to branch master
in repository ffmpeg.

commit d1eaea1a037c58b6abc112e97da07735096eedab
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Dec 16 00:33:30 2025 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Dec 20 13:52:45 2025 +0000

    swscale/ops: add type assertions to ff_sws_apply_op_q()
---
 libswscale/ops.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index f33dd02a37..9bbbfc50ca 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -114,21 +114,24 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational x[4])
     case SWS_OP_WRITE:
         return;
     case SWS_OP_UNPACK: {
-        unsigned val = x[0].num;
+        av_assert1(ff_sws_pixel_type_is_int(op->type));
         ff_sws_pack_op_decode(op, mask, shift);
+        unsigned val = x[0].num;
         for (int i = 0; i < 4; i++)
             x[i] = Q((val >> shift[i]) & mask[i]);
         return;
     }
     case SWS_OP_PACK: {
-        unsigned val = 0;
+        av_assert1(ff_sws_pixel_type_is_int(op->type));
         ff_sws_pack_op_decode(op, mask, shift);
+        unsigned val = 0;
         for (int i = 0; i < 4; i++)
             val |= (x[i].num & mask[i]) << shift[i];
         x[0] = Q(val);
         return;
     }
     case SWS_OP_SWAP_BYTES:
+        av_assert1(ff_sws_pixel_type_is_int(op->type));
         switch (ff_sws_pixel_type_size(op->type)) {
         case 2:
             for (int i = 0; i < 4; i++)
@@ -147,12 +150,14 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational x[4])
         }
         return;
     case SWS_OP_LSHIFT: {
+        av_assert1(ff_sws_pixel_type_is_int(op->type));
         AVRational mult = Q(1 << op->c.u);
         for (int i = 0; i < 4; i++)
             x[i] = x[i].den ? av_mul_q(x[i], mult) : x[i];
         return;
     }
     case SWS_OP_RSHIFT: {
+        av_assert1(ff_sws_pixel_type_is_int(op->type));
         AVRational mult = Q(1 << op->c.u);
         for (int i = 0; i < 4; i++)
             x[i] = x[i].den ? av_div_q(x[i], mult) : x[i];
@@ -175,6 +180,7 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational x[4])
         }
         return;
     case SWS_OP_DITHER:
+        av_assert1(!ff_sws_pixel_type_is_int(op->type));
         for (int i = 0; i < 4; i++)
             x[i] = x[i].den ? av_add_q(x[i], av_make_q(1, 2)) : x[i];
         return;
@@ -187,6 +193,7 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational x[4])
             x[i] = av_max_q(x[i], op->c.q4[i]);
         return;
     case SWS_OP_LINEAR: {
+        av_assert1(!ff_sws_pixel_type_is_int(op->type));
         const AVRational orig[4] = { x[0], x[1], x[2], x[3] };
         for (int i = 0; i < 4; i++) {
             AVRational sum = op->lin.m[i][4];

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

Reply via email to