diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index fc1b35ebe4..d2da541ffe 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -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]); \ \