From patchwork Fri Sep 19 09:40:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24414 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 47411C3329 for ; Fri, 19 Sep 2025 09:41:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BBDF16B5AC; Fri, 19 Sep 2025 11:41:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jwyfyozz"; 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 742CA6B5A0 for ; Fri, 19 Sep 2025 11:41:08 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4d54:eab8:98ca:163b]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 45880819; Fri, 19 Sep 2025 11:39:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758274788; bh=GMp4tviTO5X+GDxI2B6CSa8Wv63WvQ0SUMM2BTCrffE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwyfyozzhMMtO7O+9GitBEHz5nwi6FaLct8GdbU9URXn4HYTvI/dGBhmUlXmjys+n YiRuUS4f0I5vUa4VYpUDQEBk8psRW/Qy/e2Czd3M+8bVaNT7DKMimTUg3WvDXXYr9U Ulqt3rU2+rXDXgqOwWlaIBzf7m+SSWDNJcYTHHlM= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , Daniel Scally , Paul Elder Subject: [PATCH v5 05/19] libipa: exposure_mode_helper: Remove double calculation of lastStageGain Date: Fri, 19 Sep 2025 11:40:20 +0200 Message-ID: <20250919094041.183031-6-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250919094041.183031-1-stefan.klug@ideasonboard.com> References: <20250919094041.183031-1-stefan.klug@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" lastStageGain gets recalculated unconditionally even though it is the stageGain of the last stage. Refactor for increased simplicity and efficiency. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham Reviewed-by: Daniel Scally Reviewed-by: Paul Elder --- Changes in v4: - Collected tag Changes in v3: - Collected tags --- src/ipa/libipa/exposure_mode_helper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp index b776a031b441..e806731047cf 100644 --- a/src/ipa/libipa/exposure_mode_helper.cpp +++ b/src/ipa/libipa/exposure_mode_helper.cpp @@ -198,10 +198,10 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const utils::Duration exposureTime; double stageGain = 1.0; + double lastStageGain = 1.0; double gain; for (unsigned int stage = 0; stage < gains_.size(); stage++) { - double lastStageGain = stage == 0 ? 1.0 : clampGain(gains_[stage - 1]); utils::Duration stageExposureTime = clampExposureTime(exposureTimes_[stage]); stageGain = clampGain(gains_[stage]); @@ -228,6 +228,8 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const return { exposureTime, gain, exposure / (exposureTime * gain) }; } + + lastStageGain = stageGain; } /*