From patchwork Fri Nov 14 14:17:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 25061 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D08D6C3331 for ; Fri, 14 Nov 2025 14:17:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B7CBE60AAD; Fri, 14 Nov 2025 15:17:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Fi58AOCY"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AFD060A9E for ; Fri, 14 Nov 2025 15:17:21 +0100 (CET) Received: from [192.168.1.101] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3507F19B5; Fri, 14 Nov 2025 15:15:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763129720; bh=J27XAYPsp2fkW+AjzsTSjz1qjYXrb/+aWHefj5WsL7E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Fi58AOCY5OWmxMhtkuNmGCnOk29OZPctT27cTTwUgOT6dilkKhTJR6b5wAKMn5QFG uhkZbIu0MO0MRiJdR3cyLTqViWEgziTFPMG8keh/4KW296eb931Lehp33CBUJ6XsZk fL+CyQPAFgqtlWois92KYYBuzBfVrnupmjj3k0Ts= From: Jacopo Mondi Date: Fri, 14 Nov 2025 15:17:04 +0100 Subject: [PATCH v3 09/19] ipa: libipa: agc: Store sensor configuration parameters MIME-Version: 1.0 Message-Id: <20251114-exposure-limits-v3-9-b7c07feba026@ideasonboard.com> References: <20251114-exposure-limits-v3-0-b7c07feba026@ideasonboard.com> In-Reply-To: <20251114-exposure-limits-v3-0-b7c07feba026@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Robert Mader , libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5101; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=J27XAYPsp2fkW+AjzsTSjz1qjYXrb/+aWHefj5WsL7E=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBpFznrKvGWzVN4EF74fbgRb7bXF5ZhnJqP17Ky+ QOPDWFQeZSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaRc56wAKCRByNAaPFqFW PILWD/9ReQ/O/l52x+tFi9mNA3xwvKBe53UXmJXjJ/tBPlrOOH/ch+Nsxuyqn+5+VOi//YSrVl4 TGTI11aZpQraTOM3STFibT9Q+73K/Z0UvNET2I/srjxR/WDkjRoEZbcklzz7jZoycaRFGVBQ2zB d4ec+aDpCL288lZ4Pn5uZ/vNVcIirlbEPKEPs01XacFPWbjj2zeKa9zlYP3S6AnFmMD5oBQyLVx l8WWEpygxx+LYXeidKkqvxxvGUMJoZ/GRcqq6AzeCpKEjfiTkabEqLRPmUHco0CEtXD3mw+I/ig w0DJeI29YtyoKGXJheNrej71J9Tqi12M/F85KuSAk9XeqbZ+JTjLaxubcOJu0c4xLBdr55wBhVG EkkGRwbVzhZHc1d2WVch2kR6XUddy5KxO2S5FkpDOR1/OEqDv/dkRL83h8E8Y4Hx5/kNhrVe/W2 LP1HxFp5tUgjAB7cBMmTqoM4hz9tmt27vB1BfgBIqWVyb22/LuceuolNk4zSVgilJ+H71NhctnI DzGEOv3hSEGPNztgQgxWDLVZqddat5hsPVF5mwYOjXmV2v6tnaTZDRQ4Elvmj7CGjbIIrOrwBdI rbWT1E/8TOLmjouV5KeDdoGgoq01KS5zMsFJiAQKVxD3wEibiO1p98LvQklyN5CrhiwskZUVthp n5zewnYCFUC2KDA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To prepare for changing the configure() and setLimits() functions of the ExposureModeHelper class, introduce the sensor configuration parameters that will remain valid for a streaming session, and separate them from the run-time configuration parameters used by the exposure helper to split shutter time and gains. Only introduce the type in this patch but do not make use of it yet. This change also prepares to centralize the sensor configuration paramters in the CameraHelper. Signed-off-by: Jacopo Mondi --- src/ipa/libipa/exposure_mode_helper.cpp | 43 ++++++++++++++++++++++++++++----- src/ipa/libipa/exposure_mode_helper.h | 18 ++++++++++++-- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp index 962ce1b1b7503e0f86f3857b484b249cb6383fde..c3ed1601939bd28435bbbc540d9b8c9d92b81912 100644 --- a/src/ipa/libipa/exposure_mode_helper.cpp +++ b/src/ipa/libipa/exposure_mode_helper.cpp @@ -21,8 +21,6 @@ namespace libcamera { -using namespace std::literals::chrono_literals; - LOG_DEFINE_CATEGORY(ExposureModeHelper) namespace ipa { @@ -59,6 +57,40 @@ namespace ipa { * used. */ +/** + * \struct ExposureModeHelper::SensorConfiguration + * \brief The sensor configuration parameters + * + * This struct represents the sensor configuration paramters. Sensor + * configuration parameters are set at configure() time and remain valid for + * the duration of the streaming session. + * + * \todo Remove it once all the information are available from the + * CameraSensorHelper. + * + * \var SensorConfiguration::lineDuration_ + * \brief The sensor line duration + * + * \var SensorConfiguration::minExposureTime_ + * \brief The sensor min exposure time in microseconds + * + * \var SensorConfiguration::maxExposureTime_ + * \brief The sensor max exposure time in microseconds + * \todo Remove the max exposure time and calculcate it from the frame duration + * + * \var SensorConfiguration::minFrameDuration_ + * \brief The sensor min frame duration in microseconds + * + * \var SensorConfiguration::maxFrameDuration_ + * \brief The sensor max frame duration in microseconds + * + * \var SensorConfiguration::minGain_ + * \brief The sensor minimum analogue gain value + * + * \var SensorConfiguration::maxGain_ + * \brief The sensor maximum analogue gain value + */ + /** * \brief Construct an ExposureModeHelper instance * \param[in] stages The vector of paired exposure time and gain limits @@ -70,8 +102,6 @@ namespace ipa { * the runtime limits set through setLimits() instead. */ ExposureModeHelper::ExposureModeHelper(const Span> stages) - : lineDuration_(1us), minExposureTime_(0us), maxExposureTime_(0us), - minGain_(0), maxGain_(0), sensorHelper_(nullptr) { for (const auto &[s, g] : stages) { exposureTimes_.push_back(s); @@ -97,7 +127,7 @@ ExposureModeHelper::ExposureModeHelper(const Span(clamped / lineDuration_) * lineDuration_; + exp = static_cast(clamped / sensor_.lineDuration_) + * sensor_.lineDuration_; if (quantizationGain) *quantizationGain = clamped / exp; diff --git a/src/ipa/libipa/exposure_mode_helper.h b/src/ipa/libipa/exposure_mode_helper.h index f8b7a4aa4800b59459f8fc80f502b83647547f51..4971cfbf5b2be9ef0e3e95a64b815902833e93a4 100644 --- a/src/ipa/libipa/exposure_mode_helper.h +++ b/src/ipa/libipa/exposure_mode_helper.h @@ -20,9 +20,21 @@ namespace libcamera { namespace ipa { +using namespace std::literals::chrono_literals; + class ExposureModeHelper { public: + struct SensorConfiguration { + utils::Duration lineDuration_; + utils::Duration minExposureTime_; + utils::Duration maxExposureTime_; + utils::Duration minFrameDuration_; + utils::Duration maxFrameDuration_; + double minGain_; + double maxGain_; + }; + ExposureModeHelper(const Span> stages); ~ExposureModeHelper() = default; @@ -41,12 +53,14 @@ private: std::vector exposureTimes_; std::vector gains_; - utils::Duration lineDuration_; + SensorConfiguration sensor_; + const CameraSensorHelper *sensorHelper_ = nullptr; + + /* Runtime parameters, used to split exposure. */ utils::Duration minExposureTime_; utils::Duration maxExposureTime_; double minGain_; double maxGain_; - const CameraSensorHelper *sensorHelper_; }; } /* namespace ipa */