Patch Detail
Show a patch.
GET /api/1.1/patches/20502/?format=api
{ "id": 20502, "url": "https://patchwork.libcamera.org/api/1.1/patches/20502/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20502/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240703104004.184783-3-stefan.klug@ideasonboard.com>", "date": "2024-07-03T10:39:49", "name": "[v2,2/6] ipa: rkisp1: Move camHelper into IPAContext", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e24ffd6e049f07f523ebc033aefabfcac592ef6c", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20502/mbox/", "series": [ { "id": 4435, "url": "https://patchwork.libcamera.org/api/1.1/series/4435/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4435", "date": "2024-07-03T10:39:47", "name": "ipa: Add black level to camera sensor helpers", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4435/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20502/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20502/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 7A3CBBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 3 Jul 2024 10:40:20 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0FCBA632EA;\n\tWed, 3 Jul 2024 12:40:20 +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 27F8562C99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Jul 2024 12:40:18 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:9263:c199:9587:576])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F0A383E6;\n\tWed, 3 Jul 2024 12:39:49 +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=\"uRIMMdae\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720003190;\n\tbh=q/YSilUgnwsOWh4ve41Ybz0Qx+TGqQGZFZiMqo3YbF0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uRIMMdae5YeboN9RXl897cAU3RIazrULDV2KkeYXJdsPLH8WSKIKgfGQWVAyCQgc+\n\tgc/yJ4+WGN/ihMUEs9MaAWP1DvUiYlnkR4alQHlzpwCJsrvkJlfU+YEIXh5vDUq7M2\n\tdR8+4WtUyg54vTW0QyoWdjlrXb6wDje2XOJ1M5Ag=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>", "Subject": "[PATCH v2 2/6] ipa: rkisp1: Move camHelper into IPAContext", "Date": "Wed, 3 Jul 2024 12:39:49 +0200", "Message-ID": "<20240703104004.184783-3-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240703104004.184783-1-stefan.klug@ideasonboard.com>", "References": "<20240703104004.184783-1-stefan.klug@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": "To be able to query the black levels, the black level correction\nalgorithm needs access to the camera sensor helper. Allow this by moving\nthe camHelper_ member from IPARkISP1 into IPAContext.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/ipa_context.h | 6 ++++++\n src/ipa/rkisp1/rkisp1.cpp | 26 ++++++++++++--------------\n 2 files changed, 18 insertions(+), 14 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 8602b408870e..1d0e9030af1c 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -8,6 +8,8 @@\n \n #pragma once\n \n+#include <memory>\n+\n #include <linux/rkisp1-config.h>\n \n #include <libcamera/base/utils.h>\n@@ -16,6 +18,7 @@\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n \n+#include <libipa/camera_sensor_helper.h>\n #include <libipa/fc_queue.h>\n #include <libipa/matrix.h>\n \n@@ -178,6 +181,9 @@ struct IPAContext {\n \tFCQueue<IPAFrameContext> frameContexts;\n \n \tControlInfoMap::Map ctrlMap;\n+\n+\t/* Interface to the Camera Helper */\n+\tstd::unique_ptr<CameraSensorHelper> camHelper;\n };\n \n } /* namespace ipa::rkisp1 */\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex d31cdbab020b..23e0826cc335 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -29,7 +29,6 @@\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"algorithms/algorithm.h\"\n-#include \"libipa/camera_sensor_helper.h\"\n \n #include \"ipa_context.h\"\n \n@@ -81,9 +80,6 @@ private:\n \n \tControlInfoMap sensorControls_;\n \n-\t/* Interface to the Camera Helper */\n-\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n-\n \t/* Local parameter storage */\n \tstruct IPAContext context_;\n };\n@@ -115,7 +111,7 @@ const ControlInfoMap::Map rkisp1Controls{\n } /* namespace */\n \n IPARkISP1::IPARkISP1()\n-\t: context_({ {}, {}, {}, { kMaxFrameContexts }, {} })\n+\t: context_({ {}, {}, {}, { kMaxFrameContexts }, {}, {} })\n {\n }\n \n@@ -147,8 +143,8 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \n \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n \n-\tcamHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);\n-\tif (!camHelper_) {\n+\tcontext_.camHelper = CameraSensorHelperFactoryBase::create(settings.sensorModel);\n+\tif (!context_.camHelper) {\n \t\tLOG(IPARkISP1, Error)\n \t\t\t<< \"Failed to create camera sensor helper for \"\n \t\t\t<< settings.sensorModel;\n@@ -250,8 +246,10 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\tminExposure * context_.configuration.sensor.lineDuration;\n \tcontext_.configuration.sensor.maxShutterSpeed =\n \t\tmaxExposure * context_.configuration.sensor.lineDuration;\n-\tcontext_.configuration.sensor.minAnalogueGain = camHelper_->gain(minGain);\n-\tcontext_.configuration.sensor.maxAnalogueGain = camHelper_->gain(maxGain);\n+\tcontext_.configuration.sensor.minAnalogueGain =\n+\t\tcontext_.camHelper->gain(minGain);\n+\tcontext_.configuration.sensor.maxAnalogueGain =\n+\t\tcontext_.camHelper->gain(maxGain);\n \n \tcontext_.configuration.raw = std::any_of(streamConfig.begin(), streamConfig.end(),\n \t\t[](auto &cfg) -> bool {\n@@ -352,7 +350,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \tframeContext.sensor.exposure =\n \t\tsensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n \tframeContext.sensor.gain =\n-\t\tcamHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n+\t\tcontext_.camHelper->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n \n \tControlList metadata(controls::controls);\n \n@@ -389,9 +387,9 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n \n \t/* Compute the analogue gain limits. */\n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n-\tfloat minGain = camHelper_->gain(v4l2Gain.min().get<int32_t>());\n-\tfloat maxGain = camHelper_->gain(v4l2Gain.max().get<int32_t>());\n-\tfloat defGain = camHelper_->gain(v4l2Gain.def().get<int32_t>());\n+\tfloat minGain = context_.camHelper->gain(v4l2Gain.min().get<int32_t>());\n+\tfloat maxGain = context_.camHelper->gain(v4l2Gain.max().get<int32_t>());\n+\tfloat defGain = context_.camHelper->gain(v4l2Gain.def().get<int32_t>());\n \tctrlMap.emplace(std::piecewise_construct,\n \t\t\tstd::forward_as_tuple(&controls::AnalogueGain),\n \t\t\tstd::forward_as_tuple(minGain, maxGain, defGain));\n@@ -436,7 +434,7 @@ void IPARkISP1::setControls(unsigned int frame)\n \n \tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n \tuint32_t exposure = frameContext.agc.exposure;\n-\tuint32_t gain = camHelper_->gainCode(frameContext.agc.gain);\n+\tuint32_t gain = context_.camHelper->gainCode(frameContext.agc.gain);\n \n \tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n", "prefixes": [ "v2", "2/6" ] }