From patchwork Mon Nov 13 15:32:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 44650 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:92a5:b0:181:818d:5e7f with SMTP id q37csp1385669pzg; Mon, 13 Nov 2023 07:33:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbQXuyW2RaL7vlmDr7PncBX/7K1+nCMSpQxtsZRRvhLkHtrGE2QxL/D2rYQnkEXwH4/4p7 X-Received: by 2002:a05:6402:b0f:b0:53f:c889:8f89 with SMTP id bm15-20020a0564020b0f00b0053fc8898f89mr5430659edb.36.1699889581513; Mon, 13 Nov 2023 07:33:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699889581; cv=none; d=google.com; s=arc-20160816; b=XINBAUb3leYFvfdGHokgAB7EUeVG1sTsebxFIhUY9+JyNYRHSuyH1j4j4zMPflWU+r et5J4Z8PY4Ro1RBhdQQVjXV5g5O0C7vKIrMgmcRFbCLNALTHKTVTx+/kZnwgsUI8YaPW evpG5hbv2Rmo74Qo6foBUm4bSJ1S7gzZ9UGQT8TtyDP2PLrYjglwUxvPJaXtt/6bWLO0 reI4xipGO50njSTjbZLebAXf7qk2DRSUOqvoxSktDGBpdUekSVusDNZd3OvBRb6xj76d OIVi5r+DzP1x5Iwgio1itWDNBdMVlcQqruGnqvl2RETcTLuGKE/i5e7RqxqOmN8ImVnm hQMw== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=bHst0hgvk41vUaHCYw3AG6pwxsynLl6DiXRZjEfvMUE=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=HBIqqWkEOFaTTGt+mhqc7D344WpS3N6jzxUlUG29O/p9KYKq6sSqN5Ye6DKY1998M7 hG+PHj39fxo7wrEBv9JosFJDqHSms9gv9FEQkl62ciVdEjAoWE1hntreVB32NUHVY6gD JV8X8amOMa+rt7Y7cERzlAl+Hsxsii/0WAxBgPRpDPQ5JE6Spf2rNYMOeLvT0r9e7XYO G6sbv/vmO3eWvFrb1rcocZwG1WP6lXIdf/QG1MBVVks71JABaD80t6IzAYolO8WEPG9+ 9rI5puMjb4ejwrAaoPrM9qTx9ppPoUj/ZctAkdkSehSVeny/SGsPEdYOPnndUFZFl4L3 4Fdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=lERmQ9pu; 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 l24-20020a50d6d8000000b00540f04600bcsi2781475edj.332.2023.11.13.07.33.01; Mon, 13 Nov 2023 07:33:01 -0800 (PST) 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=@haasn.xyz header.s=mail header.b=lERmQ9pu; 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 CD6AA68CCFD; Mon, 13 Nov 2023 17:32:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B6D2868CCE7 for ; Mon, 13 Nov 2023 17:32:39 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id AFD0B499B1; Mon, 13 Nov 2023 16:32:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1699889558; bh=gggRH8bGOBhi8qNgUO+lKEDCnMIdOyZKzTxxfvTrrMc=; h=From:To:Cc:Subject:Date:From; b=lERmQ9puak/n0zNKXeWGrOWGE6zckG+8C++hE6f6BGbqDeGAMkabfvsm5HdR0sde5 8JASEyd2GB7SLyHY+bpA5mK/ME18daW8N6DLn2NLX/oPoY8f1MCKnpkpQ606XHlIIK DmQWmoRw7YSqOAbW6n38HkLU0C1eou7pENeJUHWU= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Nov 2023 16:32:32 +0100 Message-ID: <20231113153234.8812-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] swscale: don't assign range converters for float 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qc4ATYuEW0GF From: Niklas Haas This logic was incongruent with logic used elsewhere, where floating point formats are explicitly exempted from range conversion. Fixes an issue where floating point formats were not going through special unscaled converters even when it was otherwise possible. --- libswscale/swscale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 46ba68fe6a..a66db22767 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -534,7 +534,8 @@ av_cold void ff_sws_init_range_convert(SwsContext *c) { c->lumConvertRange = NULL; c->chrConvertRange = NULL; - if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { + if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) && + !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) { if (c->dstBpc <= 14) { if (c->srcRange) { c->lumConvertRange = lumRangeFromJpeg_c; From patchwork Mon Nov 13 15:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 44651 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:92a5:b0:181:818d:5e7f with SMTP id q37csp1385777pzg; Mon, 13 Nov 2023 07:33:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIM9RFxu30SJMZiU7baiGuXCv9PBlO/xcw5JgpsFu9LhVYFP9mvtkrgWbflpEOLdRupYhO X-Received: by 2002:a17:907:36c7:b0:9c6:287d:c59d with SMTP id bj7-20020a17090736c700b009c6287dc59dmr6386832ejc.28.1699889590524; Mon, 13 Nov 2023 07:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699889590; cv=none; d=google.com; s=arc-20160816; b=evxfqb1dLQbhIWxT9lKL+Sn1T6lH1qkPRNfvgeF8q7JtPVXzfIZKSsHxQjTCK63RmO YFhSy+2Bh3Qxsx5gg7NbBk40aeVJk6AHDrqGEwPxcQSlQCie9tZ3o7KtihokfQuHsrG5 u0wgfQ+/uNZF5Iw0xEPTtRLa60/gnKWDyytO0zbVDrc4n9FmTT0Ofq45kpfovvRZfAOQ hwEsbBH7JeuqPeEVgg/J/K3ONcQR8ilecsAYbI9PSP1UXK+SqZl+igjZqFtP7y0TtC0Y vqdiBVwmrFQGbmMlV2VB/D16uFAUyrPHucre6ENHZVjUkbRbP09rdANIKTBLup0weDhH 13vA== 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=J3duze9IO/uNZxBuY7FpaA0gTUhI4khq6XU9Gt3Zvpw=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=oGo2wT1zgzlUQHCu3EJZU0JmKZN2qhyqPPhuHAzln4BlQF8mz1CmZJJfk9KCtwdUjf cG7afJpUCfomsmE7VcjEVRRNjajmOZCSbZhIWsv12D6YFeHO85QAVEe71reh1uXpnlgd lvo+4UsEpFtPzsybIbBdQFpe/VMEnup5eiLLuUvXnuyHtg1qnlimht7hiz+NBStxCnLE cmFkGmUwdBRfYAHV2/5E3yCyTDaPenEmULAjshV87j/8up6sHPxCaIyfEsLvlmgJ9G76 RGn3WcKuW5ajOOk9th0kdagWwzFukWk1hmGM0b4il2Tm5mYI/UZ/TKoXTplmz9h8UFi1 xQtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=DCphhWs3; 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 t27-20020a170906179b00b009d590659096si2888923eje.648.2023.11.13.07.33.10; Mon, 13 Nov 2023 07:33:10 -0800 (PST) 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=@haasn.xyz header.s=mail header.b=DCphhWs3; 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 D529E68CD05; Mon, 13 Nov 2023 17:32:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B983068CCEA for ; Mon, 13 Nov 2023 17:32:39 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 01A2349B46; Mon, 13 Nov 2023 16:32:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1699889559; bh=Hmwl2kUulVnvDWz0U0sQuL2mLaCWxkVZEg6EGLzOT9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCphhWs3TGa5EssDRVYd9K4e2TO3ggeUIELiaTj2kKHwhuOkKnuQURe4xzEU3VHPv Cv0F+lzBH06t0efhz7l4IYhMaiA/qWNJEgYH5Jw0bVKFqHCQckQ8NP59Mr8nVS4nr1 3VKj7IResU3UE1ywPKYucODWq4kuPYdwJBP7XgCc= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Nov 2023 16:32:33 +0100 Message-ID: <20231113153234.8812-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231113153234.8812-1-ffmpeg@haasn.xyz> References: <20231113153234.8812-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: t0b7zFsmImyv From: Niklas Haas Before cedf589, this function would return early return on RGB and float formats, as well as when range was equal. While this commit intentionally removed the early return for same-range YUV conversions, it missed that RGB and float formats that have an unscaled converter should always early return, no matter what the source range was set to. Fixes: cedf589c09c567b72bf4c1a58db53d94622567e1 --- libswscale/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libswscale/utils.c b/libswscale/utils.c index ec822ff5d9..7ce86f83ea 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1733,6 +1733,9 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, av_log(c, AV_LOG_INFO, "unscaled %s -> %s special converter is available\n", av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); + + if (isAnyRGB(dstFormat) || isFloat(srcFormat) || isFloat(dstFormat)) + return 0; } } From patchwork Mon Nov 13 15:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 44649 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:92a5:b0:181:818d:5e7f with SMTP id q37csp1385514pzg; Mon, 13 Nov 2023 07:32:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfs2dxHU/c7kXf8Zcqgei8bVshOkSAmJwo6lGHZJzgGAP+1rNBqGE4YVC2xZCZpQBlgpcu X-Received: by 2002:a17:906:4e08:b0:9dd:cc3d:7ba7 with SMTP id z8-20020a1709064e0800b009ddcc3d7ba7mr4826148eju.29.1699889571105; Mon, 13 Nov 2023 07:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699889571; cv=none; d=google.com; s=arc-20160816; b=HhrXEEDVKXK3YN1tc9NHVCtFo7Mow4z8a/Y7/tWV+vwrC7F7Nbs/sMM5sqI+X/flyQ 2G//FMwpmaeKvZIThTREmPIWruZmcBSnZcSu9i9pVrRaGzv5jSDtFAH5fvApkaWnRE4r 3r5yZb2+n1Inw69tQkPxHFcNGxkcmqVoCO0Ael1rHS5LH3xsy5cb3Bfxm13QUrPevjR1 aOmy690g2Epgw7g5v9FP0SJ52NoVlGAutu0WGLAAdZU2ctM6Pafog4bKWORT9NULDF9H le4USBt9Had8XwdGfvL3Ewm2zU9DSGCEWBoUWW29o2bdbJeo6fHFDrDdLCzNiHs6W/wF Eigg== 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=YZVDn4T8q9PdslzEnpAGJFJoOnvHSd0Hps5K29cxZU4=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=Z2m0vi3WxMBuRjac3N2/rN1a+MUkbvMyMX074M/CLWm15OjayszWU9S4ra/O4RtbO+ D00Fqv2dVZP8GZPWzL+UNJ4lwEn8vpI584ROMxTI+8hrHXIxkKCjkYalmQX/nd5IE0JO yqzIlWjH/scUMImZ1igy4Y67afx2pIa2BYGrJuImN4n3uoXPXox31h38em8NO+T/I+KS TuMgZU4ixZbpIH5jOtEu4us22eo42aW3DPII/8nAT4Udejatx4KbeHuSIoIDTs5uasLR G/n5WpYtPk1RC3lga3ojJ2jzyggxdMmVDTyjps2/b3XQhz7MjfVd8zdWOQFmIRW4mi3X I17w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=lhZIJG93; 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 ga10-20020a170906b84a00b009ddbd424ed2si2919627ejb.255.2023.11.13.07.32.50; Mon, 13 Nov 2023 07:32:51 -0800 (PST) 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=@haasn.xyz header.s=mail header.b=lhZIJG93; 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 7955F68CCFA; Mon, 13 Nov 2023 17:32:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2BC268CC74 for ; Mon, 13 Nov 2023 17:32:39 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 41F0A4B527; Mon, 13 Nov 2023 16:32:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1699889559; bh=SP8lKYiaMKtNjKTZmr8BdEc3qUHxydSNM63PUgWvdQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhZIJG93bGQFoALRibZfeWUD9ggZJpfqaSOTGg85g8dt2PMmGyvJWbzbDaWToOtrh vdf5czQ5d0PzN2ZpRfqVLxLJZBKFn0LOgZmXVX4jdheyrnams5oHg6lazl3mIuu24E h+g39JEsqL0pAsuqHgtu0JBwBSzA+5RTYP5Ho54Y= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Nov 2023 16:32:34 +0100 Message-ID: <20231113153234.8812-3-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231113153234.8812-1-ffmpeg@haasn.xyz> References: <20231113153234.8812-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] swscale/utils: don't early return in yuv alpha blendaway 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: LwfiANnJatkO From: Niklas Haas If changing YUV range after init results in the special converter no longer being picked, then we need the rest of the init function to have been hit. Fixes: cedf589c09c567b72bf4c1a58db53d94622567e1 --- libswscale/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 7ce86f83ea..294b0b5ace 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1721,7 +1721,9 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, av_log(c, AV_LOG_INFO, "alpha blendaway %s -> %s special converter is available\n", av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); - return 0; + + if (isAnyRGB(dstFormat)) + return 0; } /* unscaled special cases */