From patchwork Tue Jul 12 14:18:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Floarea X-Patchwork-Id: 36760 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:6da0:b0:8b:e47:9dbf with SMTP id wl32csp2051546pzb; Tue, 12 Jul 2022 07:18:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbvxryXRs92HlM/MwTq5F6RTqveR6/nYQL6ZT7/mNW/Eqxo0o3l1S59SFsLKk1jYPkUWzb X-Received: by 2002:a17:907:7287:b0:726:c82f:f1bf with SMTP id dt7-20020a170907728700b00726c82ff1bfmr24216892ejc.284.1657635496734; Tue, 12 Jul 2022 07:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657635496; cv=none; d=google.com; s=arc-20160816; b=Hb42V+03BCxZ1Oz3Emz832dZJ1YksZPwj+oOJeYHJ9SD5A0Rj3nxY9JfMAUTLNoQVj 7lwqzRVEFHgMcphH49wqAjbOkdzxjzDWpoQu9a5RiSCYXke6KPKLlQlXspNH2ltmTT+o Y3JhKC/Q4OApIQ4quDe7kQ5dLhZknjt6Cil3qBec5fshjiNTtG5DnJHgF6IoWYJh4w9J SOZ6e6JJQ8cuhjhBF9VsrbCvbjluPEcvTTRofEgSYHf1NJ2L9HtLiWT9hIcNNwn10uq0 v47zSqz35H5KECtuKI/3B2GIzLEfrFHLg8Ahk7iQ9xRMybqrSZAWqQp8cjXpTYbhp4hT LsaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:to:from:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=EqeB4BhIi2+hl9pA874FjH6YV2p+d/ajANR57pHunzM=; b=BOip5qq/IRj3m9ZFQx1HGwbbHYGv7kj4gvzDyJ4/3CAtBfrFdRwNt/cN1zRWXpbKYw vNExKxFJ5xG1i3x5Q+XKbqhLme4m1dMXDDTpbT/L+3jheqbLWfwbV3Emlo9ZkzPiJeoa purJBq4UB80AEFidD11lYudGRX7uiKTYvtpLHQk4rivMVJW5DqeYwT+gnt5PPJyWq2ms QfI5cCAj3+Hrole3RlOicDWeqjdJU4KbWKdbT3U6w5XXIGsOU2k0/33ufWwgzJPpSNih PsGjOy3/OAi0gJb8Fz1G+s9rhkXaZINq2KQ8SN3Ks/TjVZUNHWNqHTqISlL5IC+LyI57 9cJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ID3K6YNn; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qk14-20020a1709077f8e00b006feba25b350si14541186ejc.106.2022.07.12.07.18.16; Tue, 12 Jul 2022 07:18:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ID3K6YNn; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8A1568B813; Tue, 12 Jul 2022 17:18:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 735F068B813 for ; Tue, 12 Jul 2022 17:18:07 +0300 (EEST) Received: by mail-ed1-f42.google.com with SMTP id t3so10053457edd.0 for ; Tue, 12 Jul 2022 07:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to :content-language:content-transfer-encoding; bh=mTemimFSfuuY89e9Y237CieMQWJ+tYaIGKDG/ia+/s4=; b=ID3K6YNnIKbD61TPpeFXpbPCJsIWCb6mJx1FH+kfcs43Lf9o6Uf3XUQV5ofPMvUP3v jowxH3HdJpsTF5NeYd8xN4bb45xSVaHzp/Kd5LwOwGgYZnDJAo18UldO1FpZTQHRrGaj 2SmwcGEEmf2a7juOU4HcR1H8tpxYOUOYDaMgWqsSISW/Rlvj8yUv+SNCXI2qHQnZtHbK Rh4aa6d6vJrpF1ddtuiGq/9PFIOe8yssWq6Utd+ymP5lgHN6lu9ts4JRCHbLmAcrunX6 crWECWFp3fl2aoG02lfK0BJ8vG3vciqAzp7GLr7kfckDHcPks2hyBoQmQUlzBoEP1Ni7 Q8SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:content-language:content-transfer-encoding; bh=mTemimFSfuuY89e9Y237CieMQWJ+tYaIGKDG/ia+/s4=; b=sviz3SPsKI0kEHvRvSimLUgMFvC/VfAPV972JZXU4TylYv9+ne/kWXp3W7vJm6OagJ M738Bgcp3hOZKZ3z3QP9DOcAoMzOwLMawpQXBqa+tCFjsX5BVuOa9BWqGuTDt4kPtprv dcQs9U/HkI4bZNHuLo0mho2rL0odj8+ck4oW4MSIY9I23fTq24LctSzr0mXNlw6RsBXR gBX8bW4yxboyyXf+ixNv2ET3QtuMTnXK6ubnyz19u1WWzLxuFAdPdiIDodKBWTAoOBIg hcTpn4hjYIlBN88emzYvzyfpgppUMDLJ+zyovpyY4jgsXOZsi3J3FJcOt1ttwl5bl7Tj Abkw== X-Gm-Message-State: AJIora+mD+Jc31MWaCRj4GbTmV0VcyoVmQIf3OG0TSp0OIEncgRaf4xc y5UrWSm1F1usKkflyF9wHgr/MG03mLQ= X-Received: by 2002:a05:6402:695:b0:435:65f3:38c2 with SMTP id f21-20020a056402069500b0043565f338c2mr33190373edy.347.1657635486580; Tue, 12 Jul 2022 07:18:06 -0700 (PDT) Received: from ?IPV6:2a02:2f00:5209:6800:6a26:4ae9:8dce:b77f? ([2a02:2f00:5209:6800:6a26:4ae9:8dce:b77f]) by smtp.gmail.com with ESMTPSA id kx26-20020a170907775a00b00722c44f9301sm3787220ejc.224.2022.07.12.07.18.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jul 2022 07:18:06 -0700 (PDT) Message-ID: Date: Tue, 12 Jul 2022 17:18:04 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 From: George Floarea To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] avfilter/vf_xfade: fixed slideleft/slideright/slideup/slidedown bug X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qMO6J6mn8/IB 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 --- libavfilter/vf_xfade.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) - 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; \ 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); \