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

Git pushed a commit to branch master
in repository ffmpeg.

commit 79334c8ca1f62a2b78a682a8eae5f89eebe90112
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Feb 27 10:30:00 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Fri Feb 27 16:18:34 2026 +0000

    swscale/ops: add subsampling shift to SwsOpExec
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c              | 12 ++++++++++--
 libswscale/ops_internal.h     |  9 +++++++--
 libswscale/x86/ops_common.asm |  4 ++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index 3aba144246..0b10692a82 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -982,24 +982,32 @@ static void op_pass_setup(const SwsImg *out_base, const 
SwsImg *in_base,
 
     for (int i = 0; i < p->planes_in; i++) {
         const int idx        = p->idx_in[i];
-        const int sub_x      = (idx == 1 || idx == 2) ? indesc->log2_chroma_w 
: 0;
+        const int chroma     = idx == 1 || idx == 2;
+        const int sub_x      = chroma ? indesc->log2_chroma_w : 0;
+        const int sub_y      = chroma ? indesc->log2_chroma_h : 0;
         const int plane_w    = (aligned_w + sub_x) >> sub_x;
         const int plane_pad  = (comp->over_read + sub_x) >> sub_x;
         const int plane_size = plane_w * p->pixel_bits_in >> 3;
         if (comp->slice_align)
             p->memcpy_in |= plane_size + plane_pad > in.linesize[i];
         exec->in_stride[i] = in.linesize[i];
+        exec->in_sub_y[i]  = sub_y;
+        exec->in_sub_x[i]  = sub_x;
     }
 
     for (int i = 0; i < p->planes_out; i++) {
         const int idx        = p->idx_out[i];
-        const int sub_x      = (idx == 1 || idx == 2) ? outdesc->log2_chroma_w 
: 0;
+        const int chroma     = idx == 1 || idx == 2;
+        const int sub_x      = chroma ? outdesc->log2_chroma_w : 0;
+        const int sub_y      = chroma ? outdesc->log2_chroma_h : 0;
         const int plane_w    = (aligned_w + sub_x) >> sub_x;
         const int plane_pad  = (comp->over_write + sub_x) >> sub_x;
         const int plane_size = plane_w * p->pixel_bits_out >> 3;
         if (comp->slice_align)
             p->memcpy_out |= plane_size + plane_pad > out.linesize[i];
         exec->out_stride[i] = out.linesize[i];
+        exec->out_sub_y[i]  = sub_y;
+        exec->out_sub_x[i]  = sub_x;
     }
 
     /* Pre-fill pointer bump for the main section only; this value does not
diff --git a/libswscale/ops_internal.h b/libswscale/ops_internal.h
index 1276b78617..e07ef5285f 100644
--- a/libswscale/ops_internal.h
+++ b/libswscale/ops_internal.h
@@ -76,13 +76,18 @@ typedef struct SwsOpExec {
     int32_t block_size_in;      /* Size of a block of pixels in bytes */
     int32_t block_size_out;
 
+    /* Subsampling factors for each plane */
+    uint8_t in_sub_y[4], out_sub_y[4];
+    uint8_t in_sub_x[4], out_sub_x[4];
+
     const AVFrame *src_frame_ptr;
     const AVFrame *dst_frame_ptr;
 } SwsOpExec;
 
 static_assert(sizeof(SwsOpExec) == 24 * sizeof(void *) +
-                                   6 * sizeof(int32_t) +
-                                   2 * sizeof(void *),
+                                   6  * sizeof(int32_t) +
+                                   16 * sizeof(uint8_t) +
+                                   2  * sizeof(void *),
               "SwsOpExec layout mismatch");
 
 /**
diff --git a/libswscale/x86/ops_common.asm b/libswscale/x86/ops_common.asm
index 23ccda4da3..6da33448f8 100644
--- a/libswscale/x86/ops_common.asm
+++ b/libswscale/x86/ops_common.asm
@@ -137,6 +137,10 @@ struc SwsOpExec
     .slice_h resd 1
     .block_size_in resd 1
     .block_size_out resd 1
+    .in_sub_y4 resb 4
+    .out_sub_y4 resb 4
+    .in_sub_x4 resb 4
+    .out_sub_x4 resb 4
     .in_hwframe_ref resq 1
     .out_hwframe_ref resq 1
 endstruc

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

Reply via email to