From patchwork Sat Oct 11 16:03:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 24591 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 DD669C3264 for ; Sat, 11 Oct 2025 16:03:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 40635603E0; Sat, 11 Oct 2025 18:03:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jyqlr67w"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EDD1C603F6 for ; Sat, 11 Oct 2025 18:03:42 +0200 (CEST) Received: from charm.hippo-penny.ts.net (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 93001C6E; Sat, 11 Oct 2025 18:02:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760198526; bh=vZE+O3/GeB6WLj0YL/jTDfnqXpcuUbtztkh+G5cjnzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyqlr67wHDUw8iajAtLFUKdJrrXBF5V5Kn5b44R9X0Ps1BFpYNR77IyGswrBFf9w/ DSmCJHnSp64FFuhYnhyAoyKSDrXthRwMipWBxcFVFAjFOP4fOzdI+plFKkH0cpCI9z ZU8hwTLANPci4zHSyMb5CcabQVLrexF/2hgVmN4w= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [RFC PATCH 3/7] ipa: mali-c55: Confine blacklevel config Date: Sat, 11 Oct 2025 17:03:31 +0100 Message-ID: <20251011160335.50578-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251011160335.50578-1-kieran.bingham@ideasonboard.com> References: <20251011160335.50578-1-kieran.bingham@ideasonboard.com> 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" Move the black level handling into the blc module. Signed-off-by: Kieran Bingham --- src/ipa/mali-c55/algorithms/blc.cpp | 20 +++++++++++++------- src/ipa/mali-c55/ipa_context.h | 1 - src/ipa/mali-c55/mali-c55.cpp | 10 ---------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/ipa/mali-c55/algorithms/blc.cpp b/src/ipa/mali-c55/algorithms/blc.cpp index 85642c0435a2..1fdd00ccc2ea 100644 --- a/src/ipa/mali-c55/algorithms/blc.cpp +++ b/src/ipa/mali-c55/algorithms/blc.cpp @@ -64,17 +64,23 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context, int BlackLevelCorrection::configure(IPAContext &context, [[maybe_unused]] const IPACameraSensorInfo &configInfo) { + if (!context.camHelper->blackLevel().has_value()) + return 0; + + /* + * The black level from CameraSensorHelper is a 16-bit value. + * The Mali-C55 ISP expects 20-bit settings, so we shift it to + * the appropriate width + */ + uint32_t blackLevel = context.camHelper->blackLevel().value() << 4; + /* * If no Black Levels were passed in through tuning data then we could * use the value from the CameraSensorHelper if one is available. */ - if (context.configuration.sensor.blackLevel && - !(offset00_ + offset01_ + offset10_ + offset11_)) { - offset00_ = context.configuration.sensor.blackLevel; - offset01_ = context.configuration.sensor.blackLevel; - offset10_ = context.configuration.sensor.blackLevel; - offset11_ = context.configuration.sensor.blackLevel; - } + if (blackLevel && + !(offset00_ + offset01_ + offset10_ + offset11_)) + offset00_ = offset01_ = offset10_ = offset11_ = blackLevel; return 0; } diff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h index bfa805c7b93f..6dd8e5b0edfc 100644 --- a/src/ipa/mali-c55/ipa_context.h +++ b/src/ipa/mali-c55/ipa_context.h @@ -31,7 +31,6 @@ struct IPASessionConfiguration { struct { BayerFormat::Order bayerOrder; utils::Duration lineDuration; - uint32_t blackLevel; } sensor; }; diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 0751513dc584..27f6501085b9 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -190,16 +190,6 @@ void IPAMaliC55::updateSessionConfiguration(const IPACameraSensorInfo &info, context_.configuration.agc.defaultExposure = defExposure; context_.configuration.agc.minAnalogueGain = context_.camHelper->gain(minGain); context_.configuration.agc.maxAnalogueGain = context_.camHelper->gain(maxGain); - - if (context_.camHelper->blackLevel().has_value()) { - /* - * The black level from CameraSensorHelper is a 16-bit value. - * The Mali-C55 ISP expects 20-bit settings, so we shift it to - * the appropriate width - */ - context_.configuration.sensor.blackLevel = - context_.camHelper->blackLevel().value() << 4; - } } void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,