[{"id":33204,"web_url":"https://patchwork.libcamera.org/comment/33204/","msgid":"<Z5dvyAeo3rHP8RDD@pyrite.rasen.tech>","date":"2025-01-27T11:36:40","subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Thu, Jan 23, 2025 at 12:41:04PM +0100, Stefan Klug wrote:\n> By normalizing the referenceY value to 1 (which is the usual range for\n> Y) in the tuning file, the bins_ value is no longer needed. Remove it.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nI think the subject can simply be \"libipa: lux: Normalize referenceY to 1\"\nor something along those lines.\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes 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(-)\n> \n> diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp\n> index 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_;\n> diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h\n> index 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_;\n> diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp\n> index 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> -- \n> 2.43.0\n>","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 96C0FBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jan 2025 11:36:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFE5F6855E;\n\tMon, 27 Jan 2025 12:36:49 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E67468557\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jan 2025 12:36:48 +0100 (CET)","from pyrite.rasen.tech (unknown [206.0.71.13])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A0E1118D;\n\tMon, 27 Jan 2025 12:35:40 +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=\"kuW/csOC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737977742;\n\tbh=4vH9lT4q9DYqBIou5czHQMdMj5pluCuTMcRWj3Zeowo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kuW/csOCxHmxJbGqiUqhKiCoRHkl8y4k9WKvVLhjOKz0RIAaASn/YCRjKLZokoGBo\n\t7BpZJirIVjsaAWrNlF/jkzJRM2PUoiOynND2HrJHh1uWqe9JG9NMPMBCtgV6ijmfN4\n\trYl8KXfH7SaaNmVQ2ZSd5guGhH9x1C3iIs8Rw+pY=","Date":"Mon, 27 Jan 2025 03:36:40 -0800","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","Message-ID":"<Z5dvyAeo3rHP8RDD@pyrite.rasen.tech>","References":"<20250123114204.79321-1-stefan.klug@ideasonboard.com>\n\t<20250123114204.79321-15-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20250123114204.79321-15-stefan.klug@ideasonboard.com>","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>"}},{"id":33363,"web_url":"https://patchwork.libcamera.org/comment/33363/","msgid":"<4224ee5f-dc51-44b2-9c31-82506a7ff235@ideasonboard.com>","date":"2025-02-14T17:04:30","subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Stefan\n\nOn 23/01/2025 11:41, Stefan Klug wrote:\n> By normalizing the referenceY value to 1 (which is the usual range for\n> Y) in the tuning file, the bins_ value is no longer needed. Remove it.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>\n> Changes 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(-)\n>\n> diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp\n> index 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_;\n> diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h\n> index 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_;\n> diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp\n> index 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>","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 B45D3C3273\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Feb 2025 17:04:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B06A96864F;\n\tFri, 14 Feb 2025 18:04:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19F396862A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2025 18:04:33 +0100 (CET)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A0AAF73B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2025 18:03:13 +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=\"NkKg6BYo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1739552593;\n\tbh=qayrBEL8VrvZ9fBIePUoSfW+i2LfgI/G/nImOBr025c=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=NkKg6BYo686cYJf3dQW1x/fQMceU36vwhd+NWDRDL6lPnMjM8WXpM3Rpkx2EDFjoD\n\t5stuRQnpm9UpUKuJ795uc/DwkqxaQRiTzKaGpdcjCJFBQhJ7OZEo4S2XLbLPN6e4XE\n\tPYEBINJpSJlWI/tyR1i7kzAgSoYidSiOgH5tgMn8=","Message-ID":"<4224ee5f-dc51-44b2-9c31-82506a7ff235@ideasonboard.com>","Date":"Fri, 14 Feb 2025 17:04:30 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","To":"libcamera-devel@lists.libcamera.org","References":"<20250123114204.79321-1-stefan.klug@ideasonboard.com>\n\t<20250123114204.79321-15-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\n\tMHGPKL2m+plk+7tjMoQFfexoQ1JKugHAjxAhJfrkXh6uS6rc01bYCyo7ybzg53m1HLFJdNGX\n\tsUKR+dQpBs3SY4s66tc1sREJqdYyTsSZf80HjIeJjU/hRunRo4NjRIJwhvnK1GyjOvvuCKVU\n\tRWpY8dNjNu5OeAfdrlvFJOxIE9M8JuYCQTMULqd1NuzbpFMjc9524U3Cngs589T7qUMPb1H1\n\tNTA81LmtJ6Y+IV5/kiTUANflpzBwhu18Ok7kGyCq2a2jsOcVmk8gZNs04gyjuj8JziYwwLbf\n\tvzABwpFVcS8aR+nHIZV1HtOzyw8CsL8OySc3K9y+Y0NRpziMRvutrppzgyMb9V+N31mK9Mxl\n\t1YkgaTl4ciNWpdfUe0yxH03OCuHi3922qhPLF4XX5LN+NaVw5Xz2o3eeWklXdouxwV7QlN33\n\tu4+u2FWzKxDqO6WLQGjxPE0mVB4Gh5Pa1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Mbz/Bx7qfrmd901\n\tD+N9SjIwrbVhhSyUXYnSUb8F+9g2RDY42Sk7GcYxIeON4VzKqWM7hpkXZ47pkK0YodO+dRKM\n\tyMcoUWrTK0Uz6UzUGKoJVbxmSW/EJLEGoI5p3NWxWtScEVv8mO49gqQdrRIOheZycDmHnItt\n\t9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<20250123114204.79321-15-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":33366,"web_url":"https://patchwork.libcamera.org/comment/33366/","msgid":"<0cd1d98e-0c4b-4ef1-88ca-fa493593fc4a@ideasonboard.com>","date":"2025-02-14T17:22:00","subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Stefan\n\nOn 23/01/2025 11:41, Stefan Klug wrote:\n> By normalizing the referenceY value to 1 (which is the usual range for\n> Y) in the tuning file, the bins_ value is no longer needed. Remove it.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>\n> Changes 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(-)\n>\n> diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp\n> index 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_;\n> diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h\n> index 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_;\n> diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp\n> index 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>","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 7CFC9C32A3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Feb 2025 17:22:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3A23668659;\n\tFri, 14 Feb 2025 18:22:05 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A83A568653\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2025 18:22:03 +0100 (CET)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 50E2473B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2025 18:20:44 +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=\"B8g92wIs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1739553644;\n\tbh=qayrBEL8VrvZ9fBIePUoSfW+i2LfgI/G/nImOBr025c=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=B8g92wIsgp+yder0/ogaywUa1+Z1MUEc4dj0on0Sb3nuuNov+aUCIF4ucH+QI7soL\n\tpGsdvKBUyr9hJXbZqphBrBLdao7NTArgUssfQTJgCgaPsedxlVgHri518eVpbQptwD\n\tsq9FLq/339O+rrT21ksnrq/dwFXibfrwlsTTVzYg=","Message-ID":"<0cd1d98e-0c4b-4ef1-88ca-fa493593fc4a@ideasonboard.com>","Date":"Fri, 14 Feb 2025 17:22:00 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2 14/17] libipa: lux: Update for a normalized referenceY\n\tto 1","To":"libcamera-devel@lists.libcamera.org","References":"<20250123114204.79321-1-stefan.klug@ideasonboard.com>\n\t<20250123114204.79321-15-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\n\tMHGPKL2m+plk+7tjMoQFfexoQ1JKugHAjxAhJfrkXh6uS6rc01bYCyo7ybzg53m1HLFJdNGX\n\tsUKR+dQpBs3SY4s66tc1sREJqdYyTsSZf80HjIeJjU/hRunRo4NjRIJwhvnK1GyjOvvuCKVU\n\tRWpY8dNjNu5OeAfdrlvFJOxIE9M8JuYCQTMULqd1NuzbpFMjc9524U3Cngs589T7qUMPb1H1\n\tNTA81LmtJ6Y+IV5/kiTUANflpzBwhu18Ok7kGyCq2a2jsOcVmk8gZNs04gyjuj8JziYwwLbf\n\tvzABwpFVcS8aR+nHIZV1HtOzyw8CsL8OySc3K9y+Y0NRpziMRvutrppzgyMb9V+N31mK9Mxl\n\t1YkgaTl4ciNWpdfUe0yxH03OCuHi3922qhPLF4XX5LN+NaVw5Xz2o3eeWklXdouxwV7QlN33\n\tu4+u2FWzKxDqO6WLQGjxPE0mVB4Gh5Pa1Vb0ct9Ctg0qElvtGQARAQABzShEYW4gU2NhbGx5\n\tIDxkYW4uc2NhbGx5QGlkZWFzb25ib2FyZC5jb20+wsGNBBMBCAA3FiEEsdtt8OWP7+8SNfQe\n\tkiQuh/L+GMQFAmLydlIFCQWj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Vv8mO49gqQdrRIOheZycDmHnItt\n\t9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<20250123114204.79321-15-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]