From patchwork Mon Aug 17 11:43:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 27825 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 E1914C3263 for ; Mon, 17 Aug 2026 11:45:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8BEAF6828D; Mon, 17 Aug 2026 13:45:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Zc4tbpML"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E4A9E682BB for ; Mon, 17 Aug 2026 13:44:08 +0200 (CEST) Received: from pb-laptop.local (catv-89-132-78-151.catv.fixed.one.hu [89.132.78.151]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D60319C6; Mon, 17 Aug 2026 13:42:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1786966969; bh=bHDuSFzA921QJpRPHPT0r2N5jG/Xue4GmkemJCvzrnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zc4tbpML441fmGoEIyRsSU1tckPDE1QHNO2d7ymk7epptxT4sQpi1GDZmNfLSdxnj 7e2rcZ3QPepOE+gLBtlge0OkPqw9LSkaGPnYHmTohtUJOGJPsAMRegJ6EUmf4rs/gj ZXw+L8emvJ9r22dcXxCsm6R0PtgixLWf4TH7a/CA= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Stefan Klug , Paul Elder Subject: [PATCH v5 47/47] ipa: libipa: agc_mean_luminance: Fold resetFrameCount() in configure() Date: Mon, 17 Aug 2026 13:43:48 +0200 Message-ID: <20260817114349.994123-48-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817114349.994123-1-barnabas.pocze@ideasonboard.com> References: <20260817114349.994123-1-barnabas.pocze@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" From: Jacopo Mondi The AgcMeanLuminance::resetFrameCount() function has to be called after a call to AgcMeanLuminance::configure(). As the two calls always happen one after another, do not require each IPA implementation to do that but fold instead the call to resetFrameCount() in AgcMeanLuminance::configure(). Update the AgcMeanLuminance class documentation accordingly. Signed-off-by: Jacopo Mondi Signed-off-by: Barnabás Pőcze Reviewed-by: Stefan Klug Reviewed-by: Paul Elder --- src/ipa/libipa/agc.cpp | 1 - src/ipa/libipa/agc_mean_luminance.cpp | 21 ++++++--------------- src/ipa/libipa/agc_mean_luminance.h | 5 ----- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index d327548979..af9b0b600c 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -451,7 +451,6 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, ASSERT(sensor_); impl.configure(session.lineDuration, sensor_); - impl.resetFrameCount(); if (session.autoAllowed) { config.ctrlMap[&controls::ExposureValue] = ControlInfo(-8.0f, 8.0f, 0.0f); diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp index 8303065008..2459f8b44a 100644 --- a/src/ipa/libipa/agc_mean_luminance.cpp +++ b/src/ipa/libipa/agc_mean_luminance.cpp @@ -169,11 +169,11 @@ static constexpr unsigned int kDefaultLuxLevel = 500; * * IPA modules that want to use this class to implement their AEGC algorithm * should derive AgcMeanLuminance::Traits and override the necessary functions. - * The users must call parseTuningData() in init(), and must also call setLimits() - * and resetFrameCounter() in configure(). They may then use calculateNewEv() in - * process(). If the limits passed to setLimits() change for any reason (for example, - * in response to a FrameDurationLimit control being passed in queueRequest()) - * then setLimits() must be called again with the new values. + * The users must call parseTuningData() in init(), and must also call configure() + * and setLimits() in configure(). They may then use calculateNewEv() in process(). + * If the limits passed to setLimits() change for any reason (for example, in + * response to a FrameDurationLimit control being passed in queueRequest()) then + * setLimits() must be called again with the new values. */ AgcMeanLuminance::AgcMeanLuminance() @@ -354,6 +354,7 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration, luxWarningEnabled_ = true; filteredExposure_ = 0s; + frameCount_ = 0; } /** @@ -699,16 +700,6 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms) return { exposureModeHelper.splitExposure(newExposureValue), yTarget }; } -/** - * \fn AgcMeanLuminance::resetFrameCount() - * \brief Reset the frame counter - * - * This function resets the internal frame counter, which exists to help the - * algorithm decide whether it should respond instantly or not. The expectation - * is for users to call this function before each camera start call in their - * configure() function. - */ - } /* namespace ipa */ } /* namespace libcamera */ diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h index 46a4d3e3f3..f799618ffc 100644 --- a/src/ipa/libipa/agc_mean_luminance.h +++ b/src/ipa/libipa/agc_mean_luminance.h @@ -79,11 +79,6 @@ public: double effectiveYTarget(double lux, double exposureCompensation) const; - void resetFrameCount() - { - frameCount_ = 0; - } - private: int parseRelativeLuminanceTarget(const ValueNode &tuningData); int parseConstraint(const ValueNode &modeDict, int32_t id);