From patchwork Fri Nov 14 00:54:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 25049 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 29534C3331 for ; Fri, 14 Nov 2025 00:55:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C802260AB4; Fri, 14 Nov 2025 01:55:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Bi/TBMv1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9971A60AB2 for ; Fri, 14 Nov 2025 01:54:54 +0100 (CET) Received: from charm.hippo-penny.ts.net (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 181382147; Fri, 14 Nov 2025 01:52:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763081574; bh=vDMGWjYjPnIFctv9HNPlYxUJ7HArB6476qXCi/sFhPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bi/TBMv1Q6ZOyTtxV2TX84VtGIe7GbH3FD9/aaXbbOY9HAVCCDmvE1hySxHutaICr 5mwPQsT+ZR7CFZDl/0QTzVjHIBqpnX5Vhkikr+LB9p4GCawRhRfPDd6xsBIfiAwNsY KdmLgSO/DiRswL2kx2VeioR0KDdsf6iW0oZgs+Xk= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH v4 19/21] test: libipa: Remove legacy fixed point conversion test Date: Fri, 14 Nov 2025 00:54:23 +0000 Message-ID: <20251114005428.90024-20-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251114005428.90024-1-kieran.bingham@ideasonboard.com> References: <20251114005428.90024-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that the fixed point conversions are equally covered by the new Q types, the legacy tests for fixedToFloatingPoint and floatingToFixedPoint are redundant. Remove them. Signed-off-by: Kieran Bingham --- test/ipa/libipa/fixedpoint.cpp | 78 ---------------------------------- 1 file changed, 78 deletions(-) diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp index e3428272fae5..357af6afa75e 100644 --- a/test/ipa/libipa/fixedpoint.cpp +++ b/test/ipa/libipa/fixedpoint.cpp @@ -26,80 +26,6 @@ using Q4_7 = Quantized>; class FixedPointUtilsTest : public Test { protected: - /* R for real, I for integer */ - template - int testFixedToFloat(I input, R expected) - { - R out = fixedToFloatingPoint(input); - R prec = 1.0 / (1 << FracPrec); - if (std::abs(out - expected) > prec) { - cerr << "Reverse conversion expected " << input - << " to convert to " << expected - << ", got " << out << std::endl; - return TestFail; - } - - return TestPass; - } - - template - int testSingleFixedPoint(double input, T expected) - { - T ret = floatingToFixedPoint(input); - if (ret != expected) { - cerr << "Expected " << input << " to convert to " - << expected << ", got " << ret << std::endl; - return TestFail; - } - - /* - * The precision check is fairly arbitrary but is based on what - * the rkisp1 is capable of in the crosstalk module. - */ - double f = fixedToFloatingPoint(ret); - if (std::abs(f - input) > 0.005) { - cerr << "Reverse conversion expected " << ret - << " to convert to " << input - << ", got " << f << std::endl; - return TestFail; - } - - return TestPass; - } - - int testFixedPoint() - { - /* - * The second 7.992 test is to test that unused bits don't - * affect the result. - */ - std::map testCases = { - { 7.992, 0x3ff }, - { 0.2, 0x01a }, - { -0.2, 0x7e6 }, - { -0.8, 0x79a }, - { -0.4, 0x7cd }, - { -1.4, 0x74d }, - { -8, 0x400 }, - { 0, 0 }, - }; - - int ret; - for (const auto &testCase : testCases) { - ret = testSingleFixedPoint<4, 7, int16_t>(testCase.first, - testCase.second); - if (ret != TestPass) - return ret; - } - - /* Special case with a superfluous one in the unused bits */ - ret = testFixedToFloat<4, 7, int16_t, double>(0xbff, 7.992); - if (ret != TestPass) - return ret; - - return TestPass; - } - template int quantizedCheck(float input, typename Q::QuantizedType expected, float value) { @@ -266,10 +192,6 @@ protected: { unsigned int fails = 0; - /* fixed point conversion test */ - if (testFixedPoint() != TestPass) - fails++; - if (testFixedPointQuantizers() != TestPass) fails++;