From patchwork Mon Aug 21 20:45:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Scholz X-Patchwork-Id: 43284 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:47ca:b0:130:ccc6:6c4b with SMTP id ey10csp1675751pzb; Mon, 21 Aug 2023 13:46:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1KBy9YUyd6kOrTOSdMKo/PfOzwiEGOq8i6j/ktyNN/5RJvOO+80opRN90ahurvhCyNeXr X-Received: by 2002:aa7:d14d:0:b0:525:5a63:5f8e with SMTP id r13-20020aa7d14d000000b005255a635f8emr6118397edo.27.1692650789017; Mon, 21 Aug 2023 13:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692650789; cv=none; d=google.com; s=arc-20160816; b=cVa1kNzUijrBAMAQmPFkadbgUwLxW6ZUjCELaKsQuDeGrTqM6XkkQO9YfQcYZvL/g3 gTpJ3dpQqOOq3m2WVZrXkB2fL82Tfr4hzsjKPWYbOQjs2meLfD33ISMRNmb7TtMmNDXY Xo9YDFwGQMe+cpOcYxZCDw3UxyXmqKCfH1LVw3hF/qPKMbfd17LX6iOlnsoFlg60DkYe Hu+UiViZ/mOErrAZhvEZm/200OGAX7ADbSxzA1L9cxA4IZUZN81c4XVT6ekCoeYYGe8R hsG1G88zjnfL9OxrDBfaqYXr8xyS8+JLGxy9owPSlYqLSnHdTZNVElyJ7QaSyohAyRX0 8XxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=oc5zRe7336lz0orZan6sTPw20FuubGb2rVTWuShsyT8=; fh=nwMvC2rEvrxw3oi8lhns+cXSV39bEdECtcaEBNnUVDY=; b=pZGz+R6pYDlbC+XlWWqEbLfDyby45KqQuPOqFqGxHa91tVxmI+Nf9Aqj/ph3g7uH2N 1XyNJbfg/cK/yrrtq8GlwL+/TngKzzECpF25idYHnzM1idhWJ2ZAcE0Gw/x+WkVs1Coa NN1/QDLpntXLtKSFJK+uD3msOn/rtfbMEvMXySLhBmcptsq+NgjaQMwx5pAMdMeBawtI WBZnH4cRAyCfJ9p2eW0n4JTVWpSYqNrfHcsXNlobm0DVf38bQgleSATskuzPiVxOiiSp 4REFwE9eMLjNkHzSSTG+F8SjHhRkp2R6btAwNQvztDxay5dA/Byv0/jo+EkZrQz9Mssu ueug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=ol3bILi0; 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 n18-20020a056402515200b00523d2b12507si6168659edd.414.2023.08.21.13.46.28; Mon, 21 Aug 2023 13:46:29 -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=20221208 header.b=ol3bILi0; 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 B0A9868C430; Mon, 21 Aug 2023 23:45:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A22468C404 for ; Mon, 21 Aug 2023 23:45:48 +0300 (EEST) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-4fe27849e6aso5680500e87.1 for ; Mon, 21 Aug 2023 13:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692650748; x=1693255548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RwrCLM+Xm3bt80Hb34ktn7tX6+HVdgiHQleR5U2hkD0=; b=ol3bILi00n9J94A7HQ/4qMhguhKp1v+YwcvaYyDqsWMJZ4UIkpa5sZhKb0OGDuSInl ZUGoHZKyqFBmfJMVekSyaKmJCFrBdCz93MOfZR8aaLIEVkOJY3giFsL43wVOosVIZY+8 S7Y9McdJm4rYVwrJr/H/7X4P3QwxLRjzQXvClGO1peA5PKiT3vl6cah/2W9WCArVmPG5 QXFf9BGCaDB10oil7+kcFEQmUtfSZm3K9FQSpdZtSj3pXnHEjbHpSoCu3uShsw1AW+ON shwg9t4MFSx4McbFlwuDLLL6yVGVP+EFTlCVb0tnVzVulOaQz/tOYcJ5zNQSlVt7IMe3 ohRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692650748; x=1693255548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RwrCLM+Xm3bt80Hb34ktn7tX6+HVdgiHQleR5U2hkD0=; b=fmjVUfuq9zjdYz0SuFj/GmrP1ZmxPqJGWyQ0LByigfiJzFG4V1LYXL++XjR5emUmH1 CawA+Hvw+15mgzw98RiHgxUnyoOwkh+eASkBzhwZZrrcnbQ3NWpAFnKZS59q6kcXRB6Q UuxcRG/mO3PuKx1Yd7W5QCbp5mYc2gobjFbyOr/8sHsBqejLx4rkoGn3MRw1/SR1SeuJ iCV04mXKCSCzru4N08u5eU8L53P0CCoQou4rk2LO0O7QMCFYNG/yrlG1urTJl8sYzkM9 QHxTOQXET865nreJKBst62HYB1fRDpsIaDulwwRvPRdeX4CZDIfRYmINXKnN6f0PxKWb mpqg== X-Gm-Message-State: AOJu0Yx6NvzTPHvdrnk8dhVQnhVkqaZ4DHbfFGCLE5OG/ElhctAK3dzq m3vlCK8rG0GXTLhCvdq/WOtXLe6TfkwCicPx X-Received: by 2002:a05:6512:3e18:b0:4f8:770f:1b08 with SMTP id i24-20020a0565123e1800b004f8770f1b08mr5955560lfv.13.1692650747365; Mon, 21 Aug 2023 13:45:47 -0700 (PDT) Received: from MBP-von-Marvin.citadel.scalie.me (84-112-104-25.cable.dynamic.surfer.at. [84.112.104.25]) by smtp.gmail.com with ESMTPSA id z14-20020a1709064e0e00b0099293cdbc98sm7102176eju.145.2023.08.21.13.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 13:45:46 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Aug 2023 22:45:27 +0200 Message-Id: <20230821204527.4494-5-epirat07@gmail.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230821204527.4494-1-epirat07@gmail.com> References: <20230724214727.40253-1-epirat07@gmail.com> <20230821204527.4494-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 5/5] lavfi/vf_xfade_vulkan: add wipes 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 Cc: Marvin Scholz Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3GQTSAsKDhPO Add the wipetl, wipetr, wipebl, wipebr effects. --- libavfilter/vf_xfade_vulkan.c | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/libavfilter/vf_xfade_vulkan.c b/libavfilter/vf_xfade_vulkan.c index 283a8e0710..fdad8c913d 100644 --- a/libavfilter/vf_xfade_vulkan.c +++ b/libavfilter/vf_xfade_vulkan.c @@ -81,6 +81,10 @@ enum XFadeTransitions { CIRCLECLOSE, DISSOLVE, PIXELIZE, + WIPETL, + WIPETR, + WIPEBL, + WIPEBR, NB_TRANSITIONS, }; @@ -246,6 +250,54 @@ static const char transition_pixelize[] = { C(0, } ) }; +static const char transition_wipetl[] = { + C(0, void transition(int idx, ivec2 pos, float progress) ) + C(0, { ) + C(1, ivec2 size = imageSize(output_images[idx]); ) + C(1, float zw = size.x * (1.0 - progress); ) + C(1, float zh = size.y * (1.0 - progress); ) + C(1, vec4 a = texture(a_images[idx], pos); ) + C(1, vec4 b = texture(b_images[idx], pos); ) + C(1, imageStore(output_images[idx], pos, (pos.y <= zh && pos.x <= zw) ? a : b); ) + C(0, } ) +}; + +static const char transition_wipetr[] = { + C(0, void transition(int idx, ivec2 pos, float progress) ) + C(0, { ) + C(1, ivec2 size = imageSize(output_images[idx]); ) + C(1, float zw = size.x * (progress); ) + C(1, float zh = size.y * (1.0 - progress); ) + C(1, vec4 a = texture(a_images[idx], pos); ) + C(1, vec4 b = texture(b_images[idx], pos); ) + C(1, imageStore(output_images[idx], pos, (pos.y <= zh && pos.x > zw) ? a : b); ) + C(0, } ) +}; + +static const char transition_wipebl[] = { + C(0, void transition(int idx, ivec2 pos, float progress) ) + C(0, { ) + C(1, ivec2 size = imageSize(output_images[idx]); ) + C(1, float zw = size.x * (1.0 - progress); ) + C(1, float zh = size.y * (progress); ) + C(1, vec4 a = texture(a_images[idx], pos); ) + C(1, vec4 b = texture(b_images[idx], pos); ) + C(1, imageStore(output_images[idx], pos, (pos.y > zh && pos.x <= zw) ? a : b); ) + C(0, } ) +}; + +static const char transition_wipebr[] = { + C(0, void transition(int idx, ivec2 pos, float progress) ) + C(0, { ) + C(1, ivec2 size = imageSize(output_images[idx]); ) + C(1, float zw = size.x * (progress); ) + C(1, float zh = size.y * (progress); ) + C(1, vec4 a = texture(a_images[idx], pos); ) + C(1, vec4 b = texture(b_images[idx], pos); ) + C(1, imageStore(output_images[idx], pos, (pos.y > zh && pos.x > zw) ? a : b); ) + C(0, } ) +}; + static const char* transitions_map[NB_TRANSITIONS] = { [FADE] = transition_fade, [WIPELEFT] = transition_wipeleft, @@ -260,6 +312,10 @@ static const char* transitions_map[NB_TRANSITIONS] = { [CIRCLECLOSE] = transition_circleclose, [DISSOLVE] = transition_dissolve, [PIXELIZE] = transition_pixelize, + [WIPETL] = transition_wipetl, + [WIPETR] = transition_wipetr, + [WIPEBL] = transition_wipebl, + [WIPEBR] = transition_wipebr, }; static av_cold int init_vulkan(AVFilterContext *avctx) @@ -614,6 +670,10 @@ static const AVOption xfade_vulkan_options[] = { { "circleclose", "circleclose transition", 0, AV_OPT_TYPE_CONST, {.i64=CIRCLECLOSE}, 0, 0, FLAGS, "transition" }, { "dissolve", "dissolve transition", 0, AV_OPT_TYPE_CONST, {.i64=DISSOLVE}, 0, 0, FLAGS, "transition" }, { "pixelize", "pixelize transition", 0, AV_OPT_TYPE_CONST, {.i64=PIXELIZE}, 0, 0, FLAGS, "transition" }, + { "wipetl", "wipe top left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPETL}, 0, 0, FLAGS, "transition" }, + { "wipetr", "wipe top right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPETR}, 0, 0, FLAGS, "transition" }, + { "wipebl", "wipe bottom left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEBL}, 0, 0, FLAGS, "transition" }, + { "wipebr", "wipe bottom right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEBR}, 0, 0, FLAGS, "transition" }, { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS }, { "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS }, { NULL }