This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 13133e0b3234aa1031c74320070739bd90d8549e Author: Michael Niedermayer <[email protected]> AuthorDate: Thu Oct 15 04:46:24 2026 +0200 Commit: michaelni <[email protected]> CommitDate: Mon Oct 19 23:51:00 2026 +0000 avfilter: use ff_slice_pos() in the remaining slice threaded filters This is a behavior preserving change for all non-overflowing cases. Found during triage of the security report GIRN0tvt58WQ Signed-off-by: Michael Niedermayer <[email protected]> --- libavfilter/vf_framerate.c | 4 ++-- libavfilter/vf_hflip.c | 4 ++-- libavfilter/vf_lenscorrection.c | 8 ++++---- libavfilter/vf_perspective.c | 8 ++++---- libavfilter/vf_readeia608.c | 4 ++-- libavfilter/vf_rotate.c | 4 ++-- libavfilter/vsrc_gradients.c | 12 ++++++------ libavfilter/vsrc_sierpinski.c | 8 ++++---- libavfilter/vsrc_testsrc.c | 4 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index 468042e7db..d603483c29 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -101,8 +101,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) int plane; for (plane = 0; plane < 4 && src1->data[plane] && src2->data[plane]; plane++) { - const int start = (s->height[plane] * job ) / nb_jobs; - const int end = (s->height[plane] * (job+1)) / nb_jobs; + const int start = ff_slice_pos(s->height[plane], job, nb_jobs); + const int end = ff_slice_pos(s->height[plane], job + 1, nb_jobs); uint8_t *src1_data = src1->data[plane] + start * src1->linesize[plane]; uint8_t *src2_data = src2->data[plane] + start * src2->linesize[plane]; uint8_t *dst_data = work->data[plane] + start * work->linesize[plane]; diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 8f8dd14240..2c1c2c4120 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -93,8 +93,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) { const int width = s->planewidth[plane] / s->bayer_plus1; const int height = s->planeheight[plane]; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); step = s->max_step[plane]; diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c index 15c2e99e4b..945e456c41 100644 --- a/libavfilter/vf_lenscorrection.c +++ b/libavfilter/vf_lenscorrection.c @@ -86,8 +86,8 @@ static int filter##name##_slice(AVFilterContext *ctx, void *arg, int job, \ const int w = rect->planewidth[plane], h = rect->planeheight[plane]; \ const int xcenter = rect->cx * w; \ const int ycenter = rect->cy * h; \ - const int start = (h * job ) / nb_jobs; \ - const int end = (h * (job+1)) / nb_jobs; \ + const int start = ff_slice_pos(h, job, nb_jobs); \ + const int end = ff_slice_pos(h, job + 1, nb_jobs); \ const int inlinesize = in->linesize[plane] / sizeof(type); \ const int outlinesize = out->linesize[plane] / sizeof(type); \ const type *indata = (const type *)in->data[plane]; \ @@ -128,8 +128,8 @@ static int filter##name##_slice_bilinear(AVFilterContext *ctx, void *arg, \ const int w = rect->planewidth[plane], h = rect->planeheight[plane]; \ const int xcenter = rect->cx * w; \ const int ycenter = rect->cy * h; \ - const int start = (h * job ) / nb_jobs; \ - const int end = (h * (job+1)) / nb_jobs; \ + const int start = ff_slice_pos(h, job, nb_jobs); \ + const int end = ff_slice_pos(h, job + 1, nb_jobs); \ const int inlinesize = in->linesize[plane] / sizeof(type); \ const int outlinesize = out->linesize[plane] / sizeof(type); \ const type *indata = (const type *)in->data[plane]; \ diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c index 58510f6f13..184de78d36 100644 --- a/libavfilter/vf_perspective.c +++ b/libavfilter/vf_perspective.c @@ -286,8 +286,8 @@ static int resample_cubic(AVFilterContext *ctx, void *arg, int h = td->h; int hsub = td->hsub; int vsub = td->vsub; - int start = (h * job) / nb_jobs; - int end = (h * (job+1)) / nb_jobs; + int start = ff_slice_pos(h, job, nb_jobs); + int end = ff_slice_pos(h, job + 1, nb_jobs); const int linesize = s->linesize[0]; int x, y; @@ -365,8 +365,8 @@ static int resample_linear(AVFilterContext *ctx, void *arg, int h = td->h; int hsub = td->hsub; int vsub = td->vsub; - int start = (h * job) / nb_jobs; - int end = (h * (job+1)) / nb_jobs; + int start = ff_slice_pos(h, job, nb_jobs); + int end = ff_slice_pos(h, job + 1, nb_jobs); const int linesize = s->linesize[0]; int x, y; diff --git a/libavfilter/vf_readeia608.c b/libavfilter/vf_readeia608.c index 605ca86d17..86e9019356 100644 --- a/libavfilter/vf_readeia608.c +++ b/libavfilter/vf_readeia608.c @@ -446,8 +446,8 @@ static int extract_lines(AVFilterContext *ctx, void *arg, ReadEIA608Context *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; const int h = s->end - s->start + 1; - const int start = (h * job) / nb_jobs; - const int end = (h * (job+1)) / nb_jobs; + const int start = ff_slice_pos(h, job, nb_jobs); + const int end = ff_slice_pos(h, job + 1, nb_jobs); AVFrame *in = arg; for (int i = start; i < end; i++) { diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index 740acfe3bd..4640f175bb 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -420,8 +420,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) const int plane = td->plane; const int xi = td->xi, yi = td->yi; const int c = td->c, s = td->s; - const int start = (outh * job ) / nb_jobs; - const int end = (outh * (job+1)) / nb_jobs; + const int start = ff_slice_pos(outh, job, nb_jobs); + const int end = ff_slice_pos(outh, job + 1, nb_jobs); int xprime = td->xprime + start * s; int yprime = td->yprime + start * c; int i, j, x, y; diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index cb1b73773f..d6294d3309 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -254,8 +254,8 @@ static int draw_gradients_slice(AVFilterContext *ctx, void *arg, int job, int nb AVFrame *frame = arg; const int width = frame->width; const int height = frame->height; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); const ptrdiff_t linesize = frame->linesize[0] / 4; uint32_t *dst = (uint32_t *)frame->data[0] + start * linesize; const int type = s->type; @@ -278,8 +278,8 @@ static int draw_gradients_slice16(AVFilterContext *ctx, void *arg, int job, int AVFrame *frame = arg; const int width = frame->width; const int height = frame->height; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); const ptrdiff_t linesize = frame->linesize[0] / 8; uint64_t *dst = (uint64_t *)frame->data[0] + start * linesize; const int type = s->type; @@ -302,8 +302,8 @@ static int draw_gradients_slice32_planar(AVFilterContext *ctx, void *arg, int jo AVFrame *frame = arg; const int width = frame->width; const int height = frame->height; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); const ptrdiff_t linesize_g = frame->linesize[0] / 4; const ptrdiff_t linesize_b = frame->linesize[1] / 4; const ptrdiff_t linesize_r = frame->linesize[2] / 4; diff --git a/libavfilter/vsrc_sierpinski.c b/libavfilter/vsrc_sierpinski.c index c9134184a5..77a0c6cdc2 100644 --- a/libavfilter/vsrc_sierpinski.c +++ b/libavfilter/vsrc_sierpinski.c @@ -91,8 +91,8 @@ static int draw_triangle_slice(AVFilterContext *ctx, void *arg, int job, int nb_ AVFrame *frame = arg; const int width = frame->width; const int height = frame->height; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); uint8_t *dst = frame->data[0] + start * frame->linesize[0]; for (int y = start; y < end; y++) { @@ -116,8 +116,8 @@ static int draw_carpet_slice(AVFilterContext *ctx, void *arg, int job, int nb_jo AVFrame *frame = arg; const int width = frame->width; const int height = frame->height; - const int start = (height * job ) / nb_jobs; - const int end = (height * (job+1)) / nb_jobs; + const int start = ff_slice_pos(height, job, nb_jobs); + const int end = ff_slice_pos(height, job + 1, nb_jobs); uint8_t *dst = frame->data[0] + start * frame->linesize[0]; for (int y = start; y < end; y++) { diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 697b94d4e8..1beb7d7e4a 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -2131,8 +2131,8 @@ static int zoneplate_fill_slice_##name(AVFilterContext *ctx, \ const int ky = test->ky, kx = test->kx, kxy = test->kxy; \ const int lut_mask = (1 << test->lut_precision) - 1; \ const int nkt2t = kt2 * t * t, nktt = kt * t; \ - const int start = (h * job ) / nb_jobs; \ - const int end = (h * (job+1)) / nb_jobs; \ + const int start = ff_slice_pos(h, job, nb_jobs); \ + const int end = ff_slice_pos(h, job + 1, nb_jobs); \ const ptrdiff_t ylinesize = frame->linesize[0] / sizeof(type); \ const ptrdiff_t ulinesize = frame->linesize[1] / sizeof(type); \ const ptrdiff_t vlinesize = frame->linesize[2] / sizeof(type); \ -- 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]
