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

Git pushed a commit to branch master
in repository ffmpeg.

commit a76a235c582abbd8bf92dbec66685cfd5363f8e9
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Nov 3 20:48:44 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Nov 8 01:48:12 2026 +0000

    swscale/uops_tmpl: pack the filter weights and size
    
    Instead of punning the size into SwsOpPriv.i32[2], declare a dedicated
    struct for the filter private data.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/uops_tmpl.c | 30 ++++++++++++++++++++----------
 libswscale/uops_tmpl.h |  9 +++++++++
 2 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/libswscale/uops_tmpl.c b/libswscale/uops_tmpl.c
index 42ab8f336c..67a989baa8 100644
--- a/libswscale/uops_tmpl.c
+++ b/libswscale/uops_tmpl.c
@@ -251,8 +251,6 @@ DECL_SETUP(setup_filter_v, params, out)
         return AVERROR(ENOTSUP);
 
     const SwsFilterWeights *filter = params->uop->data.kernel;
-    static_assert(sizeof(out->priv.ptr) <= sizeof(int32_t[2]),
-                  ">8 byte pointers not supported");
 
     /* Pre-convert weights to float */
     float *weights = ff_refstruct_calloc(filter->num_weights, sizeof(float));
@@ -262,8 +260,13 @@ DECL_SETUP(setup_filter_v, params, out)
     for (int i = 0; i < filter->num_weights; i++)
         weights[i] = (float) filter->weights[i] / SWS_FILTER_SCALE;
 
-    out->ref = out->priv.ptr = weights;
-    out->priv.i32[2] = filter->filter_size;
+    const SwsFilterPriv priv = {
+        .weights     = weights,
+        .filter_size = filter->filter_size,
+    };
+
+    SWS_OP_PRIV_PACK(out, priv);
+    out->ref = priv.weights;
     return 0;
 }
 
@@ -272,8 +275,9 @@ DECL_READ(read_planar_fv, const SwsCompMask mask, const 
SwsPixelType type)
 {
     av_assert2(type == SWS_PIXEL_F32);
     const SwsOpExec *exec = iter->exec;
-    const float *restrict weights = impl->priv.ptr;
-    const int filter_size = impl->priv.i32[2];
+    const SwsFilterPriv *priv = (const SwsFilterPriv *) impl->priv.data;
+    const float *restrict weights = priv->weights;
+    const int filter_size = priv->filter_size;
     weights += filter_size * iter->y;
 
     block_t xs, ys, zs, ws;
@@ -316,8 +320,13 @@ DECL_SETUP(setup_filter_h, params, out)
     static_assert(SWS_FILTER_PAD_ROWS >= SWS_BLOCK_SIZE,
                   "filter weights contain sufficient padding for block 
over-read");
 
-    out->ref = out->priv.ptr = av_refstruct_ref(filter->weights);
-    out->priv.i32[2] = filter->filter_size;
+    const SwsFilterPriv priv = {
+        .weights     = av_refstruct_ref(filter->weights),
+        .filter_size = filter->filter_size,
+    };
+
+    SWS_OP_PRIV_PACK(out, priv);
+    out->ref = priv.weights;
     return 0;
 }
 
@@ -326,8 +335,9 @@ DECL_READ(read_planar_fh, const SwsCompMask mask, const 
SwsPixelType type)
 {
     av_assert2(type == SWS_PIXEL_F32);
     const SwsOpExec *exec = iter->exec;
-    const int *restrict weights = impl->priv.ptr;
-    const int filter_size = impl->priv.i32[2];
+    const SwsFilterPriv *priv = (const SwsFilterPriv *) impl->priv.data;
+    const int *restrict weights = priv->weights;
+    const int filter_size = priv->filter_size;
     const float scale = 1.0f / SWS_FILTER_SCALE;
     const int xpos = iter->x;
     weights += filter_size * iter->x;
diff --git a/libswscale/uops_tmpl.h b/libswscale/uops_tmpl.h
index 3d04e7e31d..ba20d5684a 100644
--- a/libswscale/uops_tmpl.h
+++ b/libswscale/uops_tmpl.h
@@ -63,6 +63,15 @@ typedef struct SwsOpIter {
     const SwsOpExec *exec;
 } SwsOpIter;
 
+/* Private data for filtered reads */
+typedef struct SwsFilterPriv {
+    void *weights;
+    int filter_size;
+} SwsFilterPriv;
+
+static_assert(alignof(SwsFilterPriv) <= alignof(SwsOpPriv),
+              "SwsFilterPriv alignment exceeds SwsOpPriv");
+
 /* UBSan checks inside the loop body defeat the vectorizer, so do not ask
  * for it in those builds. Clang warns for every loop otherwise. */
 #if HAVE_UBSAN

-- 
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