Commit 314b034a34 for ffmpeg
commit 314b034a3495739438adf9894e6fb7a84a0279b6
Author: Niklas Haas <git@haasn.dev>
Date: Sat Nov 7 14:35:16 2026 +0100
swscale/aarch64/ops: add helper to determine the priv size per op
So that the generated kernels can, in a following commit, skip over the data
that each kernel consumes. aarch64_priv_size() must match what
aarch64_setup() packs, which is now also asserted.
The generated code is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libswscale/aarch64/ops.c b/libswscale/aarch64/ops.c
index 6dfc20b420..46970f7bf5 100644
--- a/libswscale/aarch64/ops.c
+++ b/libswscale/aarch64/ops.c
@@ -192,6 +192,7 @@ static int compile_uops_aarch64(SwsContext *ctx, const SwsUOpList *uops,
ret = aarch64_setup(&uops->ops[i], ¶ms, &res);
if (ret < 0)
goto error;
+ av_assert1(res.priv_size == aarch64_priv_size(¶ms));
ret = ff_sws_op_chain_append(chain, func, res.ref, &res.priv, sizeof(res.priv));
av_refstruct_unref(&res.ref);
if (ret < 0)
diff --git a/libswscale/aarch64/ops_impl.h b/libswscale/aarch64/ops_impl.h
index ddd0c56bb4..d6a4f46135 100644
--- a/libswscale/aarch64/ops_impl.h
+++ b/libswscale/aarch64/ops_impl.h
@@ -82,6 +82,30 @@ static inline int linear_num_vregs(const SwsAArch64OpImplParams *params)
return (count + nelems - 1) / nelems;
}
+/**
+ * Number of bytes of private data consumed by each kernel; must match what
+ * aarch64_setup() packs.
+ */
+static inline int aarch64_priv_size(const SwsAArch64OpImplParams *params)
+{
+ switch (params->uop) {
+ case SWS_UOP_READ_BIT:
+ case SWS_UOP_WRITE_BIT:
+ case SWS_UOP_CLEAR:
+ case SWS_UOP_MIN:
+ case SWS_UOP_MAX:
+ return 16; /* one full vector register */
+ case SWS_UOP_SCALE:
+ return ff_sws_pixel_type_size(params->type);
+ case SWS_UOP_LINEAR:
+ case SWS_UOP_LINEAR_FMA:
+ case SWS_UOP_DITHER:
+ return 8; /* pointer */
+ default:
+ return 0;
+ }
+}
+
/**
* These values will be used by ops_asmgen to access fields inside of
* SwsOpExec and SwsOpImpl. The sizes are checked in aarch64/ops.c when