[{"id":35709,"web_url":"https://patchwork.libcamera.org/comment/35709/","msgid":"<175706897937.1787083.14843032747719428783@neptunite.rasen.tech>","date":"2025-09-05T10:42:59","subject":"Re: [PATCH v3 05/19] libipa: exposure_mode_helper: Remove double\n\tcalculation of lastStageGain","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-08-15 19:29:25)\n> lastStageGain gets recalculated unconditionally even though it is the\n> stageGain of the last stage. Refactor for increased simplicity and\n> efficiency.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v3:\n> - Collected tags\n> ---\n>  src/ipa/libipa/exposure_mode_helper.cpp | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp\n> index b18c30a6291c..cd81503e07d6 100644\n> --- a/src/ipa/libipa/exposure_mode_helper.cpp\n> +++ b/src/ipa/libipa/exposure_mode_helper.cpp\n> @@ -198,10 +198,10 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const\n>  \n>         utils::Duration exposureTime;\n>         double stageGain = 1.0;\n> +       double lastStageGain = 1.0;\n>         double gain;\n>  \n>         for (unsigned int stage = 0; stage < gains_.size(); stage++) {\n> -               double lastStageGain = stage == 0 ? 1.0 : clampGain(gains_[stage - 1]);\n>                 utils::Duration stageExposureTime = clampExposureTime(exposureTimes_[stage]);\n>                 stageGain = clampGain(gains_[stage]);\n>  \n> @@ -228,6 +228,8 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const\n>  \n>                         return { exposureTime, gain, exposure / (exposureTime * gain) };\n>                 }\n> +\n> +               lastStageGain = stageGain;\n>         }\n>  \n>         /*\n> -- \n> 2.48.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5FE2AC332A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Sep 2025 10:43:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2855E6936C;\n\tFri,  5 Sep 2025 12:43:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B0B9369355\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Sep 2025 12:43:05 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:dbfb:387c:7405:52bc])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id EBF581340; \n\tFri,  5 Sep 2025 12:41:54 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uPV+srp9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1757068915;\n\tbh=70Zr7kaFNrEWCPJbOoMpH/3NC/amHo7ZcwrSLa8j3l4=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=uPV+srp9ZNH2kXN2sTFzwq4OXvZwnZYK8EzY5u9Twi3zzN/w3CgFYpfK7EEdX9ZrI\n\tx+fLsjCwJpqZ79BuVgjARNEhg+aSRrwhJu6UYAehrwAYC9+JBn/D+sg/3W04eSCuX0\n\tVKOtjUkxsQqLNTkhCWn6M7ByXGGD2y/B4qvtz0jM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250815102945.1602071-6-stefan.klug@ideasonboard.com>","References":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>\n\t<20250815102945.1602071-6-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v3 05/19] libipa: exposure_mode_helper: Remove double\n\tcalculation of lastStageGain","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 05 Sep 2025 19:42:59 +0900","Message-ID":"<175706897937.1787083.14843032747719428783@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]