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

Git pushed a commit to branch master
in repository ffmpeg.

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

    swscale/uops_tmpl: pack pointer private data
    
    Introduce a new helper to pack a pointer and store it as a ref.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_chain.h |  7 +++++++
 libswscale/uops_tmpl.c | 13 +++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h
index 5a051e776e..3b1d39997e 100644
--- a/libswscale/ops_chain.h
+++ b/libswscale/ops_chain.h
@@ -165,6 +165,13 @@ static inline void ff_sws_op_priv_pack(SwsImplResult *out, 
const void *data, siz
     out->priv_size += size;
 }
 
+static inline void ff_sws_op_priv_pack_refptr(SwsImplResult *out, const void 
*data)
+{
+    ff_sws_op_priv_pack(out, &data, sizeof(data));
+    av_assert0(!out->ref);
+    out->ref = data;
+}
+
 struct SwsUOpTable {
     unsigned cpu_flags;   /* required CPU flags for this table */
     int block_size;       /* fixed block size of this table */
diff --git a/libswscale/uops_tmpl.c b/libswscale/uops_tmpl.c
index 80c6391f5d..42ab8f336c 100644
--- a/libswscale/uops_tmpl.c
+++ b/libswscale/uops_tmpl.c
@@ -724,7 +724,7 @@ DECL_SETUP(setup_dither, params, out)
     const int size = 1 << dither->size_log2;
     if (size >= SWS_BLOCK_SIZE) {
         /* No extra padding needed */
-        out->ref = out->priv.ptr = av_refstruct_ref(uop->data.ptr);
+        ff_sws_op_priv_pack_refptr(out, av_refstruct_ref(uop->data.ptr));
         return 0;
     }
 
@@ -733,7 +733,7 @@ DECL_SETUP(setup_dither, params, out)
     pixel_t *matrix = ff_refstruct_calloc(height, sizeof(pixel_t) * stride);
     if (!matrix)
         return AVERROR(ENOMEM);
-    out->ref = out->priv.ptr = matrix;
+    ff_sws_op_priv_pack_refptr(out, matrix);
 
     /* Pad to multiple of block size. We don't need extra padding for the
      * height because ff_sws_dither_height() already includes any padding
@@ -801,10 +801,11 @@ DECL_SETUP(setup_linear, params, out)
         c.k[i] = uop->data.mat4x5[i][4].px;
     }
 
-    out->ref = out->priv.ptr = av_refstruct_allocz(sizeof(c));
-    if (!out->priv.ptr)
+    fn(LinCoeffs) *data = av_refstruct_allocz(sizeof(c));
+    if (!data)
         return AVERROR(ENOMEM);
-    memcpy(out->priv.ptr, &c, sizeof(c));
+    memcpy(data, &c, sizeof(c));
+    ff_sws_op_priv_pack_refptr(out, data);
     return 0;
 }
 
@@ -856,7 +857,7 @@ SWS_FOR_STRUCT(PX, LINEAR, DECL_ENTRY, .setup = 
fn(setup_linear) )
 DECL_SETUP(setup_lut3d, params, out)
 {
     const SwsLut3D *lut = params->uop->data.lut3d;
-    out->ref = out->priv.ptr = (void *) av_refstruct_ref_c(lut);
+    ff_sws_op_priv_pack_refptr(out, av_refstruct_ref_c(lut));
     return 0;
 }
 

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