From patchwork Wed Oct 29 17:24:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 24897 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 2142BC3331 for ; Wed, 29 Oct 2025 17:25:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A318C6085D; Wed, 29 Oct 2025 18:25:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="chNTWVtY"; 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 4BB5860879 for ; Wed, 29 Oct 2025 18:24:48 +0100 (CET) Received: from Monstersaurus.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 EF5911E27; Wed, 29 Oct 2025 18:22:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761758579; bh=PTwzVqeQFmvDw4CuaQJJQ+zLm+zmOChgslJvh1fXYKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chNTWVtYVCtrydS7diU96gRQJL6+gxPH1hXDxRoxRzZ6v+9///49sUhY5qpTOBkHP aUSMhfjVPFyoa/fSEuOCVdCoe7IYOxF7j+4q5Kuvh7Hx1Hxd5wDZWp5SmFxUAXiulZ QExdUS6LEm/Ts6cDn2QC3DN9Abv+qpYM1AhY0/aU= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH v2 08/13] test: libipa: Provide ScaledFixedPoint tests Date: Wed, 29 Oct 2025 17:24:33 +0000 Message-ID: <20251029172439.1513907-9-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029172439.1513907-1-kieran.bingham@ideasonboard.com> References: <20251029172439.1513907-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 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp index 4bffd40f5a63..f8be1e4bf70f 100644 --- a/test/ipa/libipa/fixedpoint.cpp +++ b/test/ipa/libipa/fixedpoint.cpp @@ -221,6 +221,32 @@ protected: return TestPass; } + int testScaledFixedPointQuantizers() + { + unsigned int fails = 0; + cerr << std::endl + << "Scaled Fixed-Point Quantizer tests:" << std::endl; + + using HueQ = Quantized>; + + 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; @@ -232,6 +258,9 @@ protected: if (testFixedPointQuantizers() != TestPass) fails++; + if (testScaledFixedPointQuantizers() != TestPass) + fails++; + return fails ? TestFail : TestPass; } };