From patchwork Fri Aug 21 13:01:57 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: 27991 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 0E48EC3347 for ; Fri, 21 Aug 2026 13:03:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6BB29683E1; Fri, 21 Aug 2026 15:03:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Rj6AKpLz"; 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 9AD43683AD for ; Fri, 21 Aug 2026 15:02:29 +0200 (CEST) Received: from pb-laptop.local (185.221.143.32.nat.pool.zt.hu [185.221.143.32]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 58D6B2971; Fri, 21 Aug 2026 15:01:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1787317267; bh=WlX7BFKOAsXP2cPCSoeVKRKS1dy0Fc+fIN8xycIAgec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rj6AKpLzx4Qc7TBbNEU76Qe2nRzDsO7RN6Yo4E6/GOuLgrvcpY69KQf8+P/k2Qudj DRh+T5aVEUjCSKftiqYaIHVbUTKqU/l2myPM5dXSC84hy7uUEjYK85sQ+mW0ycQ17h +txskZmgDi+Nafle6593Uqs7YluWMXv7MAPHrIUQ= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Stefan Klug Subject: [PATCH v7 27/47] ipa: libipa: agc: Store digital gain Date: Fri, 21 Aug 2026 15:01:57 +0200 Message-ID: <20260821130218.2706196-28-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260821130218.2706196-1-barnabas.pocze@ideasonboard.com> References: <20260821130218.2706196-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" While digital gain support is not implemented yet, start by storing the suggested digital gain in the active state. Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Stefan Klug --- src/ipa/libipa/agc.cpp | 7 ++++++- src/ipa/libipa/agc.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index e593eac64a..0e14abc20c 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -134,6 +134,9 @@ namespace agc { * \var agc::ActiveState::automatic.quantizationGain * \brief Automatic quantization gain multiplier * + * \var agc::ActiveState::automatic.digitalGain + * \brief Automatic digital gain multiplier + * * \var agc::ActiveState::automatic.yTarget * \brief Automatically determined luminance target * @@ -371,6 +374,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, state.automatic.gain = session.minAnalogueGain; state.automatic.exposure = defExposure; state.automatic.quantizationGain = 1; + state.automatic.digitalGain = 1; state.automatic.yTarget = impl_.effectiveYTarget(0, 1); state.manual.gain = state.automatic.gain; state.manual.exposure = state.automatic.exposure; @@ -669,13 +673,14 @@ void AgcAlgorithm::process(const agc::Session &session, agc::ActiveState &state, state.automatic.exposure = newEv.exposureTime / lineDuration; state.automatic.gain = newEv.analogueGain; state.automatic.quantizationGain = newEv.quantizationGain; + state.automatic.digitalGain = newEv.digitalGain; state.automatic.yTarget = newEv.yTarget; LOG(Agc, Debug) << "exposure-time: " << newEv.exposureTime << ", " << "analogue-gain: " << state.automatic.gain << ", " << "quantization-gain: " << state.automatic.quantizationGain << ", " - << "digital-gain: " << newEv.digitalGain; + << "digital-gain: " << state.automatic.digitalGain; /* * Expand the target frame duration so that we do not run faster than diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h index 6795479f93..ddd01a4cbf 100644 --- a/src/ipa/libipa/agc.h +++ b/src/ipa/libipa/agc.h @@ -58,6 +58,7 @@ struct ActiveState { uint32_t exposure; double gain; double quantizationGain; + double digitalGain; double yTarget; } automatic;