From patchwork Fri Aug 15 10:29:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24125 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 CAD2FBDCC1 for ; Fri, 15 Aug 2025 10:30:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F60D6926A; Fri, 15 Aug 2025 12:30:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ej1C5m+0"; 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 3F2BE69257 for ; Fri, 15 Aug 2025 12:30:38 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:83d1:ae5d:93a6:6837]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 3248219E5; Fri, 15 Aug 2025 12:29:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755253783; bh=ZhQssLTk6Knl4i/cXB1YEj0E3+qtXJP6XTwKl9chwW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ej1C5m+0+yGLnkY/dR1fh1HzHMHimsMKwBZepl8BjwVtMG2jqJuuappKBxbRtjC7K DDnf3SoRctfonYUVdA0kzSqgc3XfzWh4/zgBioEX+TVK2ia/0HreJW3liRqFQHUb/e 6M9Gt3mJp5S1uWewW1sGgbb7ZQVNOPqM52yR8QPw= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 15/19] libipa: agc_mean_luminance: Introduce effectiveYTarget() accessor Date: Fri, 15 Aug 2025 12:29:35 +0200 Message-ID: <20250815102945.1602071-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250815102945.1602071-1-stefan.klug@ideasonboard.com> References: <20250815102945.1602071-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" The upcoming WDR algorithm needs to know the effective y target (Which includes the current ExposureValue). Add a accessor for that. Signed-off-by: Stefan Klug Reviewed-by: Daniel Scally --- Changes in v3: - Added this patch --- src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++-- src/ipa/libipa/agc_mean_luminance.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp index 6c7cf0038b16..2bfafe9b2d02 100644 --- a/src/ipa/libipa/agc_mean_luminance.cpp +++ b/src/ipa/libipa/agc_mean_luminance.cpp @@ -458,8 +458,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime, */ double AgcMeanLuminance::estimateInitialGain() const { - double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_, - kMaxRelativeLuminanceTarget); + double yTarget = effectiveYTarget(); double yGain = 1.0; /* @@ -521,6 +520,19 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex, return gain; } +/** + * \brief Get the currently effective y target + * + * This function return the current y target including exposure compensation. + * + * \return The y target value + */ +double AgcMeanLuminance::effectiveYTarget() const +{ + return std::min(relativeLuminanceTarget_ * exposureCompensation_, + kMaxRelativeLuminanceTarget); +} + /** * \brief Apply a filter on the exposure value to limit the speed of changes * \param[in] exposureValue The target exposure from the AGC algorithm diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h index fbb526f6ae8e..950b7b893754 100644 --- a/src/ipa/libipa/agc_mean_luminance.h +++ b/src/ipa/libipa/agc_mean_luminance.h @@ -72,6 +72,8 @@ public: calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex, const Histogram &yHist, utils::Duration effectiveExposureValue); + double effectiveYTarget() const; + void resetFrameCount() { frameCount_ = 0;