From patchwork Fri Sep 19 09:40:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24424 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 7EB32C3329 for ; Fri, 19 Sep 2025 09:41:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EBD186B5E0; Fri, 19 Sep 2025 11:41:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VOvjQDwZ"; 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 EBF026B5C8 for ; Fri, 19 Sep 2025 11:41:37 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4d54:eab8:98ca:163b]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 9BE43819; Fri, 19 Sep 2025 11:40:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758274817; bh=NiZvUMrY2M4TQbAJAj4uMOM4cpMQWjAcK/qcd89IooM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOvjQDwZafn2H1wyhgt7ZLD9FaJKGEuZ0NTWYlO00B/QiW/DqT8NyOUZ00XR3LxKL nvkNlMLkJM0o8fNWNeOqlV4Zf4irI/0hVJqbCb8+Ks8EkYjVCoXPCDQBT57V0Du5kI GgW2h3zPchx5Xt15Vnh0PukWi/0ndlYSKlSgbCcQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Daniel Scally , Paul ELder Subject: [PATCH v5 15/19] libipa: agc_mean_luminance: Introduce effectiveYTarget() accessor Date: Fri, 19 Sep 2025 11:40:30 +0200 Message-ID: <20250919094041.183031-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250919094041.183031-1-stefan.klug@ideasonboard.com> References: <20250919094041.183031-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 an accessor for that. Signed-off-by: Stefan Klug Reviewed-by: Daniel Scally Reviewed-by: Paul ELder --- Changes in v4: - Fixed typos in documentation - Collected tags 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 41c7f72de8ed..45eba97516f3 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 returns 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;