[FFmpeg-cvslog] avfilter/vf_overlay: unbreak alpha composition with negative y and threads > 1
Paul B Mahol
git at videolan.org
Thu Oct 14 21:05:54 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Oct 14 19:58:56 2021 +0200| [e1b820fa339a9cc3178105ff2c05611e8e751852] | committer: Paul B Mahol
avfilter/vf_overlay: unbreak alpha composition with negative y and threads > 1
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1b820fa339a9cc3178105ff2c05611e8e751852
---
libavfilter/vf_overlay.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 2966cef09c..685b6069a6 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -574,15 +574,16 @@ static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, c
const uint##depth##_t max = (1 << nbits) - 1; \
int bytes = depth / 8; \
\
- imax = FFMIN(-y + dst_h, src_h); \
- slice_start = (imax * jobnr) / nb_jobs; \
- slice_end = ((imax * (jobnr+1)) / nb_jobs); \
- \
+ imax = FFMIN3(-y + dst_h, FFMIN(src_h, dst_h), y + src_h); \
i = FFMAX(-y, 0); \
- sa = (uint##depth##_t *)(src->data[3] + (i + slice_start) * src->linesize[3]); \
- da = (uint##depth##_t *)(dst->data[3] + (y + i + slice_start) * dst->linesize[3]); \
\
- for (i = i + slice_start; i < slice_end; i++) { \
+ slice_start = i + (imax * jobnr) / nb_jobs; \
+ slice_end = i + ((imax * (jobnr+1)) / nb_jobs); \
+ \
+ sa = (uint##depth##_t *)(src->data[3] + (slice_start) * src->linesize[3]); \
+ da = (uint##depth##_t *)(dst->data[3] + (y + slice_start) * dst->linesize[3]); \
+ \
+ for (i = slice_start; i < slice_end; i++) { \
j = FFMAX(-x, 0); \
s = sa + j; \
d = da + x+j; \
More information about the ffmpeg-cvslog
mailing list