[{"id":35464,"web_url":"https://patchwork.libcamera.org/comment/35464/","msgid":"<59d75958-8ace-4c95-8031-38dcdad69ff2@ideasonboard.com>","date":"2025-08-18T07:56:10","subject":"Re: [PATCH v3 15/19] libipa: agc_mean_luminance: Introduce\n\teffectiveYTarget() accessor","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Morning Stefan\n\nOn 15/08/2025 11:29, Stefan Klug wrote:\n> The upcoming WDR algorithm needs to know the effective y target (Which\n> includes the current ExposureValue). Add a accessor for that.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n\nLooks ok:\n\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\n> \n> Changes in v3:\n> - Added this patch\n> ---\n>   src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--\n>   src/ipa/libipa/agc_mean_luminance.h   |  2 ++\n>   2 files changed, 16 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n> index 6c7cf0038b16..2bfafe9b2d02 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n> @@ -458,8 +458,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,\n>    */\n>   double AgcMeanLuminance::estimateInitialGain() const\n>   {\n> -\tdouble yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,\n> -\t\t\t\t  kMaxRelativeLuminanceTarget);\n> +\tdouble yTarget = effectiveYTarget();\n>   \tdouble yGain = 1.0;\n>   \n>   \t/*\n> @@ -521,6 +520,19 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,\n>   \treturn gain;\n>   }\n>   \n> +/**\n> + * \\brief Get the currently effective y target\n> + *\n> + * This function return the current y target including exposure compensation.\n> + *\n> + * \\return The y target value\n> + */\n> +double AgcMeanLuminance::effectiveYTarget() const\n> +{\n> +\treturn std::min(relativeLuminanceTarget_ * exposureCompensation_,\n> +\t\t\tkMaxRelativeLuminanceTarget);\n> +}\n> +\n>   /**\n>    * \\brief Apply a filter on the exposure value to limit the speed of changes\n>    * \\param[in] exposureValue The target exposure from the AGC algorithm\n> diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h\n> index fbb526f6ae8e..950b7b893754 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.h\n> +++ b/src/ipa/libipa/agc_mean_luminance.h\n> @@ -72,6 +72,8 @@ public:\n>   \tcalculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,\n>   \t\t       const Histogram &yHist, utils::Duration effectiveExposureValue);\n>   \n> +\tdouble effectiveYTarget() const;\n> +\n>   \tvoid resetFrameCount()\n>   \t{\n>   \t\tframeCount_ = 0;","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 C57B1BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Aug 2025 07:56:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AA4676925C;\n\tMon, 18 Aug 2025 09:56:15 +0200 (CEST)","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 87D826924E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Aug 2025 09:56:14 +0200 (CEST)","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 68E4617D1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Aug 2025 09:55:17 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ayh/9pcK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755503717;\n\tbh=Iymnekep0+4MotrKh78qIUEbuzsDNFzPpOinL8zE9l0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=Ayh/9pcKiZnUGD5tGk9NTi3z8RcBcEh5v24kzxkeYjyR9KboWXUQuvfOJjmO9I2Hu\n\t9WweAM8B8KSlsP+BXO69PT5S4WMWiCEtvOjKqcM7DSWhs4e20QeI++arKDX4bn9d0H\n\tQzIT4f7D7MaeG904lAM7hBEJdt8uYZVTiLNxXiGs=","Message-ID":"<59d75958-8ace-4c95-8031-38dcdad69ff2@ideasonboard.com>","Date":"Mon, 18 Aug 2025 08:56:10 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 15/19] libipa: agc_mean_luminance: Introduce\n\teffectiveYTarget() accessor","To":"libcamera-devel@lists.libcamera.org","References":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>\n\t<20250815102945.1602071-16-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","In-Reply-To":"<20250815102945.1602071-16-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":35704,"web_url":"https://patchwork.libcamera.org/comment/35704/","msgid":"<175706897471.1787083.2601657788766065974@neptunite.rasen.tech>","date":"2025-09-05T10:42:54","subject":"Re: [PATCH v3 15/19] libipa: agc_mean_luminance: Introduce\n\teffectiveYTarget() accessor","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-08-15 19:29:35)\n> The upcoming WDR algorithm needs to know the effective y target (Which\n> includes the current ExposureValue). Add a accessor for that.\n\ns/a /an /\n\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> \n> Changes in v3:\n> - Added this patch\n> ---\n>  src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--\n>  src/ipa/libipa/agc_mean_luminance.h   |  2 ++\n>  2 files changed, 16 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n> index 6c7cf0038b16..2bfafe9b2d02 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n> @@ -458,8 +458,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,\n>   */\n>  double AgcMeanLuminance::estimateInitialGain() const\n>  {\n> -       double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,\n> -                                 kMaxRelativeLuminanceTarget);\n> +       double yTarget = effectiveYTarget();\n>         double yGain = 1.0;\n>  \n>         /*\n> @@ -521,6 +520,19 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,\n>         return gain;\n>  }\n>  \n> +/**\n> + * \\brief Get the currently effective y target\n> + *\n> + * This function return the current y target including exposure compensation.\n\ns/return/returns/\n\nReviewed-by: Paul ELder <paul.elder@ideasonboard.com>\n\n> + *\n> + * \\return The y target value\n> + */\n> +double AgcMeanLuminance::effectiveYTarget() const\n> +{\n> +       return std::min(relativeLuminanceTarget_ * exposureCompensation_,\n> +                       kMaxRelativeLuminanceTarget);\n> +}\n> +\n>  /**\n>   * \\brief Apply a filter on the exposure value to limit the speed of changes\n>   * \\param[in] exposureValue The target exposure from the AGC algorithm\n> diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h\n> index fbb526f6ae8e..950b7b893754 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.h\n> +++ b/src/ipa/libipa/agc_mean_luminance.h\n> @@ -72,6 +72,8 @@ public:\n>         calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,\n>                        const Histogram &yHist, utils::Duration effectiveExposureValue);\n>  \n> +       double effectiveYTarget() const;\n> +\n>         void resetFrameCount()\n>         {\n>                 frameCount_ = 0;\n> -- \n> 2.48.1\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 BE856BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Sep 2025 10:43:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AB0B6935C;\n\tFri,  5 Sep 2025 12:43:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21E8C69346\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Sep 2025 12:43:03 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:dbfb:387c:7405:52bc])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 61807122A; \n\tFri,  5 Sep 2025 12:41:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"N7sqvfwz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1757068913;\n\tbh=6KSnlCs358V+9JQwgSXC3UkhKbJYupqILplv6sqJc3g=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=N7sqvfwzHkLM2zPIl3x7+s4/eson8lu/6yQcfekbjAk+M/+AdO8uUFI3MpAaoka8r\n\tANfIfpgTZmSf7ilHA/8BnaLJuR/l15I03WySkr8wMQiuCpTMkgCNt+K96yd1UPTkz1\n\tf3UZq7dkPE0YeSDYAWJvanLdq8peiCK6Hlc5W2NE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250815102945.1602071-16-stefan.klug@ideasonboard.com>","References":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>\n\t<20250815102945.1602071-16-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v3 15/19] libipa: agc_mean_luminance: Introduce\n\teffectiveYTarget() accessor","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 05 Sep 2025 19:42:54 +0900","Message-ID":"<175706897471.1787083.2601657788766065974@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]