From patchwork Fri Jun 26 13:05:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 27071 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 3E2D0C330F for ; Fri, 26 Jun 2026 13:06:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD37765EEF; Fri, 26 Jun 2026 15:06:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cEgXHgkd"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DACDC65EF9 for ; Fri, 26 Jun 2026 15:06:07 +0200 (CEST) Received: from [127.0.1.1] (chfd-03-b2-v4wan-176392-cust229.vm15.cable.virginm.net [82.19.20.230]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 035D31D00; Fri, 26 Jun 2026 15:05:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782479127; bh=A9hGuIqdIKWPEToYxKgGT5lgPd0mj/cV61qp5al+MzI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cEgXHgkdz8YFkciGH9i3Yd1YoyjB4DIjA+YrDeCHrreSLBPQkV6mSUkVcCx1Nq/qs ukaxMEmcbCmtUMEWNBm49bNVdMtzSmms2AayAF1PIiEDDZ7Nx7e3w6r8tN1gez0Hdu 0I6FQ7jSgHud8vElBEQtPwTWbxD/jlJwvR6NVJ80= From: Daniel Scally Date: Fri, 26 Jun 2026 14:05:58 +0100 Subject: [PATCH v2 11/12] ipa: ipu3: Add IPACameraSensorInfo to IPAContext MIME-Version: 1.0 Message-Id: <20260626-ipu3-libipa-rework-v2-11-41546e23de3e@ideasonboard.com> References: <20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com> In-Reply-To: <20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4825; i=dan.scally@ideasonboard.com; h=from:subject:message-id; bh=A9hGuIqdIKWPEToYxKgGT5lgPd0mj/cV61qp5al+MzI=; b=owEBbQKS/ZANAwAKAchJV3psRXUyAcsmYgBqPnk7TS6rYD7kinKU0ZIJqrVX5t2HwQ0AYiP2X bAn3bc0AQKJAjMEAAEKAB0WIQQqyuwyDnZdb+mxmm/ISVd6bEV1MgUCaj55OwAKCRDISVd6bEV1 MnoeD/9jA8tzoMHWOdGpgOQJ+ZQOS4pBOAmlG5co0l6duQnJBusJkYAqw7Nh8g7naTnQUYSIRW8 81KkQAackTZsx1oF9a6yu1xxmIct7QSBMW+VCCTg/5ZUd+xJF1A5vWlbMSZCt5zBbFUZKR0VVAq HsXtn4ma9eoBF6AFvk78cfZ6fNbJ1Zku765CccyC2wPzwmRKwi4KGpw2SZziELTiISHW6dEWsZ+ +bcZen3b1pMjVNhNauZ5y5mROPeJauTgzk/D+4EpueHsABkRsxxayYfSTiJKg0RGCjfb1f3Q4nG POsUJv23wZrWk8FxQ/8NQrCxvHw6YKRg4w3AoiGIWmH6fjW/dGgfxmWYtXiAxiz2X8B+9RjVIO/ xkI5U9avJ/OmaoWtwRgMQE7qLCZPNqfW5ZfA0GRzLxNf1BleM89VAkZXZFkwd8rzMO4CNgzML/I jq7sTV8zdoK+rsuQCrssuJIfWwl1FOObBN9L9+YiBADwi3yNULseAYX3Gj0+X5HeHZDqjk/MXaI I6GT924OlLZMT01AWonmy6vhNLDmbHoPfbodg0eBnvkjAZBQqx+o3rGqYOKqLzlp7WnernJlU28 uLAyKmyTLKD6nOGjbaIXhd099O1Bh7I4qPeFanyNBPydd1kqhbKDRgOoLXJrxg7JbfaULeyAyds clObiOt0mW0559g== X-Developer-Key: i=dan.scally@ideasonboard.com; a=openpgp; fpr=EEC699ACA1B7CB5D31330C0BBD501C2A3546CCF6 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" Add an instance of IPACameraSensorInfo to the IPAContext and fill it during IPAIPU3::init(). This will allow us to pass sensor information to algorithms at init time. This means that IPAIPU3::sensorInfo_ is no longer needed, as the instance stored in the context is accessible everywhere that that was previously used. Drop it. Signed-off-by: Daniel Scally --- Changes in v2: - Dropped the sensorInfo_ class member, since this replaces it --- src/ipa/ipu3/ipa_context.cpp | 3 +++ src/ipa/ipu3/ipa_context.h | 3 +++ src/ipa/ipu3/ipu3.cpp | 20 +++++++++----------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp index d3bcd7a81fe010d17d1437bf7f6cedce83a9be5c..9537802ceca5018118bdf4c71ef361c20fc44bfb 100644 --- a/src/ipa/ipu3/ipa_context.cpp +++ b/src/ipa/ipu3/ipa_context.cpp @@ -54,6 +54,9 @@ namespace libcamera::ipa::ipu3 { * * \var IPAContext::ctrlMap * \brief A ControlInfoMap::Map of controls populated by the algorithms + * + * \var IPAContext::sensorInfo + * \brief An IPACameraSensorInfo instance holding information about the sensor */ /** diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index ce496ed477f4cbe2653aedada3381258396d92c8..d650f2fe1ad8eab91b7128a47c9690e42b1595f1 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -15,6 +15,8 @@ #include #include +#include + #include #include #include @@ -91,6 +93,7 @@ struct IPAContext { FCQueue frameContexts; ControlInfoMap::Map ctrlMap; + IPACameraSensorInfo sensorInfo; }; } /* namespace ipa::ipu3 */ diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index b1c176e68098b24d8fd37e7a0e278cabf0e1c3b2..c2d3e62d12f4aba9e3d008025c8922a71d45d36f 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -177,8 +177,6 @@ private: ControlInfoMap sensorCtrls_; ControlInfoMap lensCtrls_; - IPACameraSensorInfo sensorInfo_; - /* Interface to the Camera Helper */ std::unique_ptr camHelper_; @@ -265,19 +263,19 @@ void IPAIPU3::updateControls(const ControlInfoMap &sensorControls, */ const ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second; uint32_t hblank = v4l2HBlank.def().get(); - uint32_t lineLength = sensorInfo_.outputSize.width + hblank; + uint32_t lineLength = context_.sensorInfo.outputSize.width + hblank; const ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second; std::array frameHeights{ - v4l2VBlank.min().get() + sensorInfo_.outputSize.height, - v4l2VBlank.max().get() + sensorInfo_.outputSize.height, - v4l2VBlank.def().get() + sensorInfo_.outputSize.height, + v4l2VBlank.min().get() + context_.sensorInfo.outputSize.height, + v4l2VBlank.max().get() + context_.sensorInfo.outputSize.height, + v4l2VBlank.def().get() + context_.sensorInfo.outputSize.height, }; std::array frameDurations; for (unsigned int i = 0; i < frameHeights.size(); ++i) { uint64_t frameSize = lineLength * frameHeights[i]; - frameDurations[i] = frameSize / (sensorInfo_.pixelRate / 1000000U); + frameDurations[i] = frameSize / (context_.sensorInfo.pixelRate / 1000000U); } controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], frameDurations[1], @@ -311,7 +309,7 @@ int IPAIPU3::init(const IPASettings &settings, context_.configuration = {}; context_.configuration.sensor.lineDuration = sensorInfo.minLineLength * 1.0s / sensorInfo.pixelRate; - sensorInfo_ = sensorInfo; + context_.sensorInfo = sensorInfo; /* Load the tuning data file. */ File file(settings.configurationFile); @@ -464,7 +462,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, return -ENODATA; } - sensorInfo_ = configInfo.sensorInfo; + context_.sensorInfo = configInfo.sensorInfo; lensCtrls_ = configInfo.lensControls; @@ -475,8 +473,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, /* Initialise the sensor configuration. */ context_.configuration.sensor.lineDuration = - sensorInfo_.minLineLength * 1.0s / sensorInfo_.pixelRate; - context_.configuration.sensor.size = sensorInfo_.outputSize; + context_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate; + context_.configuration.sensor.size = context_.sensorInfo.outputSize; /* * Compute the sensor V4L2 controls to be used by the algorithms and