vf_xfade: fix the wrap-around of the slide transitions

At the first transition frame the offset equals the frame size, so the
first row or column had a remainder of zero and was still pushed up by
one size, reading past the plane.
This commit is contained in:
Lynne committed 2026-09-24 08:06:25 +09:00
1 parent c9a6817e3d
commit 16a4ce48c7
1 file changed
+4 -4
+4 -4
View File
@@ -469,7 +469,7 @@ static void slideleft##name##_transition(AVFilterContext *ctx,
for (int y = 0; y < height; y++) { \
for (int x = 0; x < width; x++) { \
const int zx = z + x; \
const int zz = zx % width + width * (zx < 0); \
const int zz = zx % width + width * (zx % width < 0); \
dst[x] = (zx >= 0) && (zx < width) ? xf1[zz] : xf0[zz]; \
} \
\
@@ -502,7 +502,7 @@ static void slideright##name##_transition(AVFilterContext *ctx,
for (int y = 0; y < height; y++) { \
for (int x = 0; x < width; x++) { \
const int zx = z + x; \
const int zz = zx % width + width * (zx < 0); \
const int zz = zx % width + width * (zx % width < 0); \
dst[x] = (zx >= 0) && (zx < width) ? xf1[zz] : xf0[zz]; \
} \
\
@@ -532,7 +532,7 @@ static void slideup##name##_transition(AVFilterContext *ctx,
\
for (int y = slice_start; y < slice_end; y++) { \
const int zy = z + y; \
const int zz = zy % height + height * (zy < 0); \
const int zz = zy % height + height * (zy % height < 0); \
const type *xf0 = (const type *)(a->data[p] + zz * a->linesize[p]); \
const type *xf1 = (const type *)(b->data[p] + zz * b->linesize[p]); \
\
@@ -564,7 +564,7 @@ static void slidedown##name##_transition(AVFilterContext *ctx,
\
for (int y = slice_start; y < slice_end; y++) { \
const int zy = z + y; \
const int zz = zy % height + height * (zy < 0); \
const int zz = zy % height + height * (zy % height < 0); \
const type *xf0 = (const type *)(a->data[p] + zz * a->linesize[p]); \
const type *xf1 = (const type *)(b->data[p] + zz * b->linesize[p]); \
\