From patchwork Tue Dec 2 13:31:51 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: 25306 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 73EE4C32F7 for ; Tue, 2 Dec 2025 13:32:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 98FA060E3E; Tue, 2 Dec 2025 14:32:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TVEJ45ra"; dkim-atps=neutral Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 76EC660D22 for ; Tue, 2 Dec 2025 14:32:24 +0100 (CET) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-42b3d7c1321so3410674f8f.3 for ; Tue, 02 Dec 2025 05:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682344; x=1765287144; 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=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=; b=TVEJ45ra5GcQoswdzOpnG3mjcDH5U1TaYa0E4pUj2WWKRGNK6GCXi32G707e3R5UJ9 /R5KPO4cj28ShEx/8ypwWfYIjvkbDt11wUFMimiKAypJOQ36UNzULNwLLXZ+ijf9y21Z qsEyUjy5XQbu2tlbrI/BbxEr/QLwoWYGVlNGeLf7PXgpd+bf+x6WxnCUCTfemwRB5Dl6 2ssgei+UuWPJseIM9NnNuEVT1giNoGodvAhoyDONLlqbEUEznzh2H6nWcpJPGPgB69mY D7iKtBXIecEWCK2wU6S+6IVy1NGU+s4P3u00OzXdnGzGd/NrQobjKPqDwyNceeqygsbl PQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682344; x=1765287144; 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=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=; b=FEdjdr6NPGgMo6G7w2BYKbB80uqjmeus6IKmoxQwhJXQNMwDpJG9zk2yjgfq193dQL iiOeBg9mzqXcEABMiW3h0WagJNn6uVOaopYgBhHLtN3cBXhLCVRE4U+uX5wQAmT6cLim AFFjwVThhGO8OIkT/z6ioW8Vq/uDdvco2fvXQRvQI7Fvrjj4cEfjIxbWb3d+Iqc8abqI 1eairkppS/R8xkCB7A9sI6YHFsV/ukJZJHGpyodtzAGeIK/tVNHnDB0woPGayZAWM+ZN 3J3WdxlTniIWDcWS0JLupNAqJ1GjZ60AsWFljjXFHyDjUs/PBcmIJsIeKEMU3c3nKrZh eVmg== X-Gm-Message-State: AOJu0YxyfFS9ehyrFNdOg1BxkCwOi1/2FA1PhB3rHNpL9oHgye+ddBko GAvF34Qksq31w1nFy7Z0YA4aQjy8gjZgVQNn8tO6J8O5GTRzRjMjevb62/79Kxn8oBEj3wKsa32 TJI/K X-Gm-Gg: ASbGncu2P2sGb1WvKpkHWFppDwrcSk3NDN/H2kGEcTAw7h+UgAy/4Jhe+p/fB2ZEUrG Uzii4M/wM3otVEP5TI+s6S7AGRIOJzOVxnPCjFLCfwPEpkUdAmAKJa/RSY2oY5mDkyi6DMosayO tDzCaUOHn7sTSWwy7CkwWvgwqXKeUkavSNEOABABzb+USHg7bfmPysz6jpKbMkTKhbZiis3mWVC FfmSmvFRMNTt3v6iT5DBDLJIgpzncQrOsL/Mw2IWOe6y90zE6ct4tt+9oNcCacqncV1xqKT1gIE CYTYBrXZ2foE7vDnAqjYZ6KIGsn8xP+F/CQgCvwkagzVgJaMQQHarilXHFtpiFkKJgctEG7I5O/ TEcT8jyy+wgDsKvYRaxR8aYoZWt0p2lsINfer1pHoKwjvE4xxrIn/gJWBfrG8j0ZVj0FpJBAlN5 7xuaRdgZ+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 ffacd0b85a97d-42e0f3491e2mr33762014f8f.28.1764682343754; Tue, 02 Dec 2025 05:32:23 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:23 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 20/22] libcamera: software_isp: blacklevel: Make black level 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 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 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 f5c94bb8c..16bf7a218 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