From patchwork Fri Feb 20 22:16:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 26221 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 CA67DC3240 for ; Fri, 20 Feb 2026 22:17:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4CFF162290; Fri, 20 Feb 2026 23:17:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WHXZT8/n"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 492F66228C for ; Fri, 20 Feb 2026 23:16:57 +0100 (CET) Received: from rui-Precision-7560.tail5b760b.ts.net (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ED64F63B; Fri, 20 Feb 2026 23:16:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1771625763; bh=f8zYxdK2G/Tij2aWtdJGssJG2KAyVeggyeEttcAt/8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHXZT8/n4YmLuOGTLHFAJrRnnTX9+78L1dV5sMri+QwZHY7qgTRRblYc/i+5jbye7 gNcfrylNR9XM+Oi0z7Sx+Kn4ckxIjI/itSSPUY+i4xmhCUWn3AAAER1/jTDjGSu8wj w7wfXaQQJIB0trwMEvI+JS5VkD4fnmsHcqfiOeKY= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v2 5/7] ipa: rkisp1: filter: Parse tuning at init and active manual-mode Date: Fri, 20 Feb 2026 17:16:34 -0500 Message-ID: <20260220221636.216353-6-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260220221636.216353-1-rui.wang@ideasonboard.com> References: <20260220221636.216353-1-rui.wang@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" -Initialize Filter from tuning data in init() via parseConfig/registerControls. -Route manual mode requests through parseControls(). -Clamp Sharpness using tuning-defined levels. -Skip sharpness table override in prepare() when NoiseReductionModeManual is active. Signed-off-by: Rui Wang --- src/ipa/rkisp1/algorithms/filter.cpp | 40 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp index 62d470f4..48831791 100644 --- a/src/ipa/rkisp1/algorithms/filter.cpp +++ b/src/ipa/rkisp1/algorithms/filter.cpp @@ -56,10 +56,13 @@ const std::unordered_set kFilterKeyNames = { * \copydoc libcamera::ipa::Algorithm::init */ int Filter::init(IPAContext &context, - [[maybe_unused]] const YamlObject &tuningData) + const YamlObject &tuningData) { - auto &cmap = context.ctrlMap; - cmap[&controls::Sharpness] = ControlInfo(0.0f, 10.0f, 1.0f); + int ret = parseConfig(tuningData); + if (ret) + return ret; + + registerControls(context); return 0; } @@ -323,18 +326,6 @@ void Filter::queueRequest(IPAContext &context, auto &filter = context.activeState.filter; bool update = false; - const auto &sharpness = controls.get(controls::Sharpness); - if (sharpness) { - unsigned int value = std::round(std::clamp(*sharpness, 0.0f, 10.0f)); - - if (filter.sharpness != value) { - filter.sharpness = value; - update = true; - } - - LOG(RkISP1Filter, Debug) << "Set sharpness to " << *sharpness; - } - const auto &denoise = controls.get(controls::draft::NoiseReductionMode); if (denoise) { LOG(RkISP1Filter, Debug) << "Set denoise to " << *denoise; @@ -346,6 +337,22 @@ void Filter::queueRequest(IPAContext &context, } } + if (filter.denoise == controls::draft::NoiseReductionModeManual) { + update |= parseControls(controls); + } else { + const auto &sharpness = controls.get(controls::Sharpness); + if (sharpness) { + unsigned int value = std::round(std::clamp(*sharpness, 0.0f, static_cast(sharpness_.size() - 1))); + + if (filter.sharpness != value) { + filter.sharpness = value; + update = true; + } + + LOG(RkISP1Filter, Debug) << "Set sharpness to " << *sharpness; + } + } + frameContext.filter.denoise = filter.denoise; frameContext.filter.sharpness = filter.sharpness; frameContext.filter.update = update; @@ -399,6 +406,9 @@ void Filter::prepare([[maybe_unused]] IPAContext &context, return; } + if (denoise == controls::draft::NoiseReductionModeManual) + return; + /* sharpness override filter register .*/ const auto &sharp = sharpness_[sharpness]; config->fac_sh0 = sharp.at("fac_sh0");