This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0901ca410816ef77c64cf14127feac0ae41e9cb4 Author: Niklas Haas <[email protected]> AuthorDate: Fri Jun 12 17:37:39 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Tue Jun 23 11:48:13 2026 +0000 swscale/ops_dispatch: add option to split const/copied subpasses This already helps performance as-is, but will help performance massively once we add the ability for the memcpy backend to do a refcopy instead of an actual copy. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops_dispatch.c | 32 +++++++++++++++++++++++++++++++- libswscale/ops_dispatch.h | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c index e1f9504cde..dd166a5f92 100644 --- a/libswscale/ops_dispatch.c +++ b/libswscale/ops_dispatch.c @@ -673,17 +673,47 @@ fail: return ret; } +/* Return a mask of all planes matching any flag in `flags` */ +static SwsCompMask plane_mask_flags(const SwsOp *op, SwsCompFlags flags) +{ + SwsCompMask planes = 0; + for (int c = 0; c < 4; c++) { + if (op->comps.flags[c] & flags) + planes |= SWS_COMP(c); + } + + return planes; +} + /* Takes over ownership of *pops, even on failure */ static int compile_subpass(const CompileArgs *args, SwsOpList **pops, SwsPass *link, SwsPass *input, SwsPass **output) { + int ret; SwsContext *ctx = args->graph->ctx; SwsOpList *ops = *pops; SwsOpList *rest = NULL; SwsPass *tmp = NULL; *pops = NULL; - int ret = compile_single(args, ops, link, input, output); + if (args->flags & SWS_OP_FLAG_SPLIT_MEMCPY) { + /* Split off copied and constant planes into a separate subpass, + * since these are likely to be handled by the memcpy backend */ + av_assert0(ops->num_ops >= 2); + const SwsOp *prev = &ops->ops[ops->num_ops - 2]; + SwsCompMask planes = plane_mask_flags(prev, SWS_COMP_COPY | SWS_COMP_CONST); + RET(ff_sws_op_list_split_planes(ops, &rest, planes)); + if (rest) { + /* Parallel split: share input and link all outputs together */ + av_log(ctx, AV_LOG_DEBUG, "Splitting const/memcpy planes: %s\n", + ff_sws_comp_mask_str(planes)); + RET(compile_subpass(args, &ops, link, input, &tmp)); + RET(compile_subpass(args, &rest, tmp, input, output)); + return 0; + } + } + + ret = compile_single(args, ops, link, input, output); if (ret != AVERROR(ENOTSUP)) goto fail; /* either success or a hard error */ diff --git a/libswscale/ops_dispatch.h b/libswscale/ops_dispatch.h index 4581cf93eb..2cc4aa3490 100644 --- a/libswscale/ops_dispatch.h +++ b/libswscale/ops_dispatch.h @@ -168,6 +168,9 @@ enum SwsOpCompileFlags { /* Discard the compiled op lists instead of generating passes */ SWS_OP_FLAG_DRY_RUN = 1 << 1, + + /* Split off copied/cleared planes into separate subpasses */ + SWS_OP_FLAG_SPLIT_MEMCPY = 1 << 2, }; /** _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
