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

Git pushed a commit to branch master
in repository ffmpeg.

commit 1f020755a93f98969edacb462b4df92177d43b4a
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Oct 28 18:16:55 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Nov 8 00:36:29 2026 +0000

    swscale/uops: always expand clear values to 32 bits
    
    This is backwards compatible, as reading the original pixel type from the
    expanded value gives the same result regardless of endianness.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/uops.c       |  2 +-
 libswscale/uops.h       |  4 ++++
 tests/checkasm/sw_ops.c | 11 ++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libswscale/uops.c b/libswscale/uops.c
index 54d5581107..4f19ee33f0 100644
--- a/libswscale/uops.c
+++ b/libswscale/uops.c
@@ -603,7 +603,7 @@ static int translate_op(SwsContext *ctx, SwsUOpList *uops, 
SwsUOpFlags flags,
             const SwsPixelType type = op->clear.type[i];
             const SwsPixel px = ff_sws_pixel_from_q64(type, v);
             uop.type = pixel_type_to_int(flags, type);
-            uop.data.vec4[i] = px;
+            uop.data.vec4[i] = ff_sws_pixel_expand32(type, px);
             if (v.num == 0)
                 uop.par.clear.zero |= SWS_COMP(i);
             else if (ff_sws_pixel_is_1s(type, px))
diff --git a/libswscale/uops.h b/libswscale/uops.h
index 2a48746fc6..f89ee5ef52 100644
--- a/libswscale/uops.h
+++ b/libswscale/uops.h
@@ -255,6 +255,10 @@ typedef struct SwsPackUOp {
     uint8_t pattern[4]; /* bit depth pattern, from MSB to LSB */
 } SwsPackUOp;
 
+/**
+ * The clear values (SwsUOp.data.vec4) are always expanded to repeating 32-bit
+ * patterns, so they remain valid if the uop is executed as a smaller type.
+ */
 typedef struct SwsClearUOp {
     SwsCompMask one;  /* mask of coefficients equal to all 1s */
     SwsCompMask zero; /* mask of coefficients equal to all 0s */
diff --git a/tests/checkasm/sw_ops.c b/tests/checkasm/sw_ops.c
index 0d17d8bd7d..01d473564d 100644
--- a/tests/checkasm/sw_ops.c
+++ b/tests/checkasm/sw_ops.c
@@ -488,6 +488,15 @@ static void check_vec4(const char *name, SwsUOp *uop)
     check_simple(name, uop);
 }
 
+static void check_clear(const char *name, SwsUOp *uop)
+{
+    /* Clear values are always expanded to 32 bits, see SwsClearUOp */
+    for (int i = 0; i < 4; i++)
+        uop->data.vec4[i] = ff_sws_pixel_expand32(uop->type, rndpx(uop->type));
+
+    check_simple(name, uop);
+}
+
 #define MK_RANGES(R) ((const unsigned[]) { R, R, R, R })
 
 static void check_read(const char *name, SwsUOp *uop)
@@ -715,7 +724,7 @@ void checkasm_check_sw_ops(void)
     CHECK_FOR(PACK,             check_pack);
     CHECK_FOR(LSHIFT,           check_simple);
     CHECK_FOR(RSHIFT,           check_simple);
-    CHECK_FOR(CLEAR,            check_vec4);
+    CHECK_FOR(CLEAR,            check_clear);
     CHECK_FOR(LINEAR,           check_linear);
     CHECK_FOR(DITHER,           check_dither);
     CHECK_FOR(LUT_3D,           check_lut_3d);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to