{"id":21622,"url":"https://patchwork.libcamera.org/api/1.1/patches/21622/?format=json","web_url":"https://patchwork.libcamera.org/patch/21622/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241014154747.2295253-3-kieran.bingham@ideasonboard.com>","date":"2024-10-14T15:47:46","name":"[2/3] ipa: rkisp1: Alias lineDuration","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"44275fcb12692a10543fa997923d0f62ffe2ea14","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21622/mbox/","series":[{"id":4697,"url":"https://patchwork.libcamera.org/api/1.1/series/4697/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4697","date":"2024-10-14T15:47:44","name":"ipa: rkisp1: Honor FrameDurationLimits","version":1,"mbox":"https://patchwork.libcamera.org/series/4697/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21622/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21622/checks/","tags":{},"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 B61A1C32F8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Oct 2024 15:47:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 223946537F;\n\tMon, 14 Oct 2024 17:47:56 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB9986537C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2024 17:47:51 +0200 (CEST)","from Monstersaurus.lgs-net.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B521C1A7D;\n\tMon, 14 Oct 2024 17:46:10 +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=\"dsan8NkE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728920770;\n\tbh=vRUR7g/TSz4JQ2oCCbcODkPCd4KnGcL78O40biOmxdI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=dsan8NkErtUzixJtJ+wNrS4WfLLu+KFYWjJQAdYbnV71yHHSOXO/Sh2w2mNkJ4n+/\n\t1diuvcueBme5Z8tR+AtYS9Ml3g+KYIeBCqnBpEVSEL+CJh8UhyFbkSGuXVWdw3uh5r\n\tFlwS5L9RaRhnWYIRfe1bU4T4GQgMb91MS7KcgO28=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","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","Content-Transfer-Encoding":"8bit","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>"},"content":"The configured line duration of the sensor is used frequently throughout\nthe AGC implementation.\n\nIt's available in the IPA context through the rather long:\n  context.configuration.sensor.lineDuration\n\nTake a copy of the lineDuration early in the call and replace the two\ncurrent usages of the reference with the shorter copy to manage line\nlength and ease readibility.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 33f902862c4a..e23ab120b3e2 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -400,6 +400,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\treturn;\n \t}\n \n+\tutils::Duration lineDuration = context.configuration.sensor.lineDuration;\n+\n \t/*\n \t * \\todo Verify that the exposure and gain applied by the sensor for\n \t * this frame match what has been requested. This isn't a hard\n@@ -429,8 +431,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t * The Agc algorithm needs to know the effective exposure value that was\n \t * applied to the sensor when the statistics were collected.\n \t */\n-\tutils::Duration exposureTime = context.configuration.sensor.lineDuration\n-\t\t\t\t       * frameContext.sensor.exposure;\n+\tutils::Duration exposureTime = lineDuration * frameContext.sensor.exposure;\n \tdouble analogueGain = frameContext.sensor.gain;\n \tutils::Duration effectiveExposureValue = exposureTime * analogueGain;\n \n@@ -447,7 +448,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \n \tIPAActiveState &activeState = context.activeState;\n \t/* Update the estimated exposure and gain. */\n-\tactiveState.agc.automatic.exposure = shutterTime / context.configuration.sensor.lineDuration;\n+\tactiveState.agc.automatic.exposure = shutterTime / lineDuration;\n \tactiveState.agc.automatic.gain = aGain;\n \n \tfillMetadata(context, frameContext, metadata);\n","prefixes":["2/3"]}