This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 65caf980012fa2a6024a1a9800e8ed6951130d29 Author: Niklas Haas <[email protected]> AuthorDate: Wed Nov 4 19:19:39 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Sun Nov 8 01:48:12 2026 +0000 swscale/ops_chain: directly pack data into SwsOpPriv The next series of commits will gradually switch over the backends to packing their kernel private data directly into SwsOpPriv.data[], rather than using the typed arrays. This will allow us to remove the typed arrays entirely and then unbound the per-op size. It's worth pointing out that, as of this commit, the packed size is still ignored in favor of storing the entire SwsOpPriv struct in the chain data. This is to preserve the struct layout for the current code, which directly hard-code sizeof(SwsOpImpl) when advancing `impl`. This can be relaxed after the op kernels stop hard-coding this size. Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops_chain.c | 16 ++++++++-------- libswscale/ops_chain.h | 14 +++++++++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libswscale/ops_chain.c b/libswscale/ops_chain.c index 5b0367d6b5..62a487fe54 100644 --- a/libswscale/ops_chain.c +++ b/libswscale/ops_chain.c @@ -146,10 +146,10 @@ int ff_sws_setup_scalar(const SwsImplParams *params, SwsImplResult *out) const SwsUOp *uop = params->uop; const SwsPixel scalar = uop->data.scalar; switch (uop->type) { - case SWS_PIXEL_U8: out->priv.u8[0] = scalar.u8; break; - case SWS_PIXEL_U16: out->priv.u16[0] = scalar.u16; break; - case SWS_PIXEL_U32: out->priv.u32[0] = scalar.u32; break; - case SWS_PIXEL_F32: out->priv.f32[0] = scalar.f32; break; + case SWS_PIXEL_U8: SWS_OP_PRIV_PACK(out, scalar.u8); break; + case SWS_PIXEL_U16: SWS_OP_PRIV_PACK(out, scalar.u16); break; + case SWS_PIXEL_U32: SWS_OP_PRIV_PACK(out, scalar.u32); break; + case SWS_PIXEL_F32: SWS_OP_PRIV_PACK(out, scalar.f32); break; default: return AVERROR(EINVAL); } @@ -162,10 +162,10 @@ int ff_sws_setup_vec4(const SwsImplParams *params, SwsImplResult *out) for (int i = 0; i < 4; i++) { const SwsPixel vi = uop->data.vec4[i]; switch (uop->type) { - case SWS_PIXEL_U8: out->priv.u8[i] = vi.u8; break; - case SWS_PIXEL_U16: out->priv.u16[i] = vi.u16; break; - case SWS_PIXEL_U32: out->priv.u32[i] = vi.u32; break; - case SWS_PIXEL_F32: out->priv.f32[i] = vi.f32; break; + case SWS_PIXEL_U8: SWS_OP_PRIV_PACK(out, vi.u8); break; + case SWS_PIXEL_U16: SWS_OP_PRIV_PACK(out, vi.u16); break; + case SWS_PIXEL_U32: SWS_OP_PRIV_PACK(out, vi.u32); break; + case SWS_PIXEL_F32: SWS_OP_PRIV_PACK(out, vi.f32); break; default: return AVERROR(EINVAL); } } diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h index b7e88710a3..5a051e776e 100644 --- a/libswscale/ops_chain.h +++ b/libswscale/ops_chain.h @@ -21,6 +21,7 @@ #ifndef SWSCALE_OPS_CHAIN_H #define SWSCALE_OPS_CHAIN_H +#include "libavutil/avassert.h" #include "libavutil/avconfig.h" #include "libavutil/cpu.h" #include "libavutil/mem.h" @@ -130,10 +131,13 @@ typedef struct SwsImplParams { typedef struct SwsImplResult { SwsFuncPtr func; /* overrides `SwsUOpEntry.func` if non-NULL */ - SwsOpPriv priv; /* private data for this implementation instance */ int over_read[4]; /* implementation over-reads input by this many bytes */ int over_write[4]; /* implementation over-writes output by this many bytes */ const void *ref; /* external data backing `priv`, ownership passes to caller */ + + /* Private data for this kernel */ + size_t priv_size; + SwsOpPriv priv; } SwsImplResult; typedef struct SwsUOpEntry { @@ -153,6 +157,14 @@ typedef struct SwsUOpEntry { int ff_sws_setup_scalar(const SwsImplParams *params, SwsImplResult *out); int ff_sws_setup_vec4(const SwsImplParams *params, SwsImplResult *out); +#define SWS_OP_PRIV_PACK(out, data) ff_sws_op_priv_pack(out, &data, sizeof(data)) +static inline void ff_sws_op_priv_pack(SwsImplResult *out, const void *data, size_t size) +{ + av_assert0(out->priv_size + size <= sizeof(out->priv)); + memcpy(&out->priv.data[out->priv_size], data, size); + out->priv_size += size; +} + struct SwsUOpTable { unsigned cpu_flags; /* required CPU flags for this table */ int block_size; /* fixed block size of this table */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
