From patchwork Thu Nov 20 23:20:17 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: 25121 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 5168AC3333 for ; Thu, 20 Nov 2025 23:21:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D677660B0B; Fri, 21 Nov 2025 00:21:02 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Nl5FFTXf"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D568A60AB7 for ; Fri, 21 Nov 2025 00:20:59 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-42b39d51dcfso899127f8f.2 for ; Thu, 20 Nov 2025 15:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680859; x=1764285659; 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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=; b=Nl5FFTXf7eJRMLSbvu/Re6ZWqTZIi+0H8gUrQWLsSM+MERiD7uqyK9I2QUsvDRBK63 ISWIGX0fNGBAl4OB5rxAXej08qEHMIiLVhQ2JmkpW9Hs7T0yYbQ9B8iEeOKGlnQG4sMW wrJoqtYxAKETgFpqo5PONo/N3SISMpsnhdHQvnRggR8SdYqF/AeGLwoh4bTbAT1w8U7B UeAQ1eMVe+Ml5Wbg6JDKtfRKB0DB8ieIKE83RPeXjS4M8ijH+vy0tBNX1WbUQhcf4a8v Ch894fEfTNMdCKXl64zHKsv53vudHUWdDf0IRnoLQttRSWcSMCpsDMu5bb8siJsMJIjq voAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680859; x=1764285659; 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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=; b=OtS7BD1712YQ06RNzA74olpvMvB0d3++r4n2GKQK58wwX2VAXdsYOrIHUh0bD+aZwh 1qSdB3dn3wqODZ5RxpMw5kZjsVT1Zf7+hRt2EAvRyCtz+oz4if6cYRKZxyZD0rWVplN6 qTJUHgKbPIA9tx16Gv9cyu8YEIUSlBJW0ZW4ayzZixPQHM2y8epCyrrUolxGcjuGG/bY vWIJEqfD4GwAf3HF3wq6xY015oWJGR8UcymIntvq9gge0WpoiCU3E2nnoNkNTY1457Fs x+cLboWg2lB4e6nGXjM9i7Bzx5Gos+hkfEKwaR3XFs+P3xNPD7xtwVcHwI/3emraZugY HCFA== X-Gm-Message-State: AOJu0YwL0L14RflJl/IMKDgw98YTpfen8beSWo/Kdz4QNkTOD8MrAqjM VGCPCijnZncw5wSDm2mL4WjEmfr7w0B68j/qUEwjOlXpNTGe/l8kYxU2IWMBy+t78KPkZWX5PAR N+rZXFWs= X-Gm-Gg: ASbGncs6v03BkX98pG/AciAI9DwDuwuOdiaU6ixkuuSIuS3QHkf9P5sn7z/CKYY5iDd 8ypO4EdkHXmJWBlcRNjLpdYoNr7R5eAW3B0zrwu989fHzcPODHYOZROX8wLr6W+hKnMUMxBoUXp N2RmcztnSgl6TRqvl1vkTnCG5cMK5YAlrVRycMyS6LwuS8bg5ajnejLgcA1gF0Td2VI1/YOcvXK tn2IT5uadBNYiWuBsHCFb2Jkt7HAQmSHylB4ybRutWh5TRMWx2RGLziUTgEFSx3mgg6Ljz40UHp E9ipcbOZuGANQYcI11o/AswGTQWasntbwGqUJuIpa6KuL/35OJ6W/E77KdvfwyHz6ZKdINJWlrx c8/K9cKSizAVze72dRbY1my/lNw43yDIrJNgjfsqA5y+/RE9YNAQSUygD1KchE/99/Cvh7GAeY/ /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 ffacd0b85a97d-42cc1abdce5mr93767f8f.1.1763680859136; Thu, 20 Nov 2025 15:20:59 -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-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:58 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 20/22] libcamera: software_isp: blacklevel: Make black level available 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 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 --- .../internal/software_isp/debayer_params.h | 6 ++++++ src/ipa/simple/algorithms/blc.cpp | 13 +++++++++++++ src/ipa/simple/algorithms/blc.h | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 019df2048..1a319833c 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,11 @@ struct DebayerParams { * Per frame CCM values as calcualted by the IPA */ Matrix ccm; /**< Per frame colour correction matrix for GPUISP */ + + /* + * Per frame blacklevel gains calculated by the IPA + */ + RGB blackLevel; /**< Blacklevel gains for GPUISP */ }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 370385afc..4569ded48 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -47,6 +47,19 @@ int BlackLevel::configure(IPAContext &context, return 0; } +void BlackLevel::prepare(IPAContext &context, + [[maybe_unused]] const uint32_t frame, + [[maybe_unused]] IPAFrameContext &frameContext, + DebayerParams *params) +{ + const std::array blackLevel { context.activeState.blc.level / 255.0f, + context.activeState.blc.level / 255.0f, + context.activeState.blc.level / 255.0f }; + + /* Latch the blacklevel gain so GPUISP can apply. */ + params->blackLevel = RGB(blackLevel); +} + 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,