This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit afa08f49711c73d029e4f8de921b0f0b772994e2 Author: Niklas Haas <[email protected]> AuthorDate: Sat Feb 21 14:51:36 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Mon Feb 23 19:39:17 2026 +0000 swscale/graph: duplicate buffer dimensions in SwsPassBuffer When multiple passes share a buffer reference, the true buffer dimensions may be different for each pass, depending on slice alignment. So we can't rely on the pass dimensions being representative. Instead, store this information in the SwsPassBuffer itself. Signed-off-by: Niklas Haas <[email protected]> --- libswscale/graph.c | 11 +++++++---- libswscale/graph.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libswscale/graph.c b/libswscale/graph.c index 5d697b2660..efe6bf7c2a 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -42,9 +42,8 @@ static int pass_alloc_output(SwsPass *pass) return 0; SwsPassBuffer *output = &pass->output; - output->img.fmt = pass->format; - return av_image_alloc(output->img.data, output->img.linesize, pass->width, - pass->num_slices * pass->slice_h, pass->format, 64); + return av_image_alloc(output->img.data, output->img.linesize, output->width, + output->height, output->img.fmt, 64); } SwsPass *ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, @@ -63,7 +62,6 @@ SwsPass *ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, pass->width = width; pass->height = height; pass->input = input; - pass->output.img.fmt = AV_PIX_FMT_NONE; ret = pass_alloc_output(input); if (ret < 0) { @@ -80,6 +78,11 @@ SwsPass *ff_sws_graph_add_pass(SwsGraph *graph, enum AVPixelFormat fmt, pass->num_slices = (pass->height + pass->slice_h - 1) / pass->slice_h; } + /* Align output buffer to include extra slice padding */ + pass->output.img.fmt = fmt; + pass->output.width = pass->width; + pass->output.height = pass->slice_h * pass->num_slices; + ret = av_dynarray_add_nofree(&graph->passes, &graph->num_passes, pass); if (ret < 0) av_freep(&pass); diff --git a/libswscale/graph.h b/libswscale/graph.h index b5f7ed5ff2..b3d5aa5dbe 100644 --- a/libswscale/graph.h +++ b/libswscale/graph.h @@ -65,6 +65,7 @@ typedef void (*sws_filter_run_t)(const SwsImg *out, const SwsImg *in, */ typedef struct SwsPassBuffer { SwsImg img; + int width, height; /* dimensions of this buffer */ } SwsPassBuffer; /** _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
