{"id":22629,"url":"https://patchwork.libcamera.org/api/1.1/patches/22629/?format=json","web_url":"https://patchwork.libcamera.org/patch/22629/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250123114204.79321-15-stefan.klug@ideasonboard.com>","date":"2025-01-23T11:41:04","name":"[v2,14/17] libipa: lux: Update for a normalized referenceY to 1","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"71feb5fc3db64f0dbd1eac49093fb7c1dd451520","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22629/mbox/","series":[{"id":4966,"url":"https://patchwork.libcamera.org/api/1.1/series/4966/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4966","date":"2025-01-23T11:40:50","name":"Add Bayesian AWB algorithm to libipa and rkisp1","version":2,"mbox":"https://patchwork.libcamera.org/series/4966/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22629/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22629/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 23594BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jan 2025 11:42:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A55326857A;\n\tThu, 23 Jan 2025 12:42:54 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A9706856F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jan 2025 12:42:52 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:c0a:33cd:b453:5d3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F0D321189;\n\tThu, 23 Jan 2025 12:41:48 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Xk801lxH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737632509;\n\tbh=4XRP9iG1VlCEJS0sUQJsOYWDDoRNnNglhR3rTjfJWY8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Xk801lxHL6CUujdZqTCwpyIwTR5IYIkDeqPVmPIXmeghzuGIxrhOcjlLteIKEMR3Q\n\tLEH+DOk7NLdjmNfnWIBXviUBU/BanIeodc0RPilZFl7mHIxBaDKWm9PK/Txl8qE9LH\n\tcf2IGB+Z/avbSpJ+5396pNzErFBVj/dJNRr+MYiw=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 14/17] libipa: lux: Update for a normalized referenceY to\n\t1","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","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"By normalizing the referenceY value to 1 (which is the usual range for\nY) in the tuning file, the bins_ value is no longer needed. Remove it.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Added this patch\n---\n src/ipa/libipa/lux.cpp            | 16 ++++------------\n src/ipa/libipa/lux.h              |  3 +--\n src/ipa/rkisp1/algorithms/lux.cpp |  4 ----\n 3 files changed, 5 insertions(+), 18 deletions(-)","diff":"diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp\nindex bae8198fa169..899e88248f04 100644\n--- a/src/ipa/libipa/lux.cpp\n+++ b/src/ipa/libipa/lux.cpp\n@@ -43,11 +43,6 @@ namespace ipa {\n  * that depend on the estimated lux value.\n  */\n \n-/**\n- * \\var Lux::binSize_\n- * \\brief The maximum count of each bin\n- */\n-\n /**\n  * \\var Lux::referenceExposureTime_\n  * \\brief The exposure time of the reference image, in microseconds\n@@ -65,9 +60,8 @@ namespace ipa {\n \n /**\n  * \\var Lux::referenceY_\n- * \\brief The measured luminance of the reference image, out of the bin size\n+ * \\brief The measured luminance of the reference image, normalized to 1\n  *\n- * \\sa binSize_\n  */\n \n /**\n@@ -77,10 +71,8 @@ namespace ipa {\n \n /**\n   * \\brief Construct the Lux helper module\n-  * \\param[in] binSize The maximum count of each bin\n   */\n-Lux::Lux(unsigned int binSize)\n-\t: binSize_(binSize)\n+Lux::Lux()\n {\n }\n \n@@ -97,7 +89,7 @@ Lux::Lux(unsigned int binSize)\n  *       referenceExposureTime: 10000\n  *       referenceAnalogueGain: 4.0\n  *       referenceDigitalGain: 1.0\n- *       referenceY: 12000\n+ *       referenceY: 0.1831\n  *       referenceLux: 1000\n  * \\endcode\n  *\n@@ -167,7 +159,7 @@ double Lux::estimateLux(utils::Duration exposureTime,\n \tdouble exposureTimeRatio = referenceExposureTime_ / exposureTime;\n \tdouble aGainRatio = referenceAnalogueGain_ / aGain;\n \tdouble dGainRatio = referenceDigitalGain_ / dGain;\n-\tdouble yRatio = currentY * (binSize_ / yHist.bins()) / referenceY_;\n+\tdouble yRatio = (currentY / yHist.bins()) / referenceY_;\n \n \tdouble estimatedLux = exposureTimeRatio * aGainRatio * dGainRatio *\n \t\t\t      yRatio * referenceLux_;\ndiff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h\nindex 93ca64795803..d95bcdafcfcd 100644\n--- a/src/ipa/libipa/lux.h\n+++ b/src/ipa/libipa/lux.h\n@@ -21,7 +21,7 @@ class Histogram;\n class Lux\n {\n public:\n-\tLux(unsigned int binSize);\n+\tLux();\n \n \tint parseTuningData(const YamlObject &tuningData);\n \tdouble estimateLux(utils::Duration exposureTime,\n@@ -29,7 +29,6 @@ public:\n \t\t\t   const Histogram &yHist) const;\n \n private:\n-\tunsigned int binSize_;\n \tutils::Duration referenceExposureTime_;\n \tdouble referenceAnalogueGain_;\n \tdouble referenceDigitalGain_;\ndiff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp\nindex b0f74963af4f..a467767e1298 100644\n--- a/src/ipa/rkisp1/algorithms/lux.cpp\n+++ b/src/ipa/rkisp1/algorithms/lux.cpp\n@@ -33,12 +33,8 @@ namespace ipa::rkisp1::algorithms {\n \n /**\n  * \\brief Construct an rkisp1 Lux algo module\n- *\n- * The Lux helper is initialized to 65535 as that is the max bin count on the\n- * rkisp1.\n  */\n Lux::Lux()\n-\t: lux_(65535)\n {\n }\n \n","prefixes":["v2","14/17"]}