This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit c1eee3d4d8ef91b1f7f651d92d54e30716996ec7 Author: Niklas Haas <[email protected]> AuthorDate: Tue Feb 10 22:32:09 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Tue Jun 23 11:48:13 2026 +0000 swscale/graph: add a function to allow reusing output buffers Used for plane splitting, among other things. (e.g. plane passthrough) Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/graph.c | 16 ++++++++++++++++ libswscale/graph.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/libswscale/graph.c b/libswscale/graph.c index a99cd7cadf..cabb61b5fd 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -229,6 +229,22 @@ fail: return ret; } +void ff_sws_pass_link_output(SwsPass *dst, const SwsPass *src) +{ + if (!dst || !src || dst == src) + return; + + av_assert0(dst->format == src->format); + SwsPassBuffer *keep = src->output, *drop = dst->output; + + av_assert1(keep->width == drop->width); + av_assert1(keep->height == drop->height); + keep->width_align = FFMAX(keep->width_align, drop->width_align); + keep->width_pad = FFMAX(keep->width_pad, drop->width_pad); + + av_refstruct_replace(&dst->output, src->output); +} + static void frame_shift(const SwsFrame *f, const int y, uint8_t *data[4]) { for (int i = 0; i < 4; i++) { diff --git a/libswscale/graph.h b/libswscale/graph.h index cb06f480cc..e467a43e45 100644 --- a/libswscale/graph.h +++ b/libswscale/graph.h @@ -199,6 +199,16 @@ int ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, void *priv, void (*free)(void *priv), SwsPass **out_pass); +/** + * Link the output buffers to a different pass, rather than allocating + * new image buffers. This allows reusing the same buffer for multiple passes, + * e.g. in the case of in-place passes or partial passes that modify different + * planes. + * + * Any existing buffer on `dst` will be ignored/unref'd. + **/ +void ff_sws_pass_link_output(SwsPass *dst, const SwsPass *src); + /** * Remove all passes added since the given index. */ _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
