From patchwork Fri Aug 15 10:29:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24115 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 6BE9CC3295 for ; Fri, 15 Aug 2025 10:30:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 265266925B; Fri, 15 Aug 2025 12:30:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="C8SXeWd2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 60FB16925A for ; Fri, 15 Aug 2025 12:30:07 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:83d1:ae5d:93a6:6837]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 74F8A8FA; Fri, 15 Aug 2025 12:29:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755253752; bh=vRIt0fUbQLSaJVdE4cxg6zt3hLZ2gNIeZpaOQTNzNKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8SXeWd2liwsRYKQKIlZMICZO7lg3HtajPKCZh1R4tXGXJ6fnd8dAPkvDMPRAsRZE FG/KDQmcaxdKdW8xdAc99Aeq5lrCKSvVHdXTuwgSfugxO6Y/NL2ffrl/94kmVo4cu5 0+EsJ1VDNprsYoZJoWx/6oIPLwsFHf3updZl+sdU= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , Daniel Scally Subject: [PATCH v3 05/19] libipa: exposure_mode_helper: Remove double calculation of lastStageGain Date: Fri, 15 Aug 2025 12:29:25 +0200 Message-ID: <20250815102945.1602071-6-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250815102945.1602071-1-stefan.klug@ideasonboard.com> References: <20250815102945.1602071-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 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 b18c30a6291c..cd81503e07d6 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; } /*