From patchwork Thu Jan 23 11:41:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22629 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 23594BDE6B for ; Thu, 23 Jan 2025 11:42:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A55326857A; Thu, 23 Jan 2025 12:42:54 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Xk801lxH"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A9706856F for ; Thu, 23 Jan 2025 12:42:52 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:c0a:33cd:b453:5d3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F0D321189; Thu, 23 Jan 2025 12:41:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737632509; bh=4XRP9iG1VlCEJS0sUQJsOYWDDoRNnNglhR3rTjfJWY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xk801lxHL6CUujdZqTCwpyIwTR5IYIkDeqPVmPIXmeghzuGIxrhOcjlLteIKEMR3Q LEH+DOk7NLdjmNfnWIBXviUBU/BanIeodc0RPilZFl7mHIxBaDKWm9PK/Txl8qE9LH cf2IGB+Z/avbSpJ+5396pNzErFBVj/dJNRr+MYiw= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY to 1 Date: Thu, 23 Jan 2025 12:41:04 +0100 Message-ID: <20250123114204.79321-15-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250123114204.79321-1-stefan.klug@ideasonboard.com> References: <20250123114204.79321-1-stefan.klug@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" By normalizing the referenceY value to 1 (which is the usual range for Y) in the tuning file, the bins_ value is no longer needed. Remove it. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Daniel Scally Reviewed-by: Daniel Scally --- Changes in v2: - Added this patch --- src/ipa/libipa/lux.cpp | 16 ++++------------ src/ipa/libipa/lux.h | 3 +-- src/ipa/rkisp1/algorithms/lux.cpp | 4 ---- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp index bae8198fa169..899e88248f04 100644 --- a/src/ipa/libipa/lux.cpp +++ b/src/ipa/libipa/lux.cpp @@ -43,11 +43,6 @@ namespace ipa { * that depend on the estimated lux value. */ -/** - * \var Lux::binSize_ - * \brief The maximum count of each bin - */ - /** * \var Lux::referenceExposureTime_ * \brief The exposure time of the reference image, in microseconds @@ -65,9 +60,8 @@ namespace ipa { /** * \var Lux::referenceY_ - * \brief The measured luminance of the reference image, out of the bin size + * \brief The measured luminance of the reference image, normalized to 1 * - * \sa binSize_ */ /** @@ -77,10 +71,8 @@ namespace ipa { /** * \brief Construct the Lux helper module - * \param[in] binSize The maximum count of each bin */ -Lux::Lux(unsigned int binSize) - : binSize_(binSize) +Lux::Lux() { } @@ -97,7 +89,7 @@ Lux::Lux(unsigned int binSize) * referenceExposureTime: 10000 * referenceAnalogueGain: 4.0 * referenceDigitalGain: 1.0 - * referenceY: 12000 + * referenceY: 0.1831 * referenceLux: 1000 * \endcode * @@ -167,7 +159,7 @@ double Lux::estimateLux(utils::Duration exposureTime, double exposureTimeRatio = referenceExposureTime_ / exposureTime; double aGainRatio = referenceAnalogueGain_ / aGain; double dGainRatio = referenceDigitalGain_ / dGain; - double yRatio = currentY * (binSize_ / yHist.bins()) / referenceY_; + double yRatio = (currentY / yHist.bins()) / referenceY_; double estimatedLux = exposureTimeRatio * aGainRatio * dGainRatio * yRatio * referenceLux_; diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h index 93ca64795803..d95bcdafcfcd 100644 --- a/src/ipa/libipa/lux.h +++ b/src/ipa/libipa/lux.h @@ -21,7 +21,7 @@ class Histogram; class Lux { public: - Lux(unsigned int binSize); + Lux(); int parseTuningData(const YamlObject &tuningData); double estimateLux(utils::Duration exposureTime, @@ -29,7 +29,6 @@ public: const Histogram &yHist) const; private: - unsigned int binSize_; utils::Duration referenceExposureTime_; double referenceAnalogueGain_; double referenceDigitalGain_; diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp index b0f74963af4f..a467767e1298 100644 --- a/src/ipa/rkisp1/algorithms/lux.cpp +++ b/src/ipa/rkisp1/algorithms/lux.cpp @@ -33,12 +33,8 @@ namespace ipa::rkisp1::algorithms { /** * \brief Construct an rkisp1 Lux algo module - * - * The Lux helper is initialized to 65535 as that is the max bin count on the - * rkisp1. */ Lux::Lux() - : lux_(65535) { }