From patchwork Fri Nov 14 00:54:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 25041 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 628CCC32DC for ; Fri, 14 Nov 2025 00:55:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AB72460ABA; Fri, 14 Nov 2025 01:55:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dpKB1Se9"; 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 011BC60AAB for ; Fri, 14 Nov 2025 01:54:52 +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 7290A16A8; Fri, 14 Nov 2025 01:52:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763081571; bh=ToNsUOzmKiNF1icAMM5rna9vu6glhImwFOUKNWeZZt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dpKB1Se9+gJpOjSGCHXH1ENrPUHZ9wpR/Bj/UwdQVW9X1w+QAS694qwVJDexm2Ezy /Q0eok36JdrImckmuMEQ7Rzuzkhr69rzkINTEEXAjKsZ70OhvZ7t/BUaXzAYIPpQg4 Cw2nPkfoh2VWMmX3UFostX9nFMMxzOB68rhQzRbc= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH v4 11/21] test: libipa: Provide ScaledFixedPoint tests Date: Fri, 14 Nov 2025 00:54:15 +0000 Message-ID: <20251114005428.90024-12-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" 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 f3773dfe6ad4..e3428272fae5 100644 --- a/test/ipa/libipa/fixedpoint.cpp +++ b/test/ipa/libipa/fixedpoint.cpp @@ -235,6 +235,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; @@ -246,6 +273,9 @@ protected: if (testFixedPointQuantizers() != TestPass) fails++; + if (testScaledFixedPointQuantizers() != TestPass) + fails++; + return fails ? TestFail : TestPass; } };