From patchwork Mon Oct 14 15:47:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 21622 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 B61A1C32F8 for ; Mon, 14 Oct 2024 15:47:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 223946537F; Mon, 14 Oct 2024 17:47:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dsan8NkE"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AB9986537C for ; Mon, 14 Oct 2024 17:47:51 +0200 (CEST) Received: from Monstersaurus.lgs-net.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B521C1A7D; Mon, 14 Oct 2024 17:46:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728920770; bh=vRUR7g/TSz4JQ2oCCbcODkPCd4KnGcL78O40biOmxdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsan8NkErtUzixJtJ+wNrS4WfLLu+KFYWjJQAdYbnV71yHHSOXO/Sh2w2mNkJ4n+/ 1diuvcueBme5Z8tR+AtYS9Ml3g+KYIeBCqnBpEVSEL+CJh8UhyFbkSGuXVWdw3uh5r FlwS5L9RaRhnWYIRfe1bU4T4GQgMb91MS7KcgO28= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH 2/3] ipa: rkisp1: Alias lineDuration Date: Mon, 14 Oct 2024 16:47:46 +0100 Message-Id: <20241014154747.2295253-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241014154747.2295253-1-kieran.bingham@ideasonboard.com> References: <20241014154747.2295253-1-kieran.bingham@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 configured line duration of the sensor is used frequently throughout the AGC implementation. It's available in the IPA context through the rather long: context.configuration.sensor.lineDuration Take a copy of the lineDuration early in the call and replace the two current usages of the reference with the shorter copy to manage line length and ease readibility. Signed-off-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Daniel Scally Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder --- src/ipa/rkisp1/algorithms/agc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 33f902862c4a..e23ab120b3e2 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -400,6 +400,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, return; } + utils::Duration lineDuration = context.configuration.sensor.lineDuration; + /* * \todo Verify that the exposure and gain applied by the sensor for * this frame match what has been requested. This isn't a hard @@ -429,8 +431,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, * The Agc algorithm needs to know the effective exposure value that was * applied to the sensor when the statistics were collected. */ - utils::Duration exposureTime = context.configuration.sensor.lineDuration - * frameContext.sensor.exposure; + utils::Duration exposureTime = lineDuration * frameContext.sensor.exposure; double analogueGain = frameContext.sensor.gain; utils::Duration effectiveExposureValue = exposureTime * analogueGain; @@ -447,7 +448,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAActiveState &activeState = context.activeState; /* Update the estimated exposure and gain. */ - activeState.agc.automatic.exposure = shutterTime / context.configuration.sensor.lineDuration; + activeState.agc.automatic.exposure = shutterTime / lineDuration; activeState.agc.automatic.gain = aGain; fillMetadata(context, frameContext, metadata);