From patchwork Thu Nov 27 02:22:52 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: 25234 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 2EAB9C32DE for ; Thu, 27 Nov 2025 02:23:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BFC4D60BDD; Thu, 27 Nov 2025 03:23:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BmWJE3aZ"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6FAF460AA8 for ; Thu, 27 Nov 2025 03:23:47 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4775e891b5eso1094725e9.2 for ; Wed, 26 Nov 2025 18:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764210227; x=1764815027; 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=e5IU9i/UgAS6xhFOaLC/MXSw7l83fQor9ApmWEKFJl4=; b=BmWJE3aZrZQdFASXWKt/M3gCMwNFa0G31mPxLvoKwdatdOY2xEUkfxKUxXMQc3c2aX 9JKIYczGtwxgLKr0Dsfn8mA4ca2S8unGvcR8AClhYjvYRmbA64vKpB7QT26JGmTjmIH3 EqZUrGFzIYkq6Yj4Dpw5aZ1QmmTqJMkvBo/VbOpBZzj6I/o+74e2UL0ZoLR79SlbSzAZ mt7UGrf/Emd1WSgRZ/sDnNkb8vecTymUdgZvgTOKdwdcU24/V/IvvWnlztMu9P3VGgvX FOGgosw/Z+jY9R72qcugJ+eO3xLddb4eFEuLh7H42da6QHnjJq/I5nxAQpytHsh5mxFN LdWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764210227; x=1764815027; 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=e5IU9i/UgAS6xhFOaLC/MXSw7l83fQor9ApmWEKFJl4=; b=dWENTCG1rO7kMsxxtLt5coRa10y9l7dGHqlB92/fdbX06zENEl2Bmna3iM/hSGpdPa GYvipDHDS/GQl6NU40S2XBMJhXZLbC6OADiUowVc/kwN2EaWSLYks16gRBVhN0BXnmck 0QpDppHJFgRX9cS3EsyaptQbE5Zquv9P3eHa8P17DDnB7QLjxE27HKxWtuJEY5j7L27N zhWdwVnXpOrx7MP6c3NqHV9lvVR1uG62JiqxvIjb3PHQa7miQWxmurJZGl0eN04AygYH VbXD5IBEv4HJB4QEvZ3bDxbMCL5eNcosjKjHI/JsVFqPVkKE/uN2OyHQ6Ar9xxl1jqf5 XNNQ== X-Gm-Message-State: AOJu0YxVF7X7abin1Em8UaZYp6yoZHxdwYwtkvzWHnFupHpu7V+Kfbeu pJnPATrNUuGnAYkLG+y/RZq2cccwaDkjuma9uGrx+YMptvl2s0d9G48lC1yph9Z6T5py40gtlv2 8vtHGWD4= X-Gm-Gg: ASbGncswPO9IhyVPtq5vc8yGMUvFTNnmUFJPSm/HOEU7KMwVURHwzsw0Eh4+mnNlp8A 3y5bwrWJ0rV+C5JYiTpXcNfJ6WsQDWaqg0rxfh3BedhfXBsf2jwK0gl/GFtSndfljunxamamMcH Ab6DTgI7HQri3rLBIo+WwxvCE82T0nOogqvAHzu4yEdNWPtU2nG/V8DSPTaQyWV+2rXpFHg7ht7 aKvVLDEA5T2Io1dUZiTTqyXdxaWPr+ZPwlwXmr3zQYQ/re0YOi/IPobNM4hRBYf+/typX1bORHU AbI6AApcmMLxMBe0WiStCc1/AMg3JF9y7rB5RyE6SsY9pGbNK9WVCGmIPAHBxYO9sh/X6LS1U+B 90dwKewePm/BExGZ2h4G+plZcWBmFIw3XwlITkiFXj26gadrkNC2h7PDuyaLx9miP+5swRgsC3F Y0MVSNdVQoiCdyZ2kOEWC6pcO/d6WDESswSGkyUdORhQ7gy4VteVzRQg39AJOrKwfKTTw= X-Google-Smtp-Source: AGHT+IGfnY0V0bfGPHWJnzu6fefqZioIyHSjqL5g8TeGvlMRYc0njvLh8FdFeLCWhT31yRy4sCm11g== X-Received: by 2002:a05:600c:1ca0:b0:477:75eb:a643 with SMTP id 5b1f17b1804b1-477c0165b4emr254780965e9.4.1764210226757; Wed, 26 Nov 2025 18:23:46 -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 5b1f17b1804b1-4790b0e21e8sm71549495e9.15.2025.11.26.18.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 18:23:45 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v2 20/22] libcamera: software_isp: blacklevel: Make black level available in debayer params Date: Thu, 27 Nov 2025 02:22:52 +0000 Message-ID: <20251127022256.178929-21-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127022256.178929-1-bryan.odonoghue@linaro.org> References: <20251127022256.178929-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. Signed-off-by: Bryan O'Donoghue Reviewed-by: Kieran Bingham --- 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 4ec76dce6..1034912e7 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