{"id":19905,"url":"https://patchwork.libcamera.org/api/1.1/patches/19905/?format=json","web_url":"https://patchwork.libcamera.org/patch/19905/","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":"<20240418124632.652163-2-dan.scally@ideasonboard.com>","date":"2024-04-18T12:46:30","name":"[1/3] ipa: ipu3: Refer to integration time instead of shutter speed","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"afa536851387484aca805e8d3e2b99c915d69140","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/1.1/people/156/?format=json","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19905/mbox/","series":[{"id":4262,"url":"https://patchwork.libcamera.org/api/1.1/series/4262/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4262","date":"2024-04-18T12:46:29","name":"Minor AGC fixes","version":1,"mbox":"https://patchwork.libcamera.org/series/4262/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19905/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19905/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 94854C328D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Apr 2024 12:46:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4D36E633F3;\n\tThu, 18 Apr 2024 14:46:45 +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 0EF586334D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2024 14:46:43 +0200 (CEST)","from mail.ideasonboard.com\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 4BA822BC;\n\tThu, 18 Apr 2024 14:45:55 +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=\"WuGOcTNZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1713444355;\n\tbh=80DQrLkvj+0my+RFvhP2MkH9Q9t1J3msZ2FZzz7B7Is=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WuGOcTNZlzqZFngDC67VJp3dS30F6Wm/VmlGP7YX+FYEbk1ioDkm/9r75d4IHQmzr\n\t7VcccO5dWPS8NO4gzTCT7g9IxyNZ94k+uu1wy6BaSJ3F3B91OvpfiVrxe/7wAFJtzy\n\tNTzIiTkTnLv9I502qgisKFBcKNdt2xqFRzZ29iwc=","From":"Daniel Scally <dan.scally@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Daniel Scally <dan.scally@ideasonboard.com>","Subject":"[PATCH 1/3] ipa: ipu3: Refer to integration time instead of shutter\n\tspeed","Date":"Thu, 18 Apr 2024 13:46:30 +0100","Message-Id":"<20240418124632.652163-2-dan.scally@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240418124632.652163-1-dan.scally@ideasonboard.com>","References":"<20240418124632.652163-1-dan.scally@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":"Within the IPU3 IPA module there are multiple references to min and\nmax shutter speeds. In calculation and usage however those variables\nreflect integration time rather than shutter speed - this difference\nin terminology is particularly problematic because the minimum\nshutter speed is equivalent to the maximum integration time.\n\nReplace references to shutter speed with integration time.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 12 ++++++------\n src/ipa/ipu3/algorithms/agc.h   |  4 ++--\n src/ipa/ipu3/ipa_context.cpp    |  8 ++++----\n src/ipa/ipu3/ipa_context.h      |  4 ++--\n src/ipa/ipu3/ipu3.cpp           |  8 ++++----\n 5 files changed, 18 insertions(+), 18 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 46fc3b33..a59b73fb 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -51,7 +51,7 @@ LOG_DEFINE_CATEGORY(IPU3Agc)\n static constexpr double kMinAnalogueGain = 1.0;\n \n /* \\todo Honour the FrameDurationLimits control instead of hardcoding a limit */\n-static constexpr utils::Duration kMaxShutterSpeed = 60ms;\n+static constexpr utils::Duration kMaxIntegrationTime = 60ms;\n \n /* Histogram constants */\n static constexpr uint32_t knumHistogramBins = 256;\n@@ -71,7 +71,7 @@ static constexpr uint32_t kNumStartupFrames = 10;\n static constexpr double kRelativeLuminanceTarget = 0.16;\n \n Agc::Agc()\n-\t: minShutterSpeed_(0s), maxShutterSpeed_(0s)\n+\t: minIntegrationTime_(0s), maxIntegrationTime_(0s)\n {\n }\n \n@@ -114,9 +114,9 @@ int Agc::configure(IPAContext &context,\n \tstride_ = configuration.grid.stride;\n \tbdsGrid_ = configuration.grid.bdsGrid;\n \n-\tminShutterSpeed_ = configuration.agc.minShutterSpeed;\n-\tmaxShutterSpeed_ = std::min(configuration.agc.maxShutterSpeed,\n-\t\t\t\t    kMaxShutterSpeed);\n+\tminIntegrationTime_ = configuration.agc.minIntegrationTime;\n+\tmaxIntegrationTime_ = std::min(configuration.agc.maxIntegrationTime,\n+\t\t\t\t       kMaxIntegrationTime);\n \n \tminAnalogueGain_ = std::max(configuration.agc.minAnalogueGain, kMinAnalogueGain);\n \tmaxAnalogueGain_ = configuration.agc.maxAnalogueGain;\n@@ -129,7 +129,7 @@ int Agc::configure(IPAContext &context,\n \tcontext.activeState.agc.exposureMode = exposureModeHelpers().begin()->first;\n \n \t/* \\todo Run this again when FrameDurationLimits is passed in */\n-\tconfigureExposureModeHelpers(minShutterSpeed_, maxShutterSpeed_,\n+\tconfigureExposureModeHelpers(minIntegrationTime_, maxIntegrationTime_,\n \t\t\t\t     minAnalogueGain_, maxAnalogueGain_);\n \n \tresetFrameCount();\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 945d1846..631dea52 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -42,8 +42,8 @@ private:\n \tHistogram parseStatistics(const ipu3_uapi_stats_3a *stats,\n \t\t\t\t  const ipu3_uapi_grid_config &grid);\n \n-\tutils::Duration minShutterSpeed_;\n-\tutils::Duration maxShutterSpeed_;\n+\tutils::Duration minIntegrationTime_;\n+\tutils::Duration maxIntegrationTime_;\n \n \tdouble minAnalogueGain_;\n \tdouble maxAnalogueGain_;\ndiff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex c4fb5642..72f7cec9 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -92,11 +92,11 @@ namespace libcamera::ipa::ipu3 {\n  * \\var IPASessionConfiguration::agc\n  * \\brief AGC parameters configuration of the IPA\n  *\n- * \\var IPASessionConfiguration::agc.minShutterSpeed\n- * \\brief Minimum shutter speed supported with the configured sensor\n+ * \\var IPASessionConfiguration::agc.minIntegrationTime\n+ * \\brief Minimum integration time supported with the configured sensor\n  *\n- * \\var IPASessionConfiguration::agc.maxShutterSpeed\n- * \\brief Maximum shutter speed supported with the configured sensor\n+ * \\var IPASessionConfiguration::agc.maxIntegrationTime\n+ * \\brief Maximum integration time supported with the configured sensor\n  *\n  * \\var IPASessionConfiguration::agc.minAnalogueGain\n  * \\brief Minimum analogue gain supported with the configured sensor\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex a92cb6ce..6b1ffdd1 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -33,8 +33,8 @@ struct IPASessionConfiguration {\n \t} af;\n \n \tstruct {\n-\t\tutils::Duration minShutterSpeed;\n-\t\tutils::Duration maxShutterSpeed;\n+\t\tutils::Duration minIntegrationTime;\n+\t\tutils::Duration maxIntegrationTime;\n \t\tdouble minAnalogueGain;\n \t\tdouble maxAnalogueGain;\n \t} agc;\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 4809eb60..f13cc394 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -217,13 +217,13 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n \n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\n-\t * to know the limits for shutter speed and analogue gain.\n+\t * to know the limits for integration time and analogue gain.\n \t * As it depends on the sensor, update it with the controls.\n \t *\n-\t * \\todo take VBLANK into account for maximum shutter speed\n+\t * \\todo take VBLANK into account for maximum integration time\n \t */\n-\tcontext_.configuration.agc.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;\n-\tcontext_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n+\tcontext_.configuration.agc.minIntegrationTime = minExposure * context_.configuration.sensor.lineDuration;\n+\tcontext_.configuration.agc.maxIntegrationTime = maxExposure * context_.configuration.sensor.lineDuration;\n \tcontext_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n \tcontext_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n }\n","prefixes":["1/3"]}