[FFmpeg-cvslog] avfilter/vf_overlay: Keep dst_step in bytes

Andreas Rheinhardt git at videolan.org
Tue Jun 17 01:59:06 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Jun  4 20:06:01 2025 +0200| [a4b3474de6d4df02b6473d335d74a46a0952bfd6] | committer: Andreas Rheinhardt

avfilter/vf_overlay: Keep dst_step in bytes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4b3474de6d4df02b6473d335d74a46a0952bfd6
---

 libavfilter/vf_overlay.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index cd92c7323b..17fe8e47c9 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -474,9 +474,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
     int slice_start, slice_end;                                                                            \
     const T max = (1 << nbits) - 1;                                                                        \
     const T mid = (1 << (nbits - 1));                                                                      \
-    int bytes = depth / 8;                                                                                 \
                                                                                                            \
-    dst_step /= bytes;                                                                                     \
     j = FFMAX(-yp, 0);                                                                                     \
     jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp);                                       \
                                                                                                            \
@@ -495,7 +493,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
         const T  *s = (const T *)sp + k;                                                                   \
         const T  *a = (const T *)ap + (k << hsub);                                                         \
         const T *da = main_has_alpha ? (T *)dap + ((xp + k) << hsub) : NULL;                               \
-        T *d  = (T *)dp + (xp + k) * dst_step;                                                             \
+        T *d  = (T *)(dp + (xp + k) * dst_step);                                                           \
         kmax = FFMIN(-xp + dst_wp, src_wp);                                                                \
                                                                                                            \
         if (nbits == 8 && ((vsub && j+1 < src_hp) || !vsub) && octx->blend_row[i]) {                       \
@@ -503,7 +501,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
                     (uint8_t*)a, kmax - k, src->linesize[3]);                                              \
                                                                                                            \
             s += c;                                                                                        \
-            d += dst_step * c;                                                                             \
+            d  = PTR_ADD(T, d, dst_step * c);                                                              \
             if (main_has_alpha)                                                                            \
                 da += (1 << hsub) * c;                                                                     \
             a += (1 << hsub) * c;                                                                          \
@@ -564,7 +562,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
                 }                                                                                          \
             }                                                                                              \
             s++;                                                                                           \
-            d += dst_step;                                                                                 \
+            d  = PTR_ADD(T, d, dst_step);                                                                  \
             if (main_has_alpha)                                                                            \
                 da += 1 << hsub;                                                                           \
             a += 1 << hsub;                                                                                \



More information about the ffmpeg-cvslog mailing list