From patchwork Wed Dec 10 00:31:35 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: 25414 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 71FCDBD1F1 for ; Wed, 10 Dec 2025 00:32:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 225936146D; Wed, 10 Dec 2025 01:32:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yhfqAPYj"; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D1C2760C8A for ; Wed, 10 Dec 2025 01:32:43 +0100 (CET) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-34374febdefso6438861a91.0 for ; Tue, 09 Dec 2025 16:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765326762; x=1765931562; 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=Kru8M1HJGgHeXu29L+zRVlgMziV5HaccffXT1tFN0HU=; b=yhfqAPYjDEYOt7M9bsaFvy0lRIfiRgSs8n9beDGy4StoxqfUaCtifhxAI46HGMd7bP SRI67W859Y3Jbgea9urSY0deP22R+8dlw6OO5qAkXrYN/HUsUYCgYbdcoQGw3IMjlN20 6RM82FvVyitILWyVvOyqmaGKcJ/XNcdYgD/GpeQtcYFJ4ZasMxyc0RNmIw5igDFplV7h vusZkNgfYbXw/n2+WxKEzDrkWUD1azaqVRyHpCSTKm/kttYhxPKRCNUeqBc1n40RIcp7 i6R+Q/Nu1NNKdPissCX5EiROrDif8x7i8NA9nopi/0HiNvw1reDx+wk0T3SuZpJ0P5Yt dAVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765326762; x=1765931562; 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=Kru8M1HJGgHeXu29L+zRVlgMziV5HaccffXT1tFN0HU=; b=ehL4dFNe6omcj8QMkmvqootugb3YISltEEACYqVYJFNJzxIEGTj8conWNo8+F7uWZR irqWb9ASTKwIK0ssiUUJZFGeKNKc95KfA842HQQddF5xJ4ekj8bbfMTJGdswzQHel3xS buEdyEklEOrxNqJtg6YgfSIPZ2IJxJgYOVbGyU30I7aHizLiXO15La74ey6KP6NYrdvf USLIUG4Ql0vKh5TeZ9oavgEd8JVu5mrzKkSUi7WE4NnKnleJaq1GL7uBRZi0QTFYbwi6 APualawX1YYGQgUgClX7D2Ng24JQ1BmhjXMYzBAoX7UYKn9aVt4Rpbs59QWz1x+mcX3O QAPQ== X-Gm-Message-State: AOJu0YwFvpgEv9ZYjryDQsb2eRrzDMixBxabMENXfUv9itPr+rg4cIoZ hHthEoUduNG83TAC85CATLjvjerdqUTFOs07p23+UnDUqAcngWvntBt00/TvWypqb5Qk26yV2TZ 8zdEc X-Gm-Gg: AY/fxX4BZqkqX9y0R1nehGkm3MypXvOhkEPqLxgKRRwhSRXkJS2j/gZKGSqg6mpe/6F y3A66TpEmRMg0HPvfh/zOtDw3jqXHTOuvakvTKId17ICusJPdHBVMXBZYkvwTjKhetj+LBi0mT4 6aB6VMGJiy5hvkt5UisXBLaNDp0Z5OmkyuED0O9nKmtfhSPFrLqbCpAghn/zB5XKK2JJV72K1h1 9N1BeNGDVBZkNe5mMfxbxXBlxLHXkE8y/71F7+x8f3WCh4X+sedAoEjGR0RHY4PSNs8v1/9ESKu KJVg5t+MOuoHt/9Febs43XngIZHAvfXZyXnzctROc1OF6yKu8Zj53Fpu3WKkexgRkaUTkj38kdp QYVq47PAo5xQ3ZRv1U/qqIkd8lngXiR8o4dZOU+Agh03Oubjmb5OstGLuo7W1Zbl56ep0tgyfFY CwuzRypxXhcdaULON0+fPI7/Sr8n42zgxSLU34CZ7orhUakOGU+EvvcHF7rz01xgLU X-Google-Smtp-Source: AGHT+IHCNvs/v7Pq1S4v6HwvljFJyjYcIidV9rnvz0A48/opndAVgHAD+kOXLfny76fELl8V6FTPYw== X-Received: by 2002:a17:90b:4d:b0:341:719b:768e with SMTP id 98e67ed59e1d1-34a72890df4mr486861a91.2.1765326762110; Tue, 09 Dec 2025 16:32:42 -0800 (PST) Received: from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp. [150.147.107.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34a70427ea6sm566580a91.3.2025.12.09.16.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:32:41 -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 v4 18/20] libcamera: software_isp: blacklevel: Make black level available in debayer params Date: Wed, 10 Dec 2025 00:31:35 +0000 Message-ID: <20251210003139.43606-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251210003139.43606-1-bryan.odonoghue@linaro.org> References: <20251210003139.43606-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 0ee23f36c..34460f316 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