[{"id":31896,"web_url":"https://patchwork.libcamera.org/comment/31896/","msgid":"<079e6864-49a9-4456-bd50-5aa95bec78dc@ideasonboard.com>","date":"2024-10-24T03:36:55","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn 14/10/24 9:17 pm, Kieran Bingham wrote:\n> The IPA calculates and reports the FrameDurationLimits to applications\n> by configuring the ControlInfo accordingly during\n> IPARkISP1::updateControls()\n>\n> We later need to know these limits during Agc::configure() for\n> initialising the ActiveState of the AGC implementation with the limits.\n>\n> Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> now present in the IPAContext so that it is commonly available for the\n> AGC algorithm, removing the 'todo' accordingly.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>   src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n>   src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n>   2 files changed, 5 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..33f902862c4a 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>   \tcontext.activeState.agc.meteringMode =\n>   \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n>   \n> -\t/*\n> -\t * \\todo This should probably come from FrameDurationLimits instead,\n> -\t * except it's computed in the IPA and not here so we'd have to\n> -\t * recompute it.\n> -\t */\n> -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> +\t/* Limit the frame duration to match current initialisation */\n\ns/initialisation/initialization./\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n> +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n>   \n>   \t/*\n>   \t * Define the measurement window for AGC as a centered rectangle\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 9e161cabdea4..47777ece783f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>   \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>   \t}\n>   \n> -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t      frameDurations[1],\n> -\t\t\t\t\t\t\t      frameDurations[2]);\n> +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n>   \n>   \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n>   \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);","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 AEC77C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Oct 2024 03:37:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D269265395;\n\tThu, 24 Oct 2024 05:37:01 +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 166A565392\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 05:37:00 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F11F73D5;\n\tThu, 24 Oct 2024 05:35:11 +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=\"fC3S0oit\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729740912;\n\tbh=ECWI/bgqDSrVSMubkAhuWBV1MgRtNHaIfYugYijiGeU=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=fC3S0oitkPB1Hmtlln6GGwtZpMMgr+uQnKwbyk74SwUqRvrFG5pWEgFVbZQ3UpRXj\n\tXopkBFvkxQPqLIj6KodXssOVA157JbewmSD4IAH3tDQMDdz1kiPFaJAv0h8Gxz9n/n\n\tdas+mrlPfXvTuUHKxfePm96uDvXjToCfh4vyXGkU=","Message-ID":"<079e6864-49a9-4456-bd50-5aa95bec78dc@ideasonboard.com>","Date":"Thu, 24 Oct 2024 09:06:55 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":31903,"web_url":"https://patchwork.libcamera.org/comment/31903/","msgid":"<fc6d6463-52b9-4cfa-9bdb-948e6a4a2c23@ideasonboard.com>","date":"2024-10-24T09:23:56","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Kieran\n\nOn 14/10/2024 16:47, Kieran Bingham wrote:\n> The IPA calculates and reports the FrameDurationLimits to applications\n> by configuring the ControlInfo accordingly during\n> IPARkISP1::updateControls()\n>\n> We later need to know these limits during Agc::configure() for\n> initialising the ActiveState of the AGC implementation with the limits.\n>\n> Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> now present in the IPAContext so that it is commonly available for the\n> AGC algorithm, removing the 'todo' accordingly.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>   src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n>   src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n>   2 files changed, 5 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..33f902862c4a 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>   \tcontext.activeState.agc.meteringMode =\n>   \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n>   \n> -\t/*\n> -\t * \\todo This should probably come from FrameDurationLimits instead,\n> -\t * except it's computed in the IPA and not here so we'd have to\n> -\t * recompute it.\n> -\t */\n> -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> +\t/* Limit the frame duration to match current initialisation */\n> +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n> +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n>   \n>   \t/*\n>   \t * Define the measurement window for AGC as a centered rectangle\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 9e161cabdea4..47777ece783f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>   \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>   \t}\n>   \n> -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t      frameDurations[1],\n> -\t\t\t\t\t\t\t      frameDurations[2]);\n> +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n>   \n>   \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n>   \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);","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 16260C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Oct 2024 09:24:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4D05465393;\n\tThu, 24 Oct 2024 11:24:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFCC3603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 11:23:58 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 07ABA3D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 11:22: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=\"WSybTmOI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729761731;\n\tbh=jg7utRaOcWzfNXe3KijUm89915zBND6REFrqJsv1Mh8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=WSybTmOIoB29yD2dMSD7vtMa+2Bp7onWJAQiw74/HXfQafca6s4ZrGDemjBlz6C2E\n\tNszpwpn43Je+XOtLHBl6rjK5+CtyLye1BT9sDJa42ajAune3AmuARRa0jM8pXWGxVx\n\tRXbH9yTF/HzJjLq5RLgeZ0cFJp6bhTWJWDNq81oc=","Message-ID":"<fc6d6463-52b9-4cfa-9bdb-948e6a4a2c23@ideasonboard.com>","Date":"Thu, 24 Oct 2024 10:23:56 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","To":"libcamera-devel@lists.libcamera.org","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\t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","In-Reply-To":"<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":31908,"web_url":"https://patchwork.libcamera.org/comment/31908/","msgid":"<ywef3mgwg5yg3l7zbmeq27wen3a5hidzgke2bxnjmtwgadt4hf@pfvyarq25u5d>","date":"2024-10-24T15:39:19","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Kieran\n\nOn Mon, Oct 14, 2024 at 04:47:45PM +0100, Kieran Bingham wrote:\n> The IPA calculates and reports the FrameDurationLimits to applications\n> by configuring the ControlInfo accordingly during\n> IPARkISP1::updateControls()\n>\n> We later need to know these limits during Agc::configure() for\n> initialising the ActiveState of the AGC implementation with the limits.\n>\n> Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> now present in the IPAContext so that it is commonly available for the\n> AGC algorithm, removing the 'todo' accordingly.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n>  src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n>  2 files changed, 5 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..33f902862c4a 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>  \tcontext.activeState.agc.meteringMode =\n>  \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n>\n> -\t/*\n> -\t * \\todo This should probably come from FrameDurationLimits instead,\n> -\t * except it's computed in the IPA and not here so we'd have to\n> -\t * recompute it.\n> -\t */\n> -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> +\t/* Limit the frame duration to match current initialisation */\n> +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n> +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n>\n>  \t/*\n>  \t * Define the measurement window for AGC as a centered rectangle\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 9e161cabdea4..47777ece783f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>  \t}\n>\n> -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t      frameDurations[1],\n> -\t\t\t\t\t\t\t      frameDurations[2]);\n> +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n>\n>  \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n>  \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n> --\n> 2.34.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 CE77DC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Oct 2024 15:39:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CFE8065393;\n\tThu, 24 Oct 2024 17:39:23 +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 7EF44618C1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 17:39:22 +0200 (CEST)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D8E3C59D;\n\tThu, 24 Oct 2024 17:37:33 +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=\"GI7ZEvUk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729784254;\n\tbh=N23OmpoWBP3Z23Uuh7Bfg2JEK55I48iSTZgbWQ2frrA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GI7ZEvUkkfEixyn/jHVBtcRH8JIkhSKrwn2TUE1pPe/IFTvK8RkHk8wX4tI/Cr7vm\n\tEAPTQ+O5tZf3PNCBeSuIg8hrqGWmi1EAZ6T0DIj0UWSvG+1mivR02rsYGKkDRkKQA+\n\tftTL5gmP7G50yRVayBw5zhvlEHp8ZceIQSOJGOFk=","Date":"Thu, 24 Oct 2024 17:39:19 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","Message-ID":"<ywef3mgwg5yg3l7zbmeq27wen3a5hidzgke2bxnjmtwgadt4hf@pfvyarq25u5d>","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","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>"}},{"id":31926,"web_url":"https://patchwork.libcamera.org/comment/31926/","msgid":"<20241027185402.GC24052@pendragon.ideasonboard.com>","date":"2024-10-27T18:54:02","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Oct 14, 2024 at 04:47:45PM +0100, Kieran Bingham wrote:\n> The IPA calculates and reports the FrameDurationLimits to applications\n> by configuring the ControlInfo accordingly during\n> IPARkISP1::updateControls()\n> \n> We later need to know these limits during Agc::configure() for\n> initialising the ActiveState of the AGC implementation with the limits.\n> \n> Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> now present in the IPAContext so that it is commonly available for the\n> AGC algorithm, removing the 'todo' accordingly.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n>  src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n>  2 files changed, 5 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..33f902862c4a 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>  \tcontext.activeState.agc.meteringMode =\n>  \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n>  \n> -\t/*\n> -\t * \\todo This should probably come from FrameDurationLimits instead,\n> -\t * except it's computed in the IPA and not here so we'd have to\n> -\t * recompute it.\n> -\t */\n> -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> +\t/* Limit the frame duration to match current initialisation */\n> +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n\nconst\n\n> +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n\nThat's long, maybe\n\n\tcontext.activeState.agc.maxFrameDuration =\n\t\tstd::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n\nor\n\n\tint64_t maxFrameDuration = frameDurationLimits.max().get<int64_t>();\n\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(maxFrameDuration);\n>  \n>  \t/*\n>  \t * Define the measurement window for AGC as a centered rectangle\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 9e161cabdea4..47777ece783f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>  \t}\n>  \n> -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t      frameDurations[1],\n> -\t\t\t\t\t\t\t      frameDurations[2]);\n> +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n\nI wonder if all this should be moved to the AGC algorithm. There are\ncross-dependencies between the IPARkISP1 class and the AGC algorithm\nthat make the code fragile. Cleanups would be nice.\n\n>  \n>  \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n>  \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);","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 E230AC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 27 Oct 2024 18:54:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E69EB6539E;\n\tSun, 27 Oct 2024 19:54:08 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 53D0A65398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 27 Oct 2024 19:54:08 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CB6532C5;\n\tSun, 27 Oct 2024 19:54:06 +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=\"DD2OtHIc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1730055247;\n\tbh=HcYToINevPc4ZW6uHpokx6UMzUgO4vniYi/0AEIhSJs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DD2OtHIcmWxa+6Sd54SBvH6eEWVX932+mImUtEcqkQRrvGux2Huti8xJbOa/zmLMN\n\tIx2756gRY4xZCJXQS36VjklhqIY4K11LgfSyPnNNTgBlTuFIAocCXg873G7Qhqwe/S\n\tHDuaEDPCgVEIPgThCLyoURXV/eJ8Ojf2Mk6MrNvA=","Date":"Sun, 27 Oct 2024 20:54:02 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","Message-ID":"<20241027185402.GC24052@pendragon.ideasonboard.com>","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","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>"}},{"id":32229,"web_url":"https://patchwork.libcamera.org/comment/32229/","msgid":"<ZztHj5thHZQG0XhG@pyrite.rasen.tech>","date":"2024-11-18T13:56:31","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Mon, Oct 14, 2024 at 04:47:45PM +0100, Kieran Bingham wrote:\n> The IPA calculates and reports the FrameDurationLimits to applications\n> by configuring the ControlInfo accordingly during\n> IPARkISP1::updateControls()\n> \n> We later need to know these limits during Agc::configure() for\n> initialising the ActiveState of the AGC implementation with the limits.\n> \n> Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> now present in the IPAContext so that it is commonly available for the\n> AGC algorithm, removing the 'todo' accordingly.\n\n\\o/\n\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n>  src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n>  2 files changed, 5 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..33f902862c4a 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>  \tcontext.activeState.agc.meteringMode =\n>  \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n>  \n> -\t/*\n> -\t * \\todo This should probably come from FrameDurationLimits instead,\n> -\t * except it's computed in the IPA and not here so we'd have to\n> -\t * recompute it.\n> -\t */\n> -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> +\t/* Limit the frame duration to match current initialisation */\n> +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n> +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n>  \n>  \t/*\n>  \t * Define the measurement window for AGC as a centered rectangle\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 9e161cabdea4..47777ece783f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>  \t}\n>  \n> -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t      frameDurations[1],\n> -\t\t\t\t\t\t\t      frameDurations[2]);\n> +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n>  \n>  \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n>  \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n> -- \n> 2.34.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 EAD68C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 13:56:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9C6EE658DC;\n\tMon, 18 Nov 2024 14:56:40 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 636F360532\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 14:56:39 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:fb8e:b30c:9a4a:eed0])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ADFC5316;\n\tMon, 18 Nov 2024 14:56:21 +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=\"hRJttH7K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731938182;\n\tbh=eJ5HceINbc5tcbBmBGHTCPNCRF7tHRmQ2JrrlNylGeA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hRJttH7KRMw9VwVzB3Q9xk/a39aPBUmSt/IVvYA4l59yMFggFhDJ/gOaT/m78FOGL\n\ty8ohbE8+2lCmwbsMrZCTQY/Y3LJlIVogLcg0v4S/dT/hLrQ/K4me1jRp8iGOWSBeZ+\n\tB5b2uCxRDLZJ4S7teJTN4+gR2NfgyrhTpuhW42cA=","Date":"Mon, 18 Nov 2024 22:56:31 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","Message-ID":"<ZztHj5thHZQG0XhG@pyrite.rasen.tech>","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>","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>"}},{"id":32341,"web_url":"https://patchwork.libcamera.org/comment/32341/","msgid":"<Z0B3lN5-qDOOuaz1@pyrite.rasen.tech>","date":"2024-11-22T12:22:44","subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Sun, Oct 27, 2024 at 08:54:02PM +0200, Laurent Pinchart wrote:\n> On Mon, Oct 14, 2024 at 04:47:45PM +0100, Kieran Bingham wrote:\n> > The IPA calculates and reports the FrameDurationLimits to applications\n> > by configuring the ControlInfo accordingly during\n> > IPARkISP1::updateControls()\n> > \n> > We later need to know these limits during Agc::configure() for\n> > initialising the ActiveState of the AGC implementation with the limits.\n> > \n> > Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is\n> > now present in the IPAContext so that it is commonly available for the\n> > AGC algorithm, removing the 'todo' accordingly.\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------\n> >  src/ipa/rkisp1/rkisp1.cpp         | 5 ++---\n> >  2 files changed, 5 insertions(+), 9 deletions(-)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > index 17d074d9c03e..33f902862c4a 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> >  \tcontext.activeState.agc.meteringMode =\n> >  \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n> >  \n> > -\t/*\n> > -\t * \\todo This should probably come from FrameDurationLimits instead,\n> > -\t * except it's computed in the IPA and not here so we'd have to\n> > -\t * recompute it.\n> > -\t */\n> > -\tcontext.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed;\n> > +\t/* Limit the frame duration to match current initialisation */\n> > +\tControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits];\n> \n> const\n> \n> > +\tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n> \n> That's long, maybe\n> \n> \tcontext.activeState.agc.maxFrameDuration =\n> \t\tstd::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n> \n> or\n> \n> \tint64_t maxFrameDuration = frameDurationLimits.max().get<int64_t>();\n> \tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(maxFrameDuration);\n> >  \n> >  \t/*\n> >  \t * Define the measurement window for AGC as a centered rectangle\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index 9e161cabdea4..47777ece783f 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n> >  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n> >  \t}\n> >  \n> > -\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n> > -\t\t\t\t\t\t\t      frameDurations[1],\n> > -\t\t\t\t\t\t\t      frameDurations[2]);\n> > +\tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n> > +\t\tControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);\n> \n> I wonder if all this should be moved to the AGC algorithm. There are\n> cross-dependencies between the IPARkISP1 class and the AGC algorithm\n> that make the code fragile. Cleanups would be nice.\n\nProbably. It'll need some change in the rkisp1 algorithm interface\nbecause we'd have to pass sensor controls to the algorithms at both init\nand configure time. I'll add a todo at least.\n\n\nPaul\n\n> \n> >  \n> >  \tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n> >  \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);","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 62A46C32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Nov 2024 12:22:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7921B65FDD;\n\tFri, 22 Nov 2024 13:22:54 +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 7C4D265F51\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Nov 2024 13:22:52 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:2219:1ea7:e36d:ca95])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ABD3C514;\n\tFri, 22 Nov 2024 13:22:31 +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=\"eX89N/QN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732278152;\n\tbh=T5nzpb4ivYKFY+9DX1Q0LT3wVTr1+OC5jcXKdXlvQ3I=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=eX89N/QN6ZrQa05ujG9FJ1ymPmX/xjgybPL1mzVAY+fFNz4Ss4uyRCtFxKXpGorNd\n\tNE7nHGrO43PPmfKcu9LjnEJRT4L0VBpf+o7ajckp1OZLHhpDgFlA85h4JyucW4c8fR\n\t0lo1z6UI7lCeXoJ13q0eFdAHRlmiQ0JsqjcV2wI8=","Date":"Fri, 22 Nov 2024 21:22:44 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits\n\tcontrols","Message-ID":"<Z0B3lN5-qDOOuaz1@pyrite.rasen.tech>","References":"<20241014154747.2295253-1-kieran.bingham@ideasonboard.com>\n\t<20241014154747.2295253-2-kieran.bingham@ideasonboard.com>\n\t<20241027185402.GC24052@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20241027185402.GC24052@pendragon.ideasonboard.com>","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>"}}]