{"id":25306,"url":"https://patchwork.libcamera.org/api/patches/25306/?format=json","web_url":"https://patchwork.libcamera.org/patch/25306/","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":"<20251202133157.661407-21-bryan.odonoghue@linaro.org>","date":"2025-12-02T13:31:51","name":"[v3,20/22] libcamera: software_isp: blacklevel: Make black level available in debayer params","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"be9658f023e730c939ef09754cec17d1cee8a74c","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25306/mbox/","series":[{"id":5630,"url":"https://patchwork.libcamera.org/api/series/5630/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5630","date":"2025-12-02T13:31:31","name":"GPUISP precursor series","version":3,"mbox":"https://patchwork.libcamera.org/series/5630/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25306/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25306/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 73EE4C32F7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Dec 2025 13:32:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 98FA060E3E;\n\tTue,  2 Dec 2025 14:32:37 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76EC660D22\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Dec 2025 14:32:24 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id\n\tffacd0b85a97d-42b3d7c1321so3410674f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Dec 2025 05:32:24 -0800 (PST)","from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Dec 2025 05:32:23 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"TVEJ45ra\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1764682344; x=1765287144;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=;\n\tb=TVEJ45ra5GcQoswdzOpnG3mjcDH5U1TaYa0E4pUj2WWKRGNK6GCXi32G707e3R5UJ9\n\t/R5KPO4cj28ShEx/8ypwWfYIjvkbDt11wUFMimiKAypJOQ36UNzULNwLLXZ+ijf9y21Z\n\tqsEyUjy5XQbu2tlbrI/BbxEr/QLwoWYGVlNGeLf7PXgpd+bf+x6WxnCUCTfemwRB5Dl6\n\t2ssgei+UuWPJseIM9NnNuEVT1giNoGodvAhoyDONLlqbEUEznzh2H6nWcpJPGPgB69mY\n\tD7iKtBXIecEWCK2wU6S+6IVy1NGU+s4P3u00OzXdnGzGd/NrQobjKPqDwyNceeqygsbl\n\tPQaw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764682344; x=1765287144;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=;\n\tb=FEdjdr6NPGgMo6G7w2BYKbB80uqjmeus6IKmoxQwhJXQNMwDpJG9zk2yjgfq193dQL\n\tiiOeBg9mzqXcEABMiW3h0WagJNn6uVOaopYgBhHLtN3cBXhLCVRE4U+uX5wQAmT6cLim\n\tAFFjwVThhGO8OIkT/z6ioW8Vq/uDdvco2fvXQRvQI7Fvrjj4cEfjIxbWb3d+Iqc8abqI\n\t1eairkppS/R8xkCB7A9sI6YHFsV/ukJZJHGpyodtzAGeIK/tVNHnDB0woPGayZAWM+ZN\n\t3J3WdxlTniIWDcWS0JLupNAqJ1GjZ60AsWFljjXFHyDjUs/PBcmIJsIeKEMU3c3nKrZh\n\teVmg==","X-Gm-Message-State":"AOJu0YxyfFS9ehyrFNdOg1BxkCwOi1/2FA1PhB3rHNpL9oHgye+ddBko\n\tGAvF34Qksq31w1nFy7Z0YA4aQjy8gjZgVQNn8tO6J8O5GTRzRjMjevb62/79Kxn8oBEj3wKsa32\n\tTJI/K","X-Gm-Gg":"ASbGncu2P2sGb1WvKpkHWFppDwrcSk3NDN/H2kGEcTAw7h+UgAy/4Jhe+p/fB2ZEUrG\n\tUzii4M/wM3otVEP5TI+s6S7AGRIOJzOVxnPCjFLCfwPEpkUdAmAKJa/RSY2oY5mDkyi6DMosayO\n\ttDzCaUOHn7sTSWwy7CkwWvgwqXKeUkavSNEOABABzb+USHg7bfmPysz6jpKbMkTKhbZiis3mWVC\n\tFfmSmvFRMNTt3v6iT5DBDLJIgpzncQrOsL/Mw2IWOe6y90zE6ct4tt+9oNcCacqncV1xqKT1gIE\n\tCYTYBrXZ2foE7vDnAqjYZ6KIGsn8xP+F/CQgCvwkagzVgJaMQQHarilXHFtpiFkKJgctEG7I5O/\n\tTEcT8jyy+wgDsKvYRaxR8aYoZWt0p2lsINfer1pHoKwjvE4xxrIn/gJWBfrG8j0ZVj0FpJBAlN5\n\t7xuaRdgZ+TuM+RM4tPPpXfvi8NVBnHKwNNE2bzR6j6PKMAYx+jpe9uSte9HaDKovWolxM=","X-Google-Smtp-Source":"AGHT+IHTPKdFzSXmC+mCntqgHqAK6ggD/kGdiXxAh0LVFt7QCZRBzTR+96e7Xs13jsjIeA96aNM01g==","X-Received":"by 2002:a5d:5f82:0:b0:42b:3220:9412 with SMTP id\n\tffacd0b85a97d-42e0f3491e2mr33762014f8f.28.1764682343754; \n\tTue, 02 Dec 2025 05:32:23 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz, Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v3 20/22] libcamera: software_isp: blacklevel: Make black\n\tlevel available in debayer params","Date":"Tue,  2 Dec 2025 13:31:51 +0000","Message-ID":"<20251202133157.661407-21-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>","References":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>","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":"Populate black level gain in blacklevel::prepare(). A copy is made of the gain\nvalue in the DebayerParams structure.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/software_isp/debayer_params.h | 2 ++\n src/ipa/simple/algorithms/blc.cpp                        | 9 +++++++++\n src/ipa/simple/algorithms/blc.h                          | 4 ++++\n src/libcamera/software_isp/debayer.cpp                   | 5 +++++\n 4 files changed, 20 insertions(+)","diff":"diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\nindex 4b203e211..5a0d9438f 100644\n--- a/include/libcamera/internal/software_isp/debayer_params.h\n+++ b/include/libcamera/internal/software_isp/debayer_params.h\n@@ -14,6 +14,7 @@\n #include <stdint.h>\n \n #include \"libcamera/internal/matrix.h\"\n+#include \"libcamera/internal/vector.h\"\n \n namespace libcamera {\n \n@@ -56,6 +57,7 @@ struct DebayerParams {\n \t * Per frame corrections as calculated by the IPA\n \t */\n \tMatrix<float, 3, 3> ccm;\n+\tRGB<float> blackLevel;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\nindex 370385afc..464e43c27 100644\n--- a/src/ipa/simple/algorithms/blc.cpp\n+++ b/src/ipa/simple/algorithms/blc.cpp\n@@ -47,6 +47,15 @@ int BlackLevel::configure(IPAContext &context,\n \treturn 0;\n }\n \n+void BlackLevel::prepare(IPAContext &context,\n+\t\t\t [[maybe_unused]] const uint32_t frame,\n+\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t DebayerParams *params)\n+{\n+\t/* Latch the blacklevel gain so GPUISP can apply. */\n+\tparams->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f);\n+}\n+\n void BlackLevel::process(IPAContext &context,\n \t\t\t [[maybe_unused]] const uint32_t frame,\n \t\t\t IPAFrameContext &frameContext,\ndiff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\nindex db9e6d639..a5592d087 100644\n--- a/src/ipa/simple/algorithms/blc.h\n+++ b/src/ipa/simple/algorithms/blc.h\n@@ -24,6 +24,10 @@ public:\n \n \tint init(IPAContext &context, const YamlObject &tuningData) override;\n \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n+\tvoid prepare(IPAContext &context,\n+\t\t     const uint32_t frame,\n+\t\t     IPAFrameContext &frameContext,\n+\t\t     DebayerParams *params) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n \t\t     IPAFrameContext &frameContext,\n \t\t     const SwIspStats *stats,\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex f5c94bb8c..16bf7a218 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -105,6 +105,11 @@ namespace libcamera {\n  * \\brief Per frame colour correction matrix for GPUISP\n  */\n \n+/**\n+ * \\var DebayerParams::blackLevel\n+ * \\brief Blacklevel gains for the GPUISP\n+ */\n+\n /**\n  * \\class Debayer\n  * \\brief Base debayering class\n","prefixes":["v3","20/22"]}