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

Git pushed a commit to branch master
in repository ffmpeg.

commit 5f43d0cd4692d718841222a13194c55439d1c9d4
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue May 19 11:48:34 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Jun 11 16:27:47 2026 +0000

    swscale/ops: add and use ff_sws_rw_op_planes()
    
    This is rw_planes() from ops_dispatch.c, but exposed internally.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/aarch64/ops.c  |  4 ++--
 libswscale/ops.c          | 10 ++++++++--
 libswscale/ops.h          |  5 +++++
 libswscale/ops_dispatch.c |  9 ++-------
 libswscale/vulkan/ops.c   |  4 ++--
 libswscale/x86/ops.c      |  4 ++--
 6 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/libswscale/aarch64/ops.c b/libswscale/aarch64/ops.c
index 0b9a39fe90..9a3b1f237c 100644
--- a/libswscale/aarch64/ops.c
+++ b/libswscale/aarch64/ops.c
@@ -229,8 +229,8 @@ static int aarch64_compile(SwsContext *ctx, const SwsOpList 
*ops,
 
     const SwsOp *read  = ff_sws_op_list_input(&rest);
     const SwsOp *write = ff_sws_op_list_output(&rest);
-    const int read_planes  = read ? (read->rw.packed ? 1 : read->rw.elems) : 0;
-    const int write_planes = write->rw.packed ? 1 : write->rw.elems;
+    const int read_planes  = read ? ff_sws_rw_op_planes(read) : 0;
+    const int write_planes = ff_sws_rw_op_planes(write);
     SwsOpFunc process_func = NULL;
     switch (FFMAX(read_planes, write_planes)) {
     case 1: process_func = (SwsOpFunc) ff_sws_process_0001_neon; break;
diff --git a/libswscale/ops.c b/libswscale/ops.c
index f18249cc1f..e4d79a2c60 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -166,6 +166,12 @@ SwsCompMask ff_sws_comp_mask_needed(const SwsOp *op)
     return mask;
 }
 
+int ff_sws_rw_op_planes(const SwsOp *op)
+{
+    av_assert2(op->op == SWS_OP_READ || op->op == SWS_OP_WRITE);
+    return op->rw.packed ? 1 : op->rw.elems;
+}
+
 /* biased towards `a` */
 static AVRational av_min_q(AVRational a, AVRational b)
 {
@@ -736,7 +742,7 @@ bool ff_sws_op_list_is_noop(const SwsOpList *ops)
      * between them, e.g. rgbap <-> gbrap, which doesn't currently exist.
      * However, the check is cheap and lets me sleep at night.
      */
-    const int num_planes = read->rw.packed ? 1 : read->rw.elems;
+    const int num_planes = ff_sws_rw_op_planes(read);
     for (int i = 0; i < num_planes; i++) {
         if (ops->plane_src[i] != ops->plane_dst[i])
             return false;
@@ -983,7 +989,7 @@ void ff_sws_op_list_print(void *log, int lev, int lev_extra,
         ff_sws_op_desc(&bp, op);
 
         if (op->op == SWS_OP_READ || op->op == SWS_OP_WRITE) {
-            const int planes = op->rw.packed ? 1 : op->rw.elems;
+            const int planes = ff_sws_rw_op_planes(op);
             desc_plane_order(&bp, planes,
                 op->op == SWS_OP_READ ? ops->plane_src : ops->plane_dst);
         }
diff --git a/libswscale/ops.h b/libswscale/ops.h
index b38cd915de..3660f1ceec 100644
--- a/libswscale/ops.h
+++ b/libswscale/ops.h
@@ -241,6 +241,11 @@ typedef struct SwsOp {
 /* Compute SwsCompMask from a mask of needed components */
 SwsCompMask ff_sws_comp_mask_needed(const SwsOp *op);
 
+/**
+ * Return the number of planes involved in a read/write operation.
+ */
+int ff_sws_rw_op_planes(const SwsOp *op);
+
 /**
  * Describe an operation in human-readable form.
  */
diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index 5f40010758..fa3f2c75c3 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -462,11 +462,6 @@ static void op_pass_run(const SwsFrame *out, const 
SwsFrame *in, const int y,
     }
 }
 
-static int rw_planes(const SwsOp *op)
-{
-    return op->rw.packed ? 1 : op->rw.elems;
-}
-
 static int rw_pixel_bits(const SwsOp *op)
 {
     const int elems = op->rw.packed ? op->rw.elems : 1;
@@ -526,8 +521,8 @@ static int compile(SwsGraph *graph, const SwsOpBackend 
*backend,
     const AVPixFmtDescriptor *outdesc = av_pix_fmt_desc_get(dst->format);
     const SwsOp *read  = ff_sws_op_list_input(ops);
     const SwsOp *write = ff_sws_op_list_output(ops);
-    p->planes_in  = rw_planes(read);
-    p->planes_out = rw_planes(write);
+    p->planes_in  = ff_sws_rw_op_planes(read);
+    p->planes_out = ff_sws_rw_op_planes(write);
     p->pixel_bits_in  = rw_pixel_bits(read);
     p->pixel_bits_out = rw_pixel_bits(write);
     p->exec_base = (SwsOpExec) {
diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c
index e4f815124e..cfafa1c27c 100644
--- a/libswscale/vulkan/ops.c
+++ b/libswscale/vulkan/ops.c
@@ -929,11 +929,11 @@ static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, 
FFVulkanOpsCtx *s,
 
     /* Image ops, to determine types */
     const SwsOp *op_w = ff_sws_op_list_output(ops);
-    int out_img_count = op_w->rw.packed ? 1 : op_w->rw.elems;
+    int out_img_count = ff_sws_rw_op_planes(op_w);
     p->dst_rep = op_w->type == SWS_PIXEL_F32 ? FF_VK_REP_FLOAT : 
FF_VK_REP_UINT;
 
     const SwsOp *op_r = ff_sws_op_list_input(ops);
-    int in_img_count = op_r ? op_r->rw.packed ? 1 : op_r->rw.elems : 0;
+    int in_img_count = op_r ? ff_sws_rw_op_planes(op_r) : 0;
     if (op_r)
         p->src_rep = op_r->type == SWS_PIXEL_F32 ? FF_VK_REP_FLOAT : 
FF_VK_REP_UINT;
 
diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c
index e8b0a20a1c..1adb73e21c 100644
--- a/libswscale/x86/ops.c
+++ b/libswscale/x86/ops.c
@@ -634,8 +634,8 @@ static int compile(SwsContext *ctx, const SwsOpList *ops, 
SwsCompiledOp *out)
 
     const SwsOp *read      = ff_sws_op_list_input(ops);
     const SwsOp *write     = ff_sws_op_list_output(ops);
-    const int read_planes  = read ? (read->rw.packed ? 1 : read->rw.elems) : 0;
-    const int write_planes = write->rw.packed ? 1 : write->rw.elems;
+    const int read_planes  = read ? ff_sws_rw_op_planes(read) : 0;
+    const int write_planes = ff_sws_rw_op_planes(write);
     switch (FFMAX(read_planes, write_planes)) {
     case 1: out->func = ff_sws_process1_x86; break;
     case 2: out->func = ff_sws_process2_x86; break;

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

Reply via email to