From patchwork Thu May 19 13:47:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35828 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp80102pzb; Thu, 19 May 2022 06:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgOszkPvtaGTT4vVpbqN1R7Vi3MGUh6dSqI+KupEj67xDFtkh1uCLhEAQGUiRuuasO6Pcq X-Received: by 2002:a05:6402:5243:b0:427:caa4:f75 with SMTP id t3-20020a056402524300b00427caa40f75mr5385195edd.153.1652968069860; Thu, 19 May 2022 06:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652968069; cv=none; d=google.com; s=arc-20160816; b=hsi6yqXGfLlBSJpZwc0xlHDYrM7riU0crh17G8aU40y0AoMc06B9rVtIjDny4DUR4k FScxkYEJ0uog8QnDCsIE7sajzqug0SW5RcX3TWjelDEIZxWOVcHYkhv2TquBq+XGx5aF qUw2rz8YFuF0k7WItz/+h5GVUl+HbPqlvzGMvJ25cOIhs3hcDBpCSOjBPo5VsbLZOh0z FqEHX/zNZhw2cqqVmtcPz4o/hZKhpRkWqLHl9OIFGnzzgX/GScyKMZ5BjGwgBRepzPVc mb6fRvodSjD/iquh5CcKpT/7T6062vMHSTmm0y1l4hjR56B5uEJ7FHpOhyR0qzefwCn/ 9qqg== 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:mime-version:message-id:date:to:from :delivered-to; bh=++eGi4gWSmSKmeY6knFZtgRIwlIzwWLJJjoGZgPW3bk=; b=E8RW7w9OtAKEQGmcjz7zSfJooHX5qS43NY760Ldqhh1vnXaTHsn7HD6IfMzelG0PnE I36sM2XgAxz/fWE2oAydqjyPi3WBIYGliOvcW+KZTzKo50VgMJFhxj0epmJhfd8UBdoi TCarlChQBovUxOJrQCFrMzKZ5MjlyeS8updPPQ8tpw8BKusb3b5LysU91qUG14OmwewC k0/7WfBEREM7zO0jXEuL9jrsjayZaY8dVLoq7MeJMp26TEG7orbJ7nyoZfwR2NHoPtat gHG4yGp+3yExdBsse7GCp+LsB7r1endoPfEDa/1bdaBssfhL4tbn4aGK02UHlo3/LUpq wOpg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id kd9-20020a17090798c900b006f01fd542c2si5616391ejc.606.2022.05.19.06.47.49; Thu, 19 May 2022 06:47:49 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 11A5468B49C; Thu, 19 May 2022 16:47:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 608F9689F59 for ; Thu, 19 May 2022 16:47:38 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D64942404FE for ; Thu, 19 May 2022 15:47:37 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id oD0a2rs0fEgc for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 84B5D2400F5 for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 6A5293A06CD; Thu, 19 May 2022 15:47:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 May 2022 15:47:25 +0200 Message-Id: <20220519134728.15354-1-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier 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: mtkJMtay3OnS This function is always called indirectly, it cannot be inlined. --- libavfilter/vf_v360.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 7f377dd8f2..8f36d207c9 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -4239,7 +4239,7 @@ static void set_dimensions(int *outw, int *outh, int w, int h, const AVPixFmtDes } // Calculate remap data -static av_always_inline int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { V360Context *s = ctx->priv; SliceXYRemap *r = &s->slice_remap[jobnr]; From patchwork Thu May 19 13:47:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35831 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp80324pzb; Thu, 19 May 2022 06:48:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcpYP0cpq4ZWrSaZWFH3gMsNVoJYX/r1lDKfiqD/xDsap0leI/d62AcqPF1sh+XTrdBbpS X-Received: by 2002:aa7:cb48:0:b0:42a:addf:4bf1 with SMTP id w8-20020aa7cb48000000b0042aaddf4bf1mr5496324edt.283.1652968100765; Thu, 19 May 2022 06:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652968100; cv=none; d=google.com; s=arc-20160816; b=YXcH+/n4xThuUeGsKIZem0nou/HE5wd3Wnyq2XNDwHNv/lOHQOGVNxGSvyxp3zc4QA 1Ezc/Jj1iLMWitQvSVsLxNkwIq/urM4X9sRQkgNYOtmyaicZBntSJnz7COkOb8PgnxAs HIeC5Ii1AVq7netWug05CLnjC/h9KIox0w3u2LOzEnA8e073gJgG7JCRGPZJd4c+dNis 5zf2TC+wAw4DfS0LFVm80OjICAWMf/UBiqgUE4jg8EM75lfwfNOiAEfpxhmCR802eF5e vMctTMAC0nxcgJ1tjrwGXietXIxkRFjYL8+PX5gXHmqwuj4AH0P2ecV9NaYnqNJfvR0+ tT9A== 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:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ECNf3vy7mKxtanTDuYxyNI0lFMz7vxvbQaaDB+NF+Qw=; b=fxFsnKad9VBpe7XQwylq8eViQw/AHvgAO2h0P0obWtyo+EkvK9YH6CwJ9oPI8uatSh 6A2jIrWAJN2SN2EVvz0uGtWt/KjMkHzkO1su8ehFOEV8vN7z/+mgZWB11LhMoYiVVAT2 mFERUIRASxlDIaqFvhal3BmwLIyeo2A+cNl5bjPO8lEXMM9QNn5fLJMo7lDdcQaBzFnt wY2+63FJr5exDpmiAhW0gyjO5qZIegRuy3zgG0yfweVAFZ/FB2dgnu21l9VHOPYJxack qmeUwMSVuUSoCB81ag9bbtbVbyv6yqsyUOKlmOlwt5O9FcSA1X/EfeTPGp/pkwugf6Vy T6fw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hc16-20020a170907169000b006e7f47d22a9si6824677ejc.434.2022.05.19.06.48.20; Thu, 19 May 2022 06:48:20 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3929E680374; Thu, 19 May 2022 16:47:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BF22D68B49C for ; Thu, 19 May 2022 16:47:39 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5875324017E for ; Thu, 19 May 2022 15:47:39 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IWwdn6zLPLRe for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 8E08A240179 for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 6C0113A0337; Thu, 19 May 2022 15:47:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 May 2022 15:47:26 +0200 Message-Id: <20220519134728.15354-2-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220519134728.15354-1-anton@khirnov.net> References: <20220519134728.15354-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit 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: qX0ZYafOEQKH --- libavfilter/vf_v360.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 8f36d207c9..620a995733 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -3765,6 +3765,7 @@ static int barrelsplit_to_xyz(const V360Context *s, const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad; const int face = floorf(y * 4.f); + const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f; float uf, vf; uf = x * 3.f - 2.f; @@ -3774,36 +3775,23 @@ static int barrelsplit_to_xyz(const V360Context *s, vf = y * 2.f; uf = 1.f - uf; vf = 0.5f - vf; - - l_x = (0.5f - uf) / scalew; - l_y = -0.5f; - l_z = (0.5f - vf) / scaleh; break; case 1: vf = y * 2.f; uf = 1.f - uf; vf = 1.f - (vf - 0.5f); - - l_x = (0.5f - uf) / scalew; - l_y = 0.5f; - l_z = (-0.5f + vf) / scaleh; break; case 2: vf = y * 2.f - 0.5f; vf = 1.f - (1.f - vf); - - l_x = (0.5f - uf) / scalew; - l_y = -0.5f; - l_z = (0.5f - vf) / scaleh; break; case 3: vf = y * 2.f - 1.5f; - - l_x = (0.5f - uf) / scalew; - l_y = 0.5f; - l_z = (-0.5f + vf) / scaleh; break; } + l_x = (0.5f - uf) / scalew; + l_y = 0.5f * dir_vert; + l_z = (vf - 0.5f) * dir_vert / scaleh; } vec[0] = l_x; From patchwork Thu May 19 13:47:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35830 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp80245pzb; Thu, 19 May 2022 06:48:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6EVxlceuUeDlNgteLRFzrvHBtrElnvvJLlHMaJmYmi5NoWHtwB806Y/WXP+jpO12b/a3X X-Received: by 2002:a17:906:7315:b0:6f4:c84f:9eab with SMTP id di21-20020a170906731500b006f4c84f9eabmr4412483ejc.759.1652968090082; Thu, 19 May 2022 06:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652968090; cv=none; d=google.com; s=arc-20160816; b=0hv2iVSLNDDQXnMwgjLFY7pE8AXrzfhDRNhdA3udhXUkjmiz1C/q3JvmYuRR2K02rD GFCgflqMMBRVW0OXWzEL6xZUTeeSlL0z5RfNIO3K4DdwxdDGfE+xmfo7Oucb+Zpv0VGi ujN+Z97CbFBYLMlhkZ9Th8daj3rm8Mlo/3Emwl0tt2mq5c0j9SjDkpyQydn5EK7+mZRD lIHbi6WALQYH1LSh0sjsjhOZxqz6RnyKDfGmb6tu0EvfBbKr8dI9VVYRYxjpDP3Mm+5+ rinduGilnq2Gfz0aMCfU7OLHcsQaYp+oIikSqHlwBVzX3K+uthHE7I6I1LJaIe4C0heq OhUg== 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:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=n23KOxgl9qnISqRydECpRk4IWjQhht53TELy/bzgUu0=; b=V4LUWSPiVh+7CmfsVJIDY6/94/s1XrUwFf2HrsBel6t5KQKJQqEvHHdx388885hxt4 Gt9dMb3e02kdw9TPSsYyQqHzPetlN1hikD6Jhqd70DHmEKAQJ6T0EovlIvwLJh40TG9L CU1vZhQ76seVyQ0aDmlsFIGI15R7BmCHM+Ut4bkrYpI4kAhGwCsMbgMdMyKOkxtpJhvF vVufja5DISlaIisbXyp6ooVbGnNIbtgSWJYxSNwrSjbRkZsT/Nh1BktRniZVicmXz2Fo YDEVkENxUKAiCS+HMQbcmU8pVmp1R/LtuAHbMSUm+tzdAcv575vZn+vP3kOik4rtnwD6 w7ww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m10-20020aa7d34a000000b0042a4486a236si4520845edr.114.2022.05.19.06.48.09; Thu, 19 May 2022 06:48:10 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 296C568B4AD; Thu, 19 May 2022 16:47:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3393E689F59 for ; Thu, 19 May 2022 16:47:39 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id BA32424017C for ; Thu, 19 May 2022 15:47:38 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 6mA6m6-PgpyS for ; Thu, 19 May 2022 15:47:38 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9569924017E for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 6E5803A06EC; Thu, 19 May 2022 15:47:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 May 2022 15:47:27 +0200 Message-Id: <20220519134728.15354-3-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220519134728.15354-1-anton@khirnov.net> References: <20220519134728.15354-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding 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: PAH/h7QppKUP Make it match Facebook's transform360 (https://github.com/facebook/transform360) Fixes one part of #9725. --- libavfilter/vf_v360.c | 46 ++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 620a995733..940e6fc5f6 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -3683,30 +3683,33 @@ static int xyz_to_barrelsplit(const V360Context *s, u_shift = 2 * ew; + uf = vec[0] / vec[1] * scalew; + vf = vec[2] / vec[1] * scaleh; + if (theta <= 0.f && theta >= -M_PI_2 && phi <= M_PI_2 && phi >= -M_PI_2) { - uf = -vec[0] / vec[1]; - vf = -vec[2] / vec[1]; + uf *= -1.0f; + vf = -(vf + 1.f) * scaleh + 1.f; v_shift = 0; v_offset = -eh; } else if (theta >= 0.f && theta <= M_PI_2 && phi <= M_PI_2 && phi >= -M_PI_2) { - uf = vec[0] / vec[1]; - vf = -vec[2] / vec[1]; + vf = -(vf - 1.f) * scaleh; v_shift = height * 0.25f; } else if (theta <= 0.f && theta >= -M_PI_2) { - uf = vec[0] / vec[1]; - vf = vec[2] / vec[1]; + // back top + vf = (vf - 1.f) * scaleh + 1.f; v_shift = height * 0.5f; v_offset = -eh; } else { - uf = -vec[0] / vec[1]; - vf = vec[2] / vec[1]; + // back bottom + uf *= -1.0f; + vf = (vf + 1.f) * scaleh; v_shift = height * 0.75f; } - uf = 0.5f * width / 3.f * (uf * scalew + 1.f); - vf = height * 0.25f * (vf * scaleh + 1.f) + v_offset; + uf = 0.5f * width / 3.f * (uf + 1.f); + vf *= height * 0.25f; } ui = floorf(uf); @@ -3764,29 +3767,22 @@ static int barrelsplit_to_xyz(const V360Context *s, const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad; const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad; - const int face = floorf(y * 4.f); + const float facef = floorf(y * 4.f); + const int face = facef; const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f; float uf, vf; uf = x * 3.f - 2.f; switch (face) { - case 0: - vf = y * 2.f; + case 0: // front top + case 1: // front bottom uf = 1.f - uf; - vf = 0.5f - vf; - break; - case 1: - vf = y * 2.f; - uf = 1.f - uf; - vf = 1.f - (vf - 0.5f); - break; - case 2: - vf = y * 2.f - 0.5f; - vf = 1.f - (1.f - vf); + vf = (0.5f - 2.f * y) / scaleh + facef; break; - case 3: - vf = y * 2.f - 1.5f; + case 2: // back top + case 3: // back bottom + vf = (y * 2.f - 1.5f) / scaleh + 3.f - facef; break; } l_x = (0.5f - uf) / scalew; From patchwork Thu May 19 13:47:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35829 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp80169pzb; Thu, 19 May 2022 06:48:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLe9E4h1U4intairD4UVJJMRlAwsY2dcMgQWk29s4L9XJgkYMaepPGfDaipJWlY3mnadce X-Received: by 2002:a17:907:3e94:b0:6f4:64ad:1e2 with SMTP id hs20-20020a1709073e9400b006f464ad01e2mr4415639ejc.464.1652968080838; Thu, 19 May 2022 06:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652968080; cv=none; d=google.com; s=arc-20160816; b=lFGSnHl6Bgaqf6LMW8b3OHcyxm36tGg0J1y5qgbBcES5o6Iiz9MFH1idLKkLN+tbfr ER5qHBMrw/9lPRzM0YOxw6LGqKWFCEuhDSrot8yfypXneozHQ9BRaQ0esFnhRCfURoF3 pWu1N0wTBgtgTa5KFOAcQE5e6lRBFlWpBvH8qtQCSBt3frzQ5OZCacM7ZY0egaHPg3qQ b8qNBRxKMG/F3Rxp6+srEXgyftbr9McruE4zQXKXGVRBR8si940vXVW1M+gOpNNfD6Gi NWrmLP8IAgxQXSeOnTJL9TsovD2Euyowy/Uvr21MCbHeve+HUZkI+TeZRFg04dNa0eXX Ymuw== 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:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=CxlbqxgYdm0vTSNjJg7KCfev3WiG/kFUnBeVpVHAkBs=; b=RLmXCsAsDwyrrmIjijOFhOYrrytyU140YbLTQNQyAwdANygHDN8SYZ7mplYWXpaS5k tAW+2otzM3Tc6x11fAs3HjcthpxgyDoUVcTzHMUYsP9tMrQa0NdYXnjRdxQOp80Pod2L 0iER5yDvxVeyDe77S1AYF1Ttkw1yrEVgpkjh6gNIp2YX2a/ZxysKh7uGzw4g+2OybdvD /6UCrOITx21KOJQ6wg5YEB8hHOwjm4C/wKYHjSZ65boLGRRev0qmhuBUOpTPHybo8Y1h TPPzPoI4Wlb1OL/XjBHoOzSO1NpSmBATQ5+oYCEIllvrvX/xCliySor1JaFOTN10fv+w PfwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p24-20020a05640210d800b0042ab5108ad2si4877215edu.169.2022.05.19.06.48.00; Thu, 19 May 2022 06:48:00 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 31CE468B4A2; Thu, 19 May 2022 16:47:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B30D9689F59 for ; Thu, 19 May 2022 16:47:38 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5B0782400F5 for ; Thu, 19 May 2022 15:47:38 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id xmrWyKM8IU-c for ; Thu, 19 May 2022 15:47:37 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9342324017C for ; Thu, 19 May 2022 15:47:36 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 740033A0763; Thu, 19 May 2022 15:47:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 May 2022 15:47:28 +0200 Message-Id: <20220519134728.15354-4-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220519134728.15354-1-anton@khirnov.net> References: <20220519134728.15354-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit 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: WR1Av8so9Jlo The top/bottom of the barrel are each coded as two semicircles inside a square block in the frame. Mask out the parts of the square that lie outside of these semicircles, so they are made transparent when alpha_mask=1. Fixes the other part of #9725. --- libavfilter/vf_v360.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 940e6fc5f6..42b1761333 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -3745,6 +3745,7 @@ static int barrelsplit_to_xyz(const V360Context *s, const float x = (i + 0.5f) / width; const float y = (j + 0.5f) / height; float l_x, l_y, l_z; + int ret; if (x < 2.f / 3.f) { const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width * 2.f / 3.f) : 1.f - s->out_pad; @@ -3763,6 +3764,8 @@ static int barrelsplit_to_xyz(const V360Context *s, l_x = cos_theta * sin_phi; l_y = sin_theta; l_z = cos_theta * cos_phi; + + ret = 1; } else { const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad; const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad; @@ -3788,13 +3791,14 @@ static int barrelsplit_to_xyz(const V360Context *s, l_x = (0.5f - uf) / scalew; l_y = 0.5f * dir_vert; l_z = (vf - 0.5f) * dir_vert / scaleh; + ret = (l_x * l_x * scalew * scalew + l_z * l_z * scaleh * scaleh) < 0.5f * 0.5f; } vec[0] = l_x; vec[1] = l_y; vec[2] = l_z; - return 1; + return ret; } /**