{"id":22816,"url":"https://patchwork.libcamera.org/api/1.1/patches/22816/?format=json","web_url":"https://patchwork.libcamera.org/patch/22816/","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":"<20250221092045.3896021-3-paul.elder@ideasonboard.com>","date":"2025-02-21T09:20:44","name":"[v2,2/3] ipa: rkisp1: Alias lineDuration","commit_ref":"2abfcac1c3b477539351dc18792c61833b9e950b","pull_url":null,"state":"accepted","archived":false,"hash":"8f58dd88a35886d1d61b444953cae75ef4c783e6","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22816/mbox/","series":[{"id":5009,"url":"https://patchwork.libcamera.org/api/1.1/series/5009/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5009","date":"2025-02-21T09:20:42","name":"ipa: rkisp1: Honor FrameDurationLimits","version":2,"mbox":"https://patchwork.libcamera.org/series/5009/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22816/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22816/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 ECE84BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Feb 2025 09:21:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8E5D5686B2;\n\tFri, 21 Feb 2025 10:21:14 +0100 (CET)","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 0EF33686AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Feb 2025 10:21:10 +0100 (CET)","from neptunite.hamster-moth.ts.net (unknown\n\t[IPv6:2404:7a81:160:2100:d97a:61eb:567:25d8])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1629F89A;\n\tFri, 21 Feb 2025 10:19:43 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nbwIEujg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740129586;\n\tbh=Dlw61HCry4WFYuB4Aw7sOVdqAjvzQiny4wwlPS/S+GY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nbwIEujgQt/98RFSEH2T0ZZsAJri72J0Y/12D6evWnDrCHKHiIKvCZd+4LJ/vtLg6\n\tH6/C84RjwsfJwlP495NFtxbfxb03r7HX4VKGOuGWFYdJrYSH8RmuuioeRvBQPllz+M\n\tSIKAh0k4HS+5+T1dAuxWoRulAa0YwS5gNrsNO2O8=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tisaac.scott@ideasonboard.com, Paul Elder <paul.elder@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","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","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":"From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThe 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>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- recover from bitrot\n- constize lineDuration\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 03dc56c96996..5fece545677e 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -470,6 +470,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\treturn;\n \t}\n \n+\tconst utils::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@@ -519,8 +521,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@@ -537,8 +538,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 = newExposureTime\n-\t\t\t\t\t   / context.configuration.sensor.lineDuration;\n+\tactiveState.agc.automatic.exposure = newExposureTime / lineDuration;\n \tactiveState.agc.automatic.gain = aGain;\n \n \tfillMetadata(context, frameContext, metadata);\n","prefixes":["v2","2/3"]}