From patchwork Thu Dec 11 23:22:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25512 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 79D13C3257 for ; Thu, 11 Dec 2025 23:24:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F38061852; Fri, 12 Dec 2025 00:24:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="n6tiY7GW"; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B227C61623 for ; Fri, 12 Dec 2025 00:24:11 +0100 (CET) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7ade456b6abso498546b3a.3 for ; Thu, 11 Dec 2025 15:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765495450; x=1766100250; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LYX+U/etjfgPjb5J00CQm3DyC6598qa27lMCRWvT06k=; b=n6tiY7GWNBETfta95D6uMNrYLdQjyKxKl6INdtW3F3J0k5KTB3q5OL09u9E8oVjhue e+W9an7mmqKyBKUwpcejikVvR1DKz4jAaNcriuepHe4716iZnhGUKg9kwdkLX/szpxVv vkcod/CStBfQ7qCfhWalvX0kU+YrmIoJ6GiWsmPQseJBjDv4vIE6sWyZSag5UPOb7qLK Yn6N+npACQ1RapVM2K91DNMN4kx044o/H1q1ASv/WiAfi3kaPjAGzNb3XfZIWxz67A0g Rb8amataYYNkyq+LdY+sGXq5SumbPEc/mHFesCaVl409euqaIA6KUleg1UiWkcdWyV8b eeDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765495450; x=1766100250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LYX+U/etjfgPjb5J00CQm3DyC6598qa27lMCRWvT06k=; b=iHxkkspnXIw8Bk3C2r5J1Lq48kgNG45m5fA/9oAz5jND4O8E4Fx3op245b03/cVCLv MGYo4M3eoMHpTzjdRW17qsV1QgylTqUf0HTz+ncswGcry9C7hGpRIk+vah5DHBhKvq3K nO1Ppjq9UNE8gyARB1HSFxqddXWA9HS9mJ5Nh6O3Xay55E6/9xMS3zBjetw5CH+oh9/t UlbuAhTUnkKnlfQYP8gB7Lv/Rfi4OxlZG0A7Kp/sH5J/kPGZa103jG8NOHTNODS2BY8N MCfhi0VZWo65u2S8vQzgwJEv/QY+eoYU8AQAZY0RObu1rgl9SMbguCC7iBKsxi248VXf hSmA== X-Gm-Message-State: AOJu0YweiDWdLxEDR5cUoulkrmqXEQIlWmWfV3/kW1vCNyB5XEmhnZVW Q+zorFXp5xaoivV7Vk10cADOsjmo+IGSicS9Z6FKwzYv5oYmvZj2wLBZI0aDgrt+HYGUU0O/lw2 URm3c X-Gm-Gg: AY/fxX7Wh4UiR+lCsztKi0/53K5YL4yENSjuFGNydZJvo7VwjzDM2bleuut48uHMrYI FClIRDWa55ImL63S/RbHrWApNfhu4+R7mlMfRHf7zYnXzmdTdCxK6vZapDQZXOJ62KWfUA3/Jxl kKHrWjIjtJUCBzJerUtIF4fHFbjRdpe59ItwZ+M55S1+dkQUeyc4mFEhK6iCvDkpeIJJMvyotQZ 7z19EoZoIizpL9VksQgxQTjiG/cVc8zJ5XzWYhOzdwKlwUS/RIB9PBXe82BQPkVJiLOuk647FTi hTParqRLFHOHpX3QbLZkWSpPj/fknhMCrBLCoRo93RlA/GdwKSxG71Y6jcJ0PYe6LXU0N2v5exE 21+e3cD57BnSOXKLScq6uNich1hehVnmekMWk3hanIp/iWHg36Y4V9hBdzjCkNRYqHtH2O8OolV Uv1DzOQQTp9H1rKAw/avwMn4GSxpxeAgOdB0vUf2c2dgzEqSv5ZVqEabUA0yEIJg== X-Google-Smtp-Source: AGHT+IEf1aOxJOLB6XqeoyViZ65eKpYpAtLtLakcyfHMawTnOlvKpxY386a/BiGGEtwmdefhrHn7jg== X-Received: by 2002:a05:6a21:32a3:b0:353:6c3b:d92a with SMTP id adf61e73a8af0-369ad3fcd7fmr212079637.15.1765495450112; Thu, 11 Dec 2025 15:24:10 -0800 (PST) Received: from inspiron14p-linux (M106185144161.v4.enabler.ne.jp. [106.185.144.161]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f4c4ab52aasm3399933b3a.38.2025.12.11.15.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 15:24:09 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v5 18/20] libcamera: software_isp: blacklevel: Make black level available in debayer params Date: Thu, 11 Dec 2025 23:22:43 +0000 Message-ID: <20251211232246.31330-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251211232246.31330-1-bryan.odonoghue@linaro.org> References: <20251211232246.31330-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Populate black level gain in blacklevel::prepare(). A copy is made of the gain value in the DebayerParams structure. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 2 ++ src/ipa/simple/algorithms/blc.cpp | 9 +++++++++ src/ipa/simple/algorithms/blc.h | 4 ++++ src/libcamera/software_isp/debayer.cpp | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 4b203e211..5a0d9438f 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -14,6 +14,7 @@ #include #include "libcamera/internal/matrix.h" +#include "libcamera/internal/vector.h" namespace libcamera { @@ -56,6 +57,7 @@ struct DebayerParams { * Per frame corrections as calculated by the IPA */ Matrix ccm; + RGB blackLevel; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 370385afc..464e43c27 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -47,6 +47,15 @@ int BlackLevel::configure(IPAContext &context, return 0; } +void BlackLevel::prepare(IPAContext &context, + [[maybe_unused]] const uint32_t frame, + [[maybe_unused]] IPAFrameContext &frameContext, + DebayerParams *params) +{ + /* Latch the blacklevel gain so GPUISP can apply. */ + params->blackLevel = RGB(context.activeState.blc.level / 255.0f); +} + void BlackLevel::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h index db9e6d639..a5592d087 100644 --- a/src/ipa/simple/algorithms/blc.h +++ b/src/ipa/simple/algorithms/blc.h @@ -24,6 +24,10 @@ public: int init(IPAContext &context, const YamlObject &tuningData) override; int configure(IPAContext &context, const IPAConfigInfo &configInfo) override; + void prepare(IPAContext &context, + const uint32_t frame, + IPAFrameContext &frameContext, + DebayerParams *params) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const SwIspStats *stats, diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 4464bffb4..7334ea197 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -105,6 +105,11 @@ namespace libcamera { * \brief Per frame colour correction matrix for GPUISP */ +/** + * \var DebayerParams::blackLevel + * \brief Blacklevel gains for the GPUISP + */ + /** * \class Debayer * \brief Base debayering class