Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avfilter/vf_xfade: fixed slideleft/slideright/slideup/slidedown bug
@ 2022-07-12 14:18 George Floarea
  0 siblings, 0 replies; only message in thread
From: George Floarea @ 2022-07-12 14:18 UTC (permalink / raw)
  To: ffmpeg-devel

zx and zy comparison were wrong when zx=0 or zy=0. This resulted in the 
wrong column/row being chosen.
This can be seen best when using xfade on streams with transparency.

For example: in case of a slideleft transition, the first column from 
the first input will overwrite the first column of the second stream 
throught the transition.
https://www.youtube.com/shorts/qSMuDSg_K9g

Signed-off-by: George Floarea <floareageorge@gmail.com>
---
  libavfilter/vf_xfade.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c
index 294928c134..9f66927365 100644
--- a/libavfilter/vf_xfade.c
+++ b/libavfilter/vf_xfade.c
@@ -433,7 +433,7 @@ static void 
slideleft##name##_transition(AVFilterContext *ctx,
              for (int x = 0; x < width; x++) { 
                \
                  const int zx = z + x; 
                \
                  const int zz = zx % width + width * (zx < 0); 
                \
-                dst[x] = (zx > 0) && (zx < width) ? xf1[zz] : xf0[zz]; 
               \
+                dst[x] = (zx >= 0) && (zx < width) ? xf1[zz] : xf0[zz]; 
              \
              } 
                \
 
                \
              dst += out->linesize[p] / div; 
                \
@@ -466,7 +466,7 @@ static void 
slideright##name##_transition(AVFilterContext *ctx,
              for (int x = 0; x < out->width; x++) { 
                \
                  const int zx = z + x; 
                \
                  const int zz = zx % width + width * (zx < 0); 
                \
-                dst[x] = (zx > 0) && (zx < width) ? xf1[zz] : xf0[zz]; 
               \
+                dst[x] = (zx >= 0) && (zx < width) ? xf1[zz] : xf0[zz]; 
              \
              } 
                \
 
                \
              dst += out->linesize[p] / div; 
                \
@@ -499,7 +499,7 @@ static void 
slideup##name##_transition(AVFilterContext *ctx,
              const type *xf1 = (const type *)(b->data[p] + zz * 
b->linesize[p]);     \
 
               \
              for (int x = 0; x < out->width; x++) { 
               \
-                dst[x] = (zy > 0) && (zy < height) ? xf1[x] : xf0[x]; 
              \
+                dst[x] = (zy >= 0) && (zy < height) ? xf1[x] : xf0[x]; 
              \
              } 
               \
 
               \
              dst += out->linesize[p] / div; 
               \
@@ -530,7 +530,7 @@ static void 
slidedown##name##_transition(AVFilterContext *ctx,
              const type *xf1 = (const type *)(b->data[p] + zz * 
b->linesize[p]);     \
 
               \
              for (int x = 0; x < out->width; x++) { 
               \
-                dst[x] = (zy > 0) && (zy < height) ? xf1[x] : xf0[x]; 
              \
+                dst[x] = (zy >= 0) && (zy < height) ? xf1[x] : xf0[x]; 
              \
              } 
               \
 
               \
              dst += out->linesize[p] / div; 
               \
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-12 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 14:18 [FFmpeg-devel] [PATCH] avfilter/vf_xfade: fixed slideleft/slideright/slideup/slidedown bug George Floarea

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git