From patchwork Sat Oct 11 16:03:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 24595 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 72F5EC3333 for ; Sat, 11 Oct 2025 16:03:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2A5DC6045D; Sat, 11 Oct 2025 18:03:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cW03qz9Y"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0FC6960444 for ; Sat, 11 Oct 2025 18:03:44 +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 BD89D1440; Sat, 11 Oct 2025 18:02:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760198527; bh=nxf7Xf9wsexXXjyeHfSxMTXDkiecYW9cv9lUMG4B/t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cW03qz9YR7xG+OiCLVJgwA49u2TGKvW3tPIA3/2V8erzI3qQcHm+Livg9bqdyGKWX cQgt4fHQo1ulZrv286x1Ft/IfryGjrSnTX5sombKMOaPY5TuTuD87vkgCSsJ65jBNI PxlmCLjoxxvQKWGIumuJqFhwgKdDi1dXdApgUHlo= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [RFC PATCH 7/7] ipa: softipa: Confine black level configuration Date: Sat, 11 Oct 2025 17:03:35 +0100 Message-ID: <20251011160335.50578-8-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 entirely into the blc module. Signed-off-by: Kieran Bingham --- src/ipa/simple/algorithms/blc.cpp | 11 +++++++++++ src/ipa/simple/soft_simple.cpp | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 370385afc683..060006d350ee 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -40,10 +40,21 @@ int BlackLevel::init([[maybe_unused]] IPAContext &context, int BlackLevel::configure(IPAContext &context, [[maybe_unused]] const IPAConfigInfo &configInfo) { + /* + * The black level from camHelper_ is a 16 bit value, software ISP + * works with 8 bit pixel values, both regardless of the actual + * sensor pixel width. Hence we obtain the pixel-based black value + * by dividing the value from the helper by 256. + */ + context.configuration.black.level = + context.camHelper->blackLevel().value() / 256; + if (definedLevel_.has_value()) context.configuration.black.level = definedLevel_; + context.activeState.blc.level = context.configuration.black.level.value_or(16); + return 0; } diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index 68ddf71e9f24..caae2c586e9b 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -227,16 +227,6 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo, (context_.configuration.agc.againMax - context_.configuration.agc.againMin) / 100.0; - if (context_.camHelper->blackLevel().has_value()) { - /* - * The black level from camHelper_ is a 16 bit value, software ISP - * works with 8 bit pixel values, both regardless of the actual - * sensor pixel width. Hence we obtain the pixel-based black value - * by dividing the value from the helper by 256. - */ - context_.configuration.black.level = - context_.camHelper->blackLevel().value() / 256; - } } else { /* * The camera sensor gain (g) is usually not equal to the value written