This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/6.1
in repository ffmpeg.

commit d85e275b1fb5eec7876e0a6da20c6fe79ca5babf
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Jun 7 21:38:20 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Jun 14 20:01:26 2026 +0200

    avfilter: add ff_slice_pos() helper for slice boundaries
    
    Slice based filter workers compute their per-thread row/sample/channel
    boundaries as total * jobnr / nb_jobs. The total * jobnr product is
    evaluated in int and overflows signed int for large dimensions and many
    slice threads, before the division by nb_jobs brings it back in range.
    
    (cherry picked from commit 218b4771a32153c434f1e87e5c3063c01c51c432)
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit 22102ab24ce7b6af4b0d721af15744becc146a70)
---
 libavfilter/filters.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 86bc49d459..69411d3aa7 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -266,4 +266,19 @@ static inline void ff_outlink_set_status(AVFilterLink 
*link, int status, int64_t
  */
 int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink);
 
+/**
+ * Compute the boundary index for a slice when work of size total is split
+ * into nb_jobs slices. Returns the first index of slice jobnr, so the slice
+ * jobnr covers [ff_slice_pos(total, jobnr, nb_jobs),
+ * ff_slice_pos(total, jobnr + 1, nb_jobs)).
+ *
+ * The multiplication is performed in 64bit to avoid signed overflow of the
+ * total * jobnr intermediate that would occur for large dimensions and many
+ * slice threads.
+ */
+static inline int ff_slice_pos(int total, int jobnr, int nb_jobs)
+{
+    return (int)((int64_t)total * jobnr / nb_jobs);
+}
+
 #endif /* AVFILTER_FILTERS_H */

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to