This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 42a47838ea3b6973c1cdc70f3d86870f2cf6e1e2 Author: Niklas Haas <[email protected]> AuthorDate: Sat Mar 7 01:09:34 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Mon Mar 9 12:01:51 2026 +0100 swscale/graph: add setup()/free() to ff_sws_graph_add_pass() signature This is just slightly common enough a pattern that it IMO makes sense to do so. This will also make more sense after the following commits. Signed-off-by: Niklas Haas <[email protected]> --- libswscale/graph.c | 24 ++++++++++++------------ libswscale/graph.h | 7 +++++-- libswscale/ops_dispatch.c | 7 ++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libswscale/graph.c b/libswscale/graph.c index 4cc6e031c9..88613676fc 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -106,7 +106,8 @@ static void free_buffer(AVRefStructOpaque opaque, void *obj) int ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, int width, int height, SwsPass *input, - int align, void *priv, SwsPassFunc run, + int align, SwsPassFunc run, SwsPassSetup setup, + void *priv, void (*free_cb)(void *priv), SwsPass **out_pass) { int ret; @@ -116,7 +117,9 @@ int ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, pass->graph = graph; pass->run = run; + pass->setup = setup; pass->priv = priv; + pass->free = free_cb; pass->format = fmt; pass->width = width; pass->height = height; @@ -394,7 +397,7 @@ static int init_legacy_subpass(SwsGraph *graph, SwsContext *sws, if (c->src0Alpha && !c->dst0Alpha && isALPHA(sws->dst_format)) { ret = ff_sws_graph_add_pass(graph, AV_PIX_FMT_RGBA, src_w, src_h, input, - 1, c, run_rgb0, &input); + 1, run_rgb0, NULL, c, NULL, &input); if (ret < 0) { sws_free_context(&sws); return ret; @@ -403,22 +406,20 @@ static int init_legacy_subpass(SwsGraph *graph, SwsContext *sws, if (c->srcXYZ && !(c->dstXYZ && unscaled)) { ret = ff_sws_graph_add_pass(graph, AV_PIX_FMT_RGB48, src_w, src_h, input, - 1, c, run_xyz2rgb, &input); + 1, run_xyz2rgb, NULL, c, NULL, &input); if (ret < 0) { sws_free_context(&sws); return ret; } } - ret = ff_sws_graph_add_pass(graph, sws->dst_format, dst_w, dst_h, input, align, sws, + ret = ff_sws_graph_add_pass(graph, sws->dst_format, dst_w, dst_h, input, align, c->convert_unscaled ? run_legacy_unscaled : run_legacy_swscale, - &pass); + setup_legacy_swscale, sws, free_legacy_swscale, &pass); if (ret < 0) { sws_free_context(&sws); return ret; } - pass->setup = setup_legacy_swscale; - pass->free = free_legacy_swscale; /** * For slice threading, we need to create sub contexts, similar to how @@ -465,7 +466,7 @@ static int init_legacy_subpass(SwsGraph *graph, SwsContext *sws, if (c->dstXYZ && !(c->srcXYZ && unscaled)) { ret = ff_sws_graph_add_pass(graph, AV_PIX_FMT_RGB48, dst_w, dst_h, pass, - 1, c, run_rgb2xyz, &pass); + 1, run_rgb2xyz, NULL, c, NULL, &pass); if (ret < 0) return ret; } @@ -702,13 +703,12 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, } ret = ff_sws_graph_add_pass(graph, fmt_out, src.width, src.height, - input, 1, lut, run_lut3d, &pass); + input, 1, run_lut3d, setup_lut3d, lut, + free_lut3d, &pass); if (ret < 0) { ff_sws_lut3d_free(&lut); return ret; } - pass->setup = setup_lut3d; - pass->free = free_lut3d; *output = pass; return 0; @@ -743,7 +743,7 @@ static int init_passes(SwsGraph *graph) /* Add threaded memcpy pass */ ret = ff_sws_graph_add_pass(graph, dst.format, dst.width, dst.height, - pass, 1, NULL, run_copy, &pass); + pass, 1, run_copy, NULL, NULL, NULL, &pass); if (ret < 0) return ret; } diff --git a/libswscale/graph.h b/libswscale/graph.h index 25aae12e4c..be535cd416 100644 --- a/libswscale/graph.h +++ b/libswscale/graph.h @@ -158,14 +158,17 @@ int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat * * @param h Height of the output image. * @param input Previous pass to read from, or NULL for the input image. * @param align Minimum slice alignment for this pass, or 0 for no threading. - * @param priv Private state for the filter run function. * @param run Filter function to run. + * @param setup Optional setup function to run from the main thread. + * @param priv Private state for the filter run function. + * @param free Function to free the private state. * @param out_pass The newly added pass will be written here on success. * @return 0 or a negative error code */ int ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, int width, int height, SwsPass *input, - int align, void *priv, SwsPassFunc run, + int align, SwsPassFunc run, SwsPassSetup setup, + void *priv, void (*free)(void *priv), SwsPass **out_pass); /** diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c index 0a6911f9b5..008a3b7bdb 100644 --- a/libswscale/ops_dispatch.c +++ b/libswscale/ops_dispatch.c @@ -349,14 +349,11 @@ static int compile(SwsGraph *graph, const SwsOpList *ops, SwsPass *pass; ret = ff_sws_graph_add_pass(graph, dst->format, dst->width, dst->height, - input, p->comp.slice_align, p, op_pass_run, - &pass); + input, p->comp.slice_align, op_pass_run, + op_pass_setup, p, op_pass_free, &pass); if (ret < 0) goto fail; - pass->setup = op_pass_setup; - pass->free = op_pass_free; - *output = pass; return 0; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
