From patchwork Thu Nov 13 12:24:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 25024 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 1AD05C32DC for ; Thu, 13 Nov 2025 12:25:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5ED1360805; Thu, 13 Nov 2025 13:25:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ARCwpB7z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7C0F60A8A for ; Thu, 13 Nov 2025 13:24:56 +0100 (CET) Received: from Monstersaurus.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 57D54BD2; Thu, 13 Nov 2025 13:22:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763036576; bh=a0T0rNpO96qZ72c43aVQyVLO7b6p8OzoDNxvMb2ivJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARCwpB7zGuBDuXng+XU2RqEb33WNgErdl1RLyoelzGRSBKymW97Hobys+RdtU4U2B EyD0tUO29ChSCieEiYtoTHnMGbzXdUhiGyipU5ssn0OVAAJhK61comX+JCbVbVE9nh p5fVVyzFnk4TrGyVXWyDVrFYxcuGVxX/c7O0GdbE= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH v3 09/14] test: libipa: Provide ScaledFixedPoint tests Date: Thu, 13 Nov 2025 12:24:44 +0000 Message-ID: <20251113122450.287633-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251113122450.287633-1-kieran.bingham@ideasonboard.com> References: <20251113122450.287633-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" Use the new ScaledFixedPointQTraits to create a HueQ representing the equivalent scale used by the RKISP1 Hue control to validate the scaling capabilities of the new quantized type. Signed-off-by: Kieran Bingham --- test/ipa/libipa/fixedpoint.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp index 61ad487fd950..7d1aeebc06da 100644 --- a/test/ipa/libipa/fixedpoint.cpp +++ b/test/ipa/libipa/fixedpoint.cpp @@ -225,6 +225,33 @@ protected: return TestPass; } + int testScaledFixedPointQuantizers() + { + unsigned int fails = 0; + cerr << std::endl + << "Scaled Fixed-Point Quantizer tests:" << std::endl; + + using HueQ = Quantized>; + + /* HueQ (Scaled Q1_7 * 90) (-90 .. 89.2969) Min: [0x80:-90] -- Max: [0x7f:89.2969] Step:0.703125 */ + fails += introduce("HueQ (Scaled Q1_7 * 90) "); + + /* clang-format off */ + + fails += quantizedCheck(-90.0f, -128, -90.0f); /* Min */ + fails += quantizedCheck(-45.0f, -64, -45.0f); /* Mid negative */ + fails += quantizedCheck( 0.0f, 0, 0.0f); /* Zero */ + fails += quantizedCheck( 45.0f, 64, 45.0f); /* Mid positive */ + fails += quantizedCheck( 90.0f, 127, 89.2969f); /* Max */ + + fails += quantizedCheck(-99.0f, -128, -90.0f); /* Clamp low */ + fails += quantizedCheck( 99.0f, 127, 89.2969f); /* Clamp high */ + + /* clang-format on */ + + return fails ? TestFail : TestPass; + } + int run() { unsigned int fails = 0; @@ -236,6 +263,9 @@ protected: if (testFixedPointQuantizers() != TestPass) fails++; + if (testScaledFixedPointQuantizers() != TestPass) + fails++; + return fails ? TestFail : TestPass; } };