PR #23813 opened by Ramiro Polla (ramiro) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23813 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23813.patch
These are a few commits cherry-picked from my JIT branch. >From 8600fad4bb15157dc3020694770c4009f81d11dc Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Thu, 2 Jul 2026 16:18:13 +0200 Subject: [PATCH 1/4] swscale/aarch64/ops: fix SWS_OP_CLEAR parameter extraction The mask should take into consideration SWS_OP_NEEDED() as well, since op->clear.value may contain stale values for unneeded components. Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla <[email protected]> --- libswscale/aarch64/ops_impl_conv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/aarch64/ops_impl_conv.c b/libswscale/aarch64/ops_impl_conv.c index 431af91d98..0d9ea0f17e 100644 --- a/libswscale/aarch64/ops_impl_conv.c +++ b/libswscale/aarch64/ops_impl_conv.c @@ -185,10 +185,10 @@ static int convert_to_aarch64_impl(SwsContext *ctx, const SwsOpList *ops, int n, break; case AARCH64_SWS_OP_CLEAR: out->mask = 0; - MASK_SET(out->mask, 0, !!op->clear.value[0].den); - MASK_SET(out->mask, 1, !!op->clear.value[1].den); - MASK_SET(out->mask, 2, !!op->clear.value[2].den); - MASK_SET(out->mask, 3, !!op->clear.value[3].den); + for (int i = 0; i < 4; i++) { + if (SWS_OP_NEEDED(op, i) && op->clear.value[i].den) + MASK_SET(out->mask, i, 1); + } break; case AARCH64_SWS_OP_EXPAND: case AARCH64_SWS_OP_CONVERT: -- 2.52.0 >From fb2a0ea87ac11ee6be9c04762bb8fc16e52b2568 Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Thu, 2 Jul 2026 17:58:36 +0200 Subject: [PATCH 2/4] swscale/aarch64/ops: perform pass splitting while generating ops_entries.c There was a mismatch between the ops generated by sws_ops_aarch64 and the aarch64 backend, leading to missed optimizations. Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla <[email protected]> --- libswscale/aarch64/ops_entries.c | 16 +++---- libswscale/tests/sws_ops_aarch64.c | 68 +++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 27 deletions(-) diff --git a/libswscale/aarch64/ops_entries.c b/libswscale/aarch64/ops_entries.c index 9466c800e6..5c90cf3805 100644 --- a/libswscale/aarch64/ops_entries.c +++ b/libswscale/aarch64/ops_entries.c @@ -40,7 +40,6 @@ { .op = AARCH64_SWS_OP_READ_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_READ_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_BIT, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, -{ .op = AARCH64_SWS_OP_WRITE_BIT, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_WRITE_NIBBLE, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_WRITE_NIBBLE, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_WRITE_PACKED, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0011 }, @@ -59,18 +58,22 @@ { .op = AARCH64_SWS_OP_WRITE_PACKED, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PACKED, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, +{ .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0001 }, +{ .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, +{ .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0001 }, +{ .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_WRITE_PLANAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x1111 }, { .op = AARCH64_SWS_OP_SWAP_BYTES, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0001 }, @@ -136,7 +139,6 @@ { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf00f, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf00f, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf00f, .block_size = 32, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, -{ .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf021, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf021, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf021, .block_size = 32, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf0f2, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0101 }, @@ -154,8 +156,6 @@ { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf12f, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf12f, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf12f, .block_size = 32, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, -{ .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf132, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, -{ .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf132, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf132, .block_size = 32, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf321, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_SWIZZLE, .swizzle = 0xf321, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, @@ -245,19 +245,15 @@ { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0010 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0101 }, -{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1000 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1011 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1100 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1101 }, -{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U8, .mask = 0x1110 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0010 }, -{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x0110 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x1000 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x1100 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x1101 }, -{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U16, .mask = 0x1110 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x0010 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x0101 }, @@ -267,10 +263,14 @@ { .op = AARCH64_SWS_OP_CLEAR, .block_size = 8, .type = AARCH64_PIXEL_U32, .mask = 0x1101 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0010 }, +{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0011 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0110 }, +{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U8, .mask = 0x1000 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0010 }, +{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0011 }, +{ .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x0111 }, { .op = AARCH64_SWS_OP_CLEAR, .block_size = 16, .type = AARCH64_PIXEL_U16, .mask = 0x1000 }, { .op = AARCH64_SWS_OP_CONVERT, .to_type = AARCH64_PIXEL_U8, .block_size = 8, .type = AARCH64_PIXEL_F32, .mask = 0x0001 }, { .op = AARCH64_SWS_OP_CONVERT, .to_type = AARCH64_PIXEL_U8, .block_size = 8, .type = AARCH64_PIXEL_F32, .mask = 0x0011 }, diff --git a/libswscale/tests/sws_ops_aarch64.c b/libswscale/tests/sws_ops_aarch64.c index 1dc90c7e60..fb53b2194e 100644 --- a/libswscale/tests/sws_ops_aarch64.c +++ b/libswscale/tests/sws_ops_aarch64.c @@ -22,9 +22,11 @@ #include "libavutil/mem.h" #include "libavutil/tree.h" +#include "libswscale/graph.h" #include "libswscale/ops.h" #include "libswscale/ops_chain.h" #include "libswscale/op_list_gen_template.c" +#include "libswscale/ops_dispatch.h" #include "libswscale/aarch64/ops_impl.c" #include "libswscale/aarch64/ops_impl_conv.c" @@ -73,27 +75,12 @@ error: return ret; } -static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops) +static int collect_ops_compile(SwsContext *ctx, const SwsOpList *ops, + SwsCompiledOp *out) { - struct AVTreeNode **root = (struct AVTreeNode **) opaque; + struct AVTreeNode **root = (struct AVTreeNode **) ctx->opaque; int ret; - /* Skip ops lists which include filtering, since this is still not - * supported. */ - for (int i = 0; i < ops->num_ops; i++) { - const SwsOp *op = &ops->ops[i]; - switch (op->op) { - case SWS_OP_READ: - case SWS_OP_WRITE: - if (op->rw.filter.op) - return 0; - break; - case SWS_OP_FILTER_H: - case SWS_OP_FILTER_V: - return 0; - } - } - /* Use at most two full vregs during the widest precision section */ int block_size = (ff_sws_op_list_max_size(ops) == 4) ? 8 : 16; @@ -119,12 +106,46 @@ static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops) } } + *out = (SwsCompiledOp) { 0 }; ret = 0; end: return ret; } +static const SwsOpBackend backend_collect = { + .name = "collect_ops", + .compile = collect_ops_compile, +}; + +/*********************************************************************/ +static int register_op(SwsContext *ctx, void *opaque, SwsOpList *ops) +{ + /* Skip ops lists which include filtering, since this is still not + * supported. */ + for (int i = 0; i < ops->num_ops; i++) { + const SwsOp *op = &ops->ops[i]; + switch (op->op) { + case SWS_OP_READ: + case SWS_OP_WRITE: + if (op->rw.filter.op) + return 0; + break; + case SWS_OP_FILTER_H: + case SWS_OP_FILTER_V: + return 0; + } + } + + /* ff_sws_compile_pass() takes over ownership of `ops` */ + SwsOpList *copy = ff_sws_op_list_duplicate(ops); + if (!copy) + return AVERROR(ENOMEM); + + const int flags = SWS_OP_FLAG_DRY_RUN | SWS_OP_FLAG_SPLIT_MEMCPY; + return ff_sws_compile_pass(opaque, &backend_collect, ©, flags, NULL, NULL); +} + /*********************************************************************/ static void serialize_op(char *buf, size_t size, const SwsAArch64OpImplParams *params) { @@ -171,7 +192,14 @@ int main(int argc, char *argv[]) if (!ctx) goto fail; - ret = ff_sws_enum_op_lists(ctx, &root, AV_PIX_FMT_NONE, AV_PIX_FMT_NONE, + SwsGraph *graph = ff_sws_graph_alloc(); + if (!graph) + goto fail; + + graph->ctx = ctx; + ctx->opaque = &root; + + ret = ff_sws_enum_op_lists(ctx, graph, AV_PIX_FMT_NONE, AV_PIX_FMT_NONE, register_op); /** @@ -185,6 +213,8 @@ int main(int argc, char *argv[]) printf("\n"); av_tree_enumerate(root, stdout, NULL, print_op); + ff_sws_graph_free(&graph); + fail: av_tree_destroy(root); sws_free_context(&ctx); -- 2.52.0 >From e9edadbc23540f33b3beea7c4cb7519677b3e516 Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Mon, 13 Jul 2026 02:32:06 +0200 Subject: [PATCH 3/4] swscale/aarch64/ops: remove struct SwsAArch64BackendContext and aarch64_optimize() stubs The purpose of this struct and function was to perform aarch64-specific optimizations, but the backend will eventually be converted to the new uops architecture, which has the ability to perform arch-specific optimizations. Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla <[email protected]> --- libswscale/aarch64/ops.c | 42 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/libswscale/aarch64/ops.c b/libswscale/aarch64/ops.c index 9a3b1f237c..71137f7bea 100644 --- a/libswscale/aarch64/ops.c +++ b/libswscale/aarch64/ops.c @@ -28,12 +28,6 @@ #include "ops_impl_conv.c" -/*********************************************************************/ -typedef struct SwsAArch64BackendContext { - SwsContext *sws; - int block_size; -} SwsAArch64BackendContext; - /*********************************************************************/ static int aarch64_setup_linear(const SwsAArch64OpImplParams *p, const SwsOp *op, SwsImplResult *res) @@ -115,10 +109,10 @@ static int aarch64_setup_dither(const SwsAArch64OpImplParams *p, } /*********************************************************************/ -static int aarch64_setup(SwsOpList *ops, int block_size, int n, +static int aarch64_setup(const SwsOpList *ops, int block_size, int n, const SwsAArch64OpImplParams *p, SwsImplResult *out) { - SwsOp *op = &ops->ops[n]; + const SwsOp *op = &ops->ops[n]; switch (op->op) { case SWS_OP_READ: /* Negative shift values to perform right shift using ushl. */ @@ -160,34 +154,18 @@ static int aarch64_setup(SwsOpList *ops, int block_size, int n, return 0; } -/*********************************************************************/ -static int aarch64_optimize(SwsAArch64BackendContext *bctx, SwsOpList *ops) -{ - /* Currently, no optimization is performed. This is just a placeholder. */ - - /* Use at most two full vregs during the widest precision section */ - bctx->block_size = (ff_sws_op_list_max_size(ops) == 4) ? 8 : 16; - - return 0; -} - /*********************************************************************/ static int aarch64_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out) { - SwsAArch64BackendContext bctx; int ret; const int cpu_flags = av_get_cpu_flags(); if (!(cpu_flags & AV_CPU_FLAG_NEON)) return AVERROR(ENOTSUP); - /* Make on-stack copy of `ops` to iterate over */ - SwsOpList rest = *ops; - bctx.sws = ctx; - ret = aarch64_optimize(&bctx, &rest); - if (ret < 0) - return ret; + /* Use at most two full vregs during the widest precision section */ + int block_size = (ff_sws_op_list_max_size(ops) == 4) ? 8 : 16; SwsOpChain *chain = ff_sws_op_chain_alloc(); if (!chain) @@ -198,13 +176,13 @@ static int aarch64_compile(SwsContext *ctx, const SwsOpList *ops, .priv = chain, .slice_align = 1, .free = ff_sws_op_chain_free_cb, - .block_size = bctx.block_size, + .block_size = block_size, }; /* Look up kernel functions. */ - for (int i = 0; i < rest.num_ops; i++) { + for (int i = 0; i < ops->num_ops; i++) { SwsAArch64OpImplParams params = { 0 }; - ret = convert_to_aarch64_impl(ctx, &rest, i, bctx.block_size, ¶ms); + ret = convert_to_aarch64_impl(ctx, ops, i, block_size, ¶ms); if (ret < 0) goto error; SwsFuncPtr func = ff_sws_aarch64_lookup(¶ms); @@ -213,7 +191,7 @@ static int aarch64_compile(SwsContext *ctx, const SwsOpList *ops, goto error; } SwsImplResult res = { 0 }; - ret = aarch64_setup(&rest, bctx.block_size, i, ¶ms, &res); + ret = aarch64_setup(ops, block_size, i, ¶ms, &res); if (ret < 0) goto error; ret = ff_sws_op_chain_append(chain, func, res.free, &res.priv); @@ -227,8 +205,8 @@ static int aarch64_compile(SwsContext *ctx, const SwsOpList *ops, void ff_sws_process_0111_neon(void); void ff_sws_process_1111_neon(void); - const SwsOp *read = ff_sws_op_list_input(&rest); - const SwsOp *write = ff_sws_op_list_output(&rest); + const SwsOp *read = ff_sws_op_list_input(ops); + const SwsOp *write = ff_sws_op_list_output(ops); 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; -- 2.52.0 >From 64e05b73fa0a9026315a5b030b287f5c1d9227e3 Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Mon, 6 Jul 2026 15:36:51 +0200 Subject: [PATCH 4/4] swscale/aarch64/ops: move SwsOpExec/SwsOpImpl offset value checks to ops.c This prevents build warnings for ops_asmgen on non-aarch64 hosts. Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla <[email protected]> --- libswscale/aarch64/ops.c | 14 ++++++++++++++ libswscale/aarch64/ops_impl.h | 13 ++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libswscale/aarch64/ops.c b/libswscale/aarch64/ops.c index 71137f7bea..ab2adc37eb 100644 --- a/libswscale/aarch64/ops.c +++ b/libswscale/aarch64/ops.c @@ -28,6 +28,20 @@ #include "ops_impl_conv.c" +/** + * Check that there is no mismatch for the SwsOpExec/SwsOpImpl offset + * values used by ops_asmgen. + * NOTE: The check is performed here since this file only ever targets + * aarch64, differently from ops_asmgen which may be built on any + * host. + */ +static_assert(offsetof_exec_in == offsetof(SwsOpExec, in), "SwsOpExec layout mismatch"); +static_assert(offsetof_exec_out == offsetof(SwsOpExec, out), "SwsOpExec layout mismatch"); +static_assert(offsetof_exec_in_bump == offsetof(SwsOpExec, in_bump), "SwsOpExec layout mismatch"); +static_assert(offsetof_exec_out_bump == offsetof(SwsOpExec, out_bump), "SwsOpExec layout mismatch"); +static_assert(offsetof_impl_cont == offsetof(SwsOpImpl, cont), "SwsOpImpl layout mismatch"); +static_assert(offsetof_impl_priv == offsetof(SwsOpImpl, priv), "SwsOpImpl layout mismatch"); + /*********************************************************************/ static int aarch64_setup_linear(const SwsAArch64OpImplParams *p, const SwsOp *op, SwsImplResult *res) diff --git a/libswscale/aarch64/ops_impl.h b/libswscale/aarch64/ops_impl.h index 9ccacc60e7..9950ccdad8 100644 --- a/libswscale/aarch64/ops_impl.h +++ b/libswscale/aarch64/ops_impl.h @@ -163,8 +163,8 @@ static inline int linear_index_to_vx(int idx) /** * These values will be used by ops_asmgen to access fields inside of - * SwsOpExec and SwsOpImpl. The sizes are checked below when compiling - * for AArch64 to make sure there is no mismatch. + * SwsOpExec and SwsOpImpl. The sizes are checked in aarch64/ops.c when + * compiling for AArch64 to make sure there is no mismatch. */ #define offsetof_exec_in 0 #define offsetof_exec_out 32 @@ -174,13 +174,4 @@ static inline int linear_index_to_vx(int idx) #define offsetof_impl_priv 16 #define sizeof_impl 32 -#if ARCH_AARCH64 && HAVE_NEON -static_assert(offsetof_exec_in == offsetof(SwsOpExec, in), "SwsOpExec layout mismatch"); -static_assert(offsetof_exec_out == offsetof(SwsOpExec, out), "SwsOpExec layout mismatch"); -static_assert(offsetof_exec_in_bump == offsetof(SwsOpExec, in_bump), "SwsOpExec layout mismatch"); -static_assert(offsetof_exec_out_bump == offsetof(SwsOpExec, out_bump), "SwsOpExec layout mismatch"); -static_assert(offsetof_impl_cont == offsetof(SwsOpImpl, cont), "SwsOpImpl layout mismatch"); -static_assert(offsetof_impl_priv == offsetof(SwsOpImpl, priv), "SwsOpImpl layout mismatch"); -#endif - #endif /* SWSCALE_AARCH64_OPS_IMPL_H */ -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
