{"id":14778,"url":"https://patchwork.libcamera.org/api/1.1/patches/14778/?format=json","web_url":"https://patchwork.libcamera.org/patch/14778/","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":"<20211125102143.52556-5-jeanmichel.hautbois@ideasonboard.com>","date":"2021-11-25T10:21:43","name":"[libcamera-devel,4/4] ipa: ipu3: agc: Introduce lineDuration in IPASessionConfiguration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"30393067b81b5e7e99351a114daa21675a134f44","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/1.1/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14778/mbox/","series":[{"id":2754,"url":"https://patchwork.libcamera.org/api/1.1/series/2754/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2754","date":"2021-11-25T10:21:39","name":"ipa: ipu3: Misc clean up","version":1,"mbox":"https://patchwork.libcamera.org/series/2754/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14778/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14778/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 39709BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Nov 2021 10:21:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 26ED46039C;\n\tThu, 25 Nov 2021 11:21:56 +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 B59C860371\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Nov 2021 11:21:50 +0100 (CET)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:d9a5:5e40:3323:d95])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 79673A24;\n\tThu, 25 Nov 2021 11:21:50 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tgahZpf2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637835710;\n\tbh=i91M8ZVYHdDjblJkzN8tjO0Med4zbFKX9hwcVD9EPa0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tgahZpf2NmwQbbPe81TT7EqybmbvjOUq/Dipkl7HNX4zzp7d8ODUWDMb6//dxXlhW\n\t7UbIg2zUBeD553It/R/JJa67HTFFTk22A2O4aKOrfi1oHi0Ar9fHEfHpo0uf/v/OuT\n\tp6CtcjgfNbZopVQI4ExA4z5eqodD8beMG8xMGeCw=","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 25 Nov 2021 11:21:43 +0100","Message-Id":"<20211125102143.52556-5-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20211125102143.52556-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20211125102143.52556-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 4/4] ipa: ipu3: agc: Introduce\n\tlineDuration in IPASessionConfiguration","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":"Instead of having a local cached value for line duration, store it in\nthe IPASessionConfiguration::agc structure.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 20 +++++++++++---------\n src/ipa/ipu3/algorithms/agc.h   |  2 --\n src/ipa/ipu3/ipa_context.cpp    |  3 +++\n src/ipa/ipu3/ipa_context.h      |  1 +\n 4 files changed, 15 insertions(+), 11 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex b822c79b..c463e688 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -70,7 +70,7 @@ static constexpr uint32_t kNumStartupFrames = 10;\n static constexpr double kRelativeLuminanceTarget = 0.16;\n \n Agc::Agc()\n-\t: frameCount_(0), lineDuration_(0s), filteredExposure_(0s)\n+\t: frameCount_(0), filteredExposure_(0s)\n {\n }\n \n@@ -83,16 +83,18 @@ Agc::Agc()\n  */\n int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n {\n-\tstride_ = context.configuration.grid.stride;\n+\tIPASessionConfiguration &configuration = context.configuration;\n+\tIPAFrameContext &frameContext = context.frameContext;\n+\n+\tstride_ = configuration.grid.stride;\n \n \t/* \\todo use the IPAContext to provide the limits */\n-\tlineDuration_ = configInfo.sensorInfo.lineLength * 1.0s\n-\t\t      / configInfo.sensorInfo.pixelRate;\n+\tconfiguration.agc.lineDuration = configInfo.sensorInfo.lineLength * 1.0s\n+\t\t\t\t       / configInfo.sensorInfo.pixelRate;\n \n \t/* Configure the default exposure and gain. */\n-\tcontext.frameContext.agc.gain =\n-\t\tstd::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);\n-\tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n+\tframeContext.agc.gain = std::max(configuration.agc.minAnalogueGain, kMinAnalogueGain);\n+\tframeContext.agc.exposure = 10ms / configuration.agc.lineDuration;\n \n \treturn 0;\n }\n@@ -200,7 +202,7 @@ void Agc::computeExposure(IPAContext &context, double yGain, double iqMeanGain)\n \t/* extracted from Rpi::Agc::computeTargetExposure */\n \n \t/* Calculate the shutter time in seconds */\n-\tutils::Duration currentShutter = exposure * lineDuration_;\n+\tutils::Duration currentShutter = exposure * configuration.agc.lineDuration;\n \n \t/*\n \t * Update the exposure value for the next computation using the values\n@@ -245,7 +247,7 @@ void Agc::computeExposure(IPAContext &context, double yGain, double iqMeanGain)\n \t\t\t    << stepGain;\n \n \t/* Update the estimated exposure and gain. */\n-\tframeContext.agc.exposure = shutterTime / lineDuration_;\n+\tframeContext.agc.exposure = shutterTime / configuration.agc.lineDuration;\n \tframeContext.agc.gain = stepGain;\n }\n \ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex d9f17e6f..ed997e67 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -42,8 +42,6 @@ private:\n \n \tuint64_t frameCount_;\n \n-\tutils::Duration lineDuration_;\n-\n \tutils::Duration filteredExposure_;\n \n \tuint32_t stride_;\ndiff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex 86794ac1..ace9c66f 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -84,6 +84,9 @@ namespace libcamera::ipa::ipu3 {\n  *\n  * \\var IPASessionConfiguration::agc.maxAnalogueGain\n  * \\brief Maximum analogue gain supported with the configured sensor\n+ *\n+ * \\var IPASessionConfiguration::agc.lineDuration\n+ * \\brief Line duration in microseconds\n  */\n \n /**\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex c6dc0814..7696fd14 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -30,6 +30,7 @@ struct IPASessionConfiguration {\n \t\tutils::Duration maxShutterSpeed;\n \t\tdouble minAnalogueGain;\n \t\tdouble maxAnalogueGain;\n+\t\tutils::Duration lineDuration;\n \t} agc;\n };\n \n","prefixes":["libcamera-devel","4/4"]}