{"id":20496,"url":"https://patchwork.libcamera.org/api/patches/20496/?format=json","web_url":"https://patchwork.libcamera.org/patch/20496/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20240701144122.3418955-4-stefan.klug@ideasonboard.com>","date":"2024-07-01T14:38:26","name":"[3/5] ipa: rkisp1: blc: Query black levels from camera sensor helper","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"91d2231dd2b1f1234071e14885c10dc3337449e9","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20496/mbox/","series":[{"id":4433,"url":"https://patchwork.libcamera.org/api/series/4433/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4433","date":"2024-07-01T14:38:23","name":"ipa: Add black level to camera sensor helpers","version":1,"mbox":"https://patchwork.libcamera.org/series/4433/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20496/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20496/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 55346BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Jul 2024 14:41:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1736463334;\n\tMon,  1 Jul 2024 16:41:48 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C56162E24\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2024 16:41:45 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:89b2:f6c7:b29b:4e5c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7B1C1289;\n\tMon,  1 Jul 2024 16:41:18 +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=\"J4CltYvU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719844878;\n\tbh=KPb4J19/zYBrN1CUguZ5WOA3gCeNPSb7o/hh2n8nF08=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=J4CltYvUKvGyFDa4HWEbP/0ld/kd3KrRc/U7Cr5w8U1MrE8GXLcsFLBs7zbRWMDkJ\n\tAwbJboDbsEjgY6j05jT6irqUyMhuPFvFCZ0VGV/ZlT53lA7dYwB6Z1BFkn12P7MhOx\n\tYb9OMxxWc4NyaBzYEQNeIiLXlFOcj6UF7aO/fCmE=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH 3/5] ipa: rkisp1: blc: Query black levels from camera sensor\n\thelper","Date":"Mon,  1 Jul 2024 16:38:26 +0200","Message-ID":"<20240701144122.3418955-4-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240701144122.3418955-1-stefan.klug@ideasonboard.com>","References":"<20240701144122.3418955-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":"The black levels from the camera sensor helper are then used to do the\nblack level correction. Black levels can still be overwritten by the\ntuning file.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp | 28 ++++++++++++++++++++++++----\n 1 file changed, 24 insertions(+), 4 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex d2e743541c99..0c39c3b47da5 100644\n--- a/src/ipa/rkisp1/algorithms/blc.cpp\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -46,10 +46,30 @@ BlackLevelCorrection::BlackLevelCorrection()\n int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,\n \t\t\t       const YamlObject &tuningData)\n {\n-\tblackLevelRed_ = tuningData[\"R\"].get<int16_t>(256);\n-\tblackLevelGreenR_ = tuningData[\"Gr\"].get<int16_t>(256);\n-\tblackLevelGreenB_ = tuningData[\"Gb\"].get<int16_t>(256);\n-\tblackLevelBlue_ = tuningData[\"B\"].get<int16_t>(256);\n+\tauto blackLevels = context.camHelper->blackLevels();\n+\tif (blackLevels) {\n+\t\tSpan<const int32_t, 4> levels = *blackLevels;\n+\t\tblackLevelRed_ = levels[0];\n+\t\tblackLevelGreenR_ = levels[1];\n+\t\tblackLevelGreenB_ = levels[2];\n+\t\tblackLevelBlue_ = levels[3];\n+\t} else\n+\t\tLOG(RkISP1Blc, Warning)\n+\t\t\t<< \"No black levels provided by camera sensor helper\";\n+\n+\tif (!blackLevels || (tuningData.contains(\"R\") &&\n+\t\t\t     tuningData.contains(\"Gr\") &&\n+\t\t\t     tuningData.contains(\"Gb\") &&\n+\t\t\t     tuningData.contains(\"B\"))) {\n+\t\tblackLevelRed_ = tuningData[\"R\"].get<int16_t>(256);\n+\t\tblackLevelGreenR_ = tuningData[\"Gr\"].get<int16_t>(256);\n+\t\tblackLevelGreenB_ = tuningData[\"Gb\"].get<int16_t>(256);\n+\t\tblackLevelBlue_ = tuningData[\"B\"].get<int16_t>(256);\n+\n+\t\tif (blackLevels)\n+\t\t\tLOG(RkISP1Blc, Warning)\n+\t\t\t\t<< \"Black levels overwritten by tuning file\";\n+\t}\n \n \ttuningParameters_ = true;\n \n","prefixes":["3/5"]}