From patchwork Mon Aug 3 13:14:11 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: 27578 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 752FFC333F for ; Mon, 3 Aug 2026 13:15:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C0F08680E5; Mon, 3 Aug 2026 15:15:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="csZZQxbj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC3D568099 for ; Mon, 3 Aug 2026 15:14:44 +0200 (CEST) Received: from pb-laptop.local (185.221.141.208.nat.pool.zt.hu [185.221.141.208]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E7AC6981 for ; Mon, 3 Aug 2026 15:13:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1785762816; bh=kz+5+wqwO0NDaVrSqKS/DXHRZS7pQug6lnSow8DYewM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=csZZQxbjPO5umjDlc1FPKg9OB7aGmJehDz22DYCtkfDqmsAjmqlIVEOz2nntZt8kP v5O1W2foNe58JMdBH1LhhBbTFJqhy0voxKYfbINz4+4PRjuepZpE+EZblec8kt85l6 rjbLcKsCty9TKKZT8pTcJsI5W5X4WDyPhbrvW+ao= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v3 26/50] ipa: libipa: agc: Store digital gain Date: Mon, 3 Aug 2026 15:14:11 +0200 Message-ID: <20260803131435.153927-27-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260803131435.153927-1-barnabas.pocze@ideasonboard.com> References: <20260803131435.153927-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 --- 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 5273c1f64b..e9055ddd7b 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -100,6 +100,9 @@ LOG_DEFINE_CATEGORY(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 * @@ -322,6 +325,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; @@ -598,6 +602,7 @@ 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; newExposureTime = newEv.exposureTime; @@ -606,7 +611,7 @@ void AgcAlgorithm::process(const agc::Session &session, agc::ActiveState &state, << "exposure-time:" << utils::Duration(state.automatic.exposure * lineDuration) << " analogue-gain:" << state.automatic.gain << " quantization-gain:" << state.automatic.quantizationGain - << " digital-gain:" << newEv.digitalGain; + << " digital-gain:" << state.automatic.digitalGain; } /* diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h index ab85d9a3bd..b0f811e93d 100644 --- a/src/ipa/libipa/agc.h +++ b/src/ipa/libipa/agc.h @@ -74,6 +74,7 @@ struct ActiveState { uint32_t exposure; double gain; double quantizationGain; + double digitalGain; double yTarget; } automatic;