Patch Detail
Show a patch.
GET /api/1.1/patches/20511/?format=api
{ "id": 20511, "url": "https://patchwork.libcamera.org/api/1.1/patches/20511/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20511/", "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": "<20240703135000.242227-5-stefan.klug@ideasonboard.com>", "date": "2024-07-03T13:49:52", "name": "[v3,4/6] ipa: rkisp1: blc: Report sensor black levels in metadata", "commit_ref": "afa8cbca9eef3028136ca742ccd510a29570e97b", "pull_url": null, "state": "accepted", "archived": false, "hash": "fe1576bc6a8980d230b60987d34cc8af4fbc1649", "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/20511/mbox/", "series": [ { "id": 4436, "url": "https://patchwork.libcamera.org/api/1.1/series/4436/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4436", "date": "2024-07-03T13:49:48", "name": "ipa: Add black level to camera sensor helpers", "version": 3, "mbox": "https://patchwork.libcamera.org/series/4436/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20511/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20511/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 1484EBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 3 Jul 2024 13:50:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A24FB6333F;\n\tWed, 3 Jul 2024 15:50:20 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C08E062E27\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Jul 2024 15:50:17 +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 A0CC63D6;\n\tWed, 3 Jul 2024 15:49: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=\"b4Z7+6A5\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720014589;\n\tbh=ofJCdRARy3bVq6ylNyfVEotk9tOJ0bSugQ9wzbHXLJk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=b4Z7+6A5InGQDuS4ogX/KeDwH7CEPBZUiLxwgSZUWu+FVq9H1x+c5+3SstkIEcrOA\n\tXnPpewANuhFX8YGnHXSeayxLfGd22nFEbx1r0CkvNij9WTu5n1yPlgQuPhyCjbIltg\n\turI4/kIDYEC5Nq7aSw9Dh6rby/z6P8HyRdNvTraU=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>", "Subject": "[PATCH v3 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata", "Date": "Wed, 3 Jul 2024 15:49:52 +0200", "Message-ID": "<20240703135000.242227-5-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240703135000.242227-1-stefan.klug@ideasonboard.com>", "References": "<20240703135000.242227-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": "Add sensor black levels to the metadata of the rkisp1 pipeline.\n\nAdditionally enable raw support for this algorithm and add it to\nuncalibrated.yaml, so that black levels get reported when capturing\ntuning images. This is a bit of a hack, because no actual black level\ncorrection is taking place in raw mode, but it is the easiest way to get\nblacklevel reported for raw streams.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp | 28 +++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/blc.h | 5 ++++-\n src/ipa/rkisp1/data/uncalibrated.yaml | 1 +\n 3 files changed, 33 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex b17b549c55df..03ec57f24be0 100644\n--- a/src/ipa/rkisp1/algorithms/blc.cpp\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -9,6 +9,8 @@\n \n #include <libcamera/base/log.h>\n \n+#include <libcamera/control_ids.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n /**\n@@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n BlackLevelCorrection::BlackLevelCorrection()\n \t: tuningParameters_(false)\n {\n+\t/*\n+\t * This is a bit of a hack. In raw mode no black level correction\n+\t * happens. This flag is used to ensure the metadata gets populated with\n+\t * the black level which is needed to capture proper raw images for\n+\t * tuning.\n+\t */\n+\tsupportsRaw_ = true;\n }\n \n /**\n@@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n \t\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n \t\t\t\t rkisp1_params_cfg *params)\n {\n+\tif (context.configuration.raw)\n+\t\treturn;\n+\n \tif (frame > 0)\n \t\treturn;\n \n@@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n \tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n }\n \n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::process\n+ */\n+void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n+\t\t\t\t [[maybe_unused]] const uint32_t frame,\n+\t\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t\t [[maybe_unused]] const rkisp1_stat_buffer *stats,\n+\t\t\t\t ControlList &metadata)\n+{\n+\tmetadata.set(controls::SensorBlackLevels,\n+\t\t { static_cast<int32_t>(blackLevelRed_),\n+\t\t static_cast<int32_t>(blackLevelGreenR_),\n+\t\t static_cast<int32_t>(blackLevelGreenB_),\n+\t\t static_cast<int32_t>(blackLevelBlue_) });\n+}\n+\n REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n \n } /* namespace ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\nindex 460ebcc15739..4ecac233f88b 100644\n--- a/src/ipa/rkisp1/algorithms/blc.h\n+++ b/src/ipa/rkisp1/algorithms/blc.h\n@@ -23,7 +23,10 @@ public:\n \tvoid prepare(IPAContext &context, const uint32_t frame,\n \t\t IPAFrameContext &frameContext,\n \t\t rkisp1_params_cfg *params) override;\n-\n+\tvoid process(IPAContext &context, const uint32_t frame,\n+\t\t IPAFrameContext &frameContext,\n+\t\t const rkisp1_stat_buffer *stats,\n+\t\t ControlList &metadata) override;\n private:\n \tbool tuningParameters_;\n \tint16_t blackLevelRed_;\ndiff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\nindex a7bbd8d84263..609012967e02 100644\n--- a/src/ipa/rkisp1/data/uncalibrated.yaml\n+++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n@@ -5,4 +5,5 @@ version: 1\n algorithms:\n - Agc:\n - Awb:\n+ - BlackLevelCorrection:\n ...\n", "prefixes": [ "v3", "4/6" ] }