{"id":25121,"url":"https://patchwork.libcamera.org/api/patches/25121/?format=json","web_url":"https://patchwork.libcamera.org/patch/25121/","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":"<20251120232019.3590-21-bryan.odonoghue@linaro.org>","date":"2025-11-20T23:20:17","name":"[20/22] libcamera: software_isp: blacklevel: Make black level available in debayer params","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"21f0c5ec8ea2fd8ded5bdd6003a327f96d1f6bec","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/25121/mbox/","series":[{"id":5599,"url":"https://patchwork.libcamera.org/api/series/5599/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5599","date":"2025-11-20T23:19:57","name":"GPUISP precursor series","version":1,"mbox":"https://patchwork.libcamera.org/series/5599/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25121/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25121/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 5168AC3333\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 Nov 2025 23:21:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D677660B0B;\n\tFri, 21 Nov 2025 00:21:02 +0100 (CET)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D568A60AB7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 00:20:59 +0100 (CET)","by mail-wr1-x434.google.com with SMTP id\n\tffacd0b85a97d-42b39d51dcfso899127f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Nov 2025 15:20:59 -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\t5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 20 Nov 2025 15:20:58 -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=\"Nl5FFTXf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1763680859; x=1764285659;\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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=;\n\tb=Nl5FFTXf7eJRMLSbvu/Re6ZWqTZIi+0H8gUrQWLsSM+MERiD7uqyK9I2QUsvDRBK63\n\tISWIGX0fNGBAl4OB5rxAXej08qEHMIiLVhQ2JmkpW9Hs7T0yYbQ9B8iEeOKGlnQG4sMW\n\twrJoqtYxAKETgFpqo5PONo/N3SISMpsnhdHQvnRggR8SdYqF/AeGLwoh4bTbAT1w8U7B\n\tUeAQ1eMVe+Ml5Wbg6JDKtfRKB0DB8ieIKE83RPeXjS4M8ijH+vy0tBNX1WbUQhcf4a8v\n\tCh894fEfTNMdCKXl64zHKsv53vudHUWdDf0IRnoLQttRSWcSMCpsDMu5bb8siJsMJIjq\n\tvoAw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1763680859; x=1764285659;\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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=;\n\tb=OtS7BD1712YQ06RNzA74olpvMvB0d3++r4n2GKQK58wwX2VAXdsYOrIHUh0bD+aZwh\n\t1qSdB3dn3wqODZ5RxpMw5kZjsVT1Zf7+hRt2EAvRyCtz+oz4if6cYRKZxyZD0rWVplN6\n\tqTJUHgKbPIA9tx16Gv9cyu8YEIUSlBJW0ZW4ayzZixPQHM2y8epCyrrUolxGcjuGG/bY\n\tvWIJEqfD4GwAf3HF3wq6xY015oWJGR8UcymIntvq9gge0WpoiCU3E2nnoNkNTY1457Fs\n\tx+cLboWg2lB4e6nGXjM9i7Bzx5Gos+hkfEKwaR3XFs+P3xNPD7xtwVcHwI/3emraZugY\n\tHCFA==","X-Gm-Message-State":"AOJu0YwL0L14RflJl/IMKDgw98YTpfen8beSWo/Kdz4QNkTOD8MrAqjM\n\tVGCPCijnZncw5wSDm2mL4WjEmfr7w0B68j/qUEwjOlXpNTGe/l8kYxU2IWMBy+t78KPkZWX5PAR\n\tN+rZXFWs=","X-Gm-Gg":"ASbGncs6v03BkX98pG/AciAI9DwDuwuOdiaU6ixkuuSIuS3QHkf9P5sn7z/CKYY5iDd\n\t8ypO4EdkHXmJWBlcRNjLpdYoNr7R5eAW3B0zrwu989fHzcPODHYOZROX8wLr6W+hKnMUMxBoUXp\n\tN2RmcztnSgl6TRqvl1vkTnCG5cMK5YAlrVRycMyS6LwuS8bg5ajnejLgcA1gF0Td2VI1/YOcvXK\n\ttn2IT5uadBNYiWuBsHCFb2Jkt7HAQmSHylB4ybRutWh5TRMWx2RGLziUTgEFSx3mgg6Ljz40UHp\n\tE9ipcbOZuGANQYcI11o/AswGTQWasntbwGqUJuIpa6KuL/35OJ6W/E77KdvfwyHz6ZKdINJWlrx\n\tc8/K9cKSizAVze72dRbY1my/lNw43yDIrJNgjfsqA5y+/RE9YNAQSUygD1KchE/99/Cvh7GAeY/\n\t/fHE+klsqr0B0FYjPu7wM8gvcAxAqaFmVAOLvK1oiUY3U1FlgCD3LuJlj4U9Fr/dfNip0=","X-Google-Smtp-Source":"AGHT+IFnBxKeAlU6ux+zAn6PseytuJPsUk+xgN+ktDesNDgIOAavH07+EjvPjs9lf+6AiVHhkJgliQ==","X-Received":"by 2002:a05:6000:2f85:b0:3fb:aca3:d5d9 with SMTP id\n\tffacd0b85a97d-42cc1abdce5mr93767f8f.1.1763680859136; \n\tThu, 20 Nov 2025 15:20:59 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>","Subject":"[PATCH 20/22] libcamera: software_isp: blacklevel: Make black level\n\tavailable in debayer params","Date":"Thu, 20 Nov 2025 23:20:17 +0000","Message-ID":"<20251120232019.3590-21-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.51.2","In-Reply-To":"<20251120232019.3590-1-bryan.odonoghue@linaro.org>","References":"<20251120232019.3590-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\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n .../internal/software_isp/debayer_params.h          |  6 ++++++\n src/ipa/simple/algorithms/blc.cpp                   | 13 +++++++++++++\n src/ipa/simple/algorithms/blc.h                     |  4 ++++\n 3 files changed, 23 insertions(+)","diff":"diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\nindex 019df2048..1a319833c 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,11 @@ struct DebayerParams {\n \t * Per frame CCM values as calcualted by the IPA\n \t */\n \tMatrix<float, 3, 3> ccm;\t/**< Per frame colour correction matrix for GPUISP */\n+\n+\t/*\n+\t * Per frame blacklevel gains calculated by the IPA\n+\t */\n+\tRGB<float> blackLevel;\t\t/**< Blacklevel gains for GPUISP */\n };\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\nindex 370385afc..4569ded48 100644\n--- a/src/ipa/simple/algorithms/blc.cpp\n+++ b/src/ipa/simple/algorithms/blc.cpp\n@@ -47,6 +47,19 @@ 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+\tconst std::array<float, 3> blackLevel { context.activeState.blc.level / 255.0f,\n+\t\t\t\t\t\tcontext.activeState.blc.level / 255.0f,\n+\t\t\t\t\t\tcontext.activeState.blc.level / 255.0f };\n+\n+\t/* Latch the blacklevel gain so GPUISP can apply. */\n+\tparams->blackLevel = RGB<float>(blackLevel);\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,\n","prefixes":["20/22"]}