From patchwork Fri Feb 21 09:20:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22816 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 ECE84BDCC1 for ; Fri, 21 Feb 2025 09:21:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8E5D5686B2; Fri, 21 Feb 2025 10:21:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nbwIEujg"; 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 0EF33686AB for ; Fri, 21 Feb 2025 10:21:10 +0100 (CET) Received: from neptunite.hamster-moth.ts.net (unknown [IPv6:2404:7a81:160:2100:d97a:61eb:567:25d8]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1629F89A; Fri, 21 Feb 2025 10:19:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740129586; bh=Dlw61HCry4WFYuB4Aw7sOVdqAjvzQiny4wwlPS/S+GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbwIEujgQt/98RFSEH2T0ZZsAJri72J0Y/12D6evWnDrCHKHiIKvCZd+4LJ/vtLg6 H6/C84RjwsfJwlP495NFtxbfxb03r7HX4VKGOuGWFYdJrYSH8RmuuioeRvBQPllz+M SIKAh0k4HS+5+T1dAuxWoRulAa0YwS5gNrsNO2O8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham , isaac.scott@ideasonboard.com, Paul Elder , Umang Jain , Daniel Scally , Laurent Pinchart Subject: [PATCH v2 2/3] ipa: rkisp1: Alias lineDuration Date: Fri, 21 Feb 2025 18:20:44 +0900 Message-Id: <20250221092045.3896021-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250221092045.3896021-1-paul.elder@ideasonboard.com> References: <20250221092045.3896021-1-paul.elder@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: Kieran Bingham 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 Signed-off-by: Paul Elder Reviewed-by: Umang Jain Reviewed-by: Daniel Scally Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder --- Changes in v2: - recover from bitrot - constize lineDuration --- src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 03dc56c96996..5fece545677e 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -470,6 +470,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, return; } + const 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 @@ -519,8 +521,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; @@ -537,8 +538,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 = newExposureTime - / context.configuration.sensor.lineDuration; + activeState.agc.automatic.exposure = newExposureTime / lineDuration; activeState.agc.automatic.gain = aGain; fillMetadata(context, frameContext, metadata);