This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 8e3eacd7ad7af7a664e02a7a404896724391e408 Author: Niklas Haas <[email protected]> AuthorDate: Thu Mar 12 21:41:55 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Wed Mar 18 09:09:44 2026 +0000 swscale/ops_chain: allow implementations to expose over_read/write And plumb it all the way through to the SwsCompiledOp. This is cleaner than setting up this metadata up-front in x86/ops.c; and more importantly, it allows us to determine the amount of over-read programmatically during ops setup. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops_backend.c | 2 ++ libswscale/ops_chain.c | 5 ++++- libswscale/ops_chain.h | 6 +++++- libswscale/x86/ops.c | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libswscale/ops_backend.c b/libswscale/ops_backend.c index aaaa75ed0d..cbc7eba1b4 100644 --- a/libswscale/ops_backend.c +++ b/libswscale/ops_backend.c @@ -86,6 +86,8 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) .slice_align = 1, .block_size = SWS_BLOCK_SIZE, .cpu_flags = chain->cpu_flags, + .over_read = chain->over_read, + .over_write = chain->over_write, .priv = chain, .free = ff_sws_op_chain_free_cb, }; diff --git a/libswscale/ops_chain.c b/libswscale/ops_chain.c index 9ebbe675f0..d159acb119 100644 --- a/libswscale/ops_chain.c +++ b/libswscale/ops_chain.c @@ -238,7 +238,6 @@ int ff_sws_op_compile_tables(SwsContext *ctx, const SwsOpTable *const tables[], return ret; } - chain->cpu_flags |= best_table->cpu_flags; ret = ff_sws_op_chain_append(chain, res.func ? res.func : best->func, res.free, &res.priv); if (ret < 0) { @@ -247,6 +246,10 @@ int ff_sws_op_compile_tables(SwsContext *ctx, const SwsOpTable *const tables[], return ret; } + chain->cpu_flags |= best_table->cpu_flags; + chain->over_read = FFMAX(chain->over_read, res.over_read); + chain->over_write = FFMAX(chain->over_write, res.over_write); + ops->ops++; ops->num_ops--; return ops->num_ops ? AVERROR(EAGAIN) : 0; diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h index 1c09525095..648625b7fe 100644 --- a/libswscale/ops_chain.h +++ b/libswscale/ops_chain.h @@ -86,7 +86,9 @@ typedef struct SwsOpChain { SwsOpImpl impl[SWS_MAX_OPS + 1]; /* reserve extra space for the entrypoint */ void (*free[SWS_MAX_OPS + 1])(SwsOpPriv *); int num_impl; - int cpu_flags; /* set of all used CPU flags */ + int cpu_flags; /* set of all used CPU flags */ + int over_read; /* chain over-reads input by this many bytes */ + int over_write; /* chain over-writes output by this many bytes */ } SwsOpChain; SwsOpChain *ff_sws_op_chain_alloc(void); @@ -110,6 +112,8 @@ typedef struct SwsImplResult { SwsFuncPtr func; /* overrides `SwsOpEntry.func` if non-NULL */ SwsOpPriv priv; /* private data for this implementation instance */ void (*free)(SwsOpPriv *priv); /* free function for `priv` */ + int over_read; /* implementation over-reads input by this many bytes */ + int over_write; /* implementation over-writes output by this many bytes */ } SwsImplResult; typedef struct SwsOpEntry { diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c index 969fca6128..88db0d3e76 100644 --- a/libswscale/x86/ops.c +++ b/libswscale/x86/ops.c @@ -710,9 +710,9 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) /* 3-component reads/writes process one extra garbage word */ if (read && read->rw.packed && read->rw.elems == 3) - out->over_read = sizeof(uint32_t); + chain->over_read = sizeof(uint32_t); if (write->rw.packed && write->rw.elems == 3) - out->over_write = sizeof(uint32_t); + chain->over_write = sizeof(uint32_t); /* Make on-stack copy of `ops` to iterate over */ @@ -764,7 +764,9 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out) return ret; } - out->cpu_flags = chain->cpu_flags; + out->cpu_flags = chain->cpu_flags; + out->over_read = chain->over_read; + out->over_write = chain->over_write; return 0; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
