From patchwork Sun Feb 23 23:03:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22828 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 EA5F2BDB13 for ; Sun, 23 Feb 2025 23:04:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A1F3686C5; Mon, 24 Feb 2025 00:04:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ETJ3fsY/"; 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 98791686BF for ; Mon, 24 Feb 2025 00:04:28 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9B377929 for ; Mon, 24 Feb 2025 00:03:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740351782; bh=5NFBOrd3hb7bgceA18jz0+VIQboQgIkSiykBSKqNLj4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ETJ3fsY/ZD+gdxrl4dHfR+Go1v2EoXgu4VIgw5pspvwGL4C6Fw/4Ul9ayEvUDmvRa USJq+R1muUlmqLOelFZorEC0q1VG2UnGd9cfHNhfVYxQftlBmeb5G54eEnEBFXHqFE yf1vYopMMsLrFhmHHntY/fbLCsnUuQIwj8hmL2X4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 06/15] libipa: awb: Pass lux value to calculateAwb() as unsigned int Date: Mon, 24 Feb 2025 01:03:54 +0200 Message-ID: <20250223230403.1226-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.3 In-Reply-To: <20250223230403.1226-1-laurent.pinchart@ideasonboard.com> References: <20250223230403.1226-1-laurent.pinchart@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" The lux value can never be negative. Pass it as an unsigned int. Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug --- Do we need a Lux type ? And maybe a ColourTemperature type ? --- src/ipa/libipa/awb.h | 2 +- src/ipa/libipa/awb_bayes.cpp | 2 +- src/ipa/libipa/awb_bayes.h | 2 +- src/ipa/libipa/awb_grey.cpp | 2 +- src/ipa/libipa/awb_grey.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h index 4a1b012a4334..5c298d3b6f69 100644 --- a/src/ipa/libipa/awb.h +++ b/src/ipa/libipa/awb.h @@ -35,7 +35,7 @@ public: virtual ~AwbAlgorithm() = default; virtual int init(const YamlObject &tuningData) = 0; - virtual AwbResult calculateAwb(const AwbStats &stats, int lux) = 0; + virtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0; virtual RGB gainsFromColourTemperature(double colourTemperature) = 0; const ControlInfoMap::Map &controls() const diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp index e75bfcd693d9..9287b884cb95 100644 --- a/src/ipa/libipa/awb_bayes.cpp +++ b/src/ipa/libipa/awb_bayes.cpp @@ -275,7 +275,7 @@ RGB AwbBayes::gainsFromColourTemperature(double colourTemperature) return { { gains[0], 1.0, gains[1] } }; } -AwbResult AwbBayes::calculateAwb(const AwbStats &stats, int lux) +AwbResult AwbBayes::calculateAwb(const AwbStats &stats, unsigned int lux) { ipa::Pwl prior; if (lux > 0) { diff --git a/src/ipa/libipa/awb_bayes.h b/src/ipa/libipa/awb_bayes.h index 47db7243273f..23bf88061118 100644 --- a/src/ipa/libipa/awb_bayes.h +++ b/src/ipa/libipa/awb_bayes.h @@ -34,7 +34,7 @@ public: AwbBayes() = default; int init(const YamlObject &tuningData) override; - AwbResult calculateAwb(const AwbStats &stats, int lux) override; + AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override; RGB gainsFromColourTemperature(double temperatureK) override; void handleControls(const ControlList &controls) override; diff --git a/src/ipa/libipa/awb_grey.cpp b/src/ipa/libipa/awb_grey.cpp index 06ffd45618d8..e979cc4d1a3e 100644 --- a/src/ipa/libipa/awb_grey.cpp +++ b/src/ipa/libipa/awb_grey.cpp @@ -70,7 +70,7 @@ int AwbGrey::init(const YamlObject &tuningData) * * \return The AWB result */ -AwbResult AwbGrey::calculateAwb(const AwbStats &stats, [[maybe_unused]] int lux) +AwbResult AwbGrey::calculateAwb(const AwbStats &stats, [[maybe_unused]] unsigned int lux) { AwbResult result; auto means = stats.getRGBMeans(); diff --git a/src/ipa/libipa/awb_grey.h b/src/ipa/libipa/awb_grey.h index 1a365e616a98..e3c34201dbc9 100644 --- a/src/ipa/libipa/awb_grey.h +++ b/src/ipa/libipa/awb_grey.h @@ -23,7 +23,7 @@ public: AwbGrey() = default; int init(const YamlObject &tuningData) override; - AwbResult calculateAwb(const AwbStats &stats, int lux) override; + AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override; RGB gainsFromColourTemperature(double colourTemperature) override; private: