From patchwork Tue Oct 28 17:08:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 24861 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 E11A6BE080 for ; Tue, 28 Oct 2025 17:09:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 740F660840; Tue, 28 Oct 2025 18:09:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HF7coTxD"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 440286080D for ; Tue, 28 Oct 2025 18:09:16 +0100 (CET) Received: from rui-Precision-7560.local (unknown [209.216.122.90]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 61DDE16CD; Tue, 28 Oct 2025 18:07:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761671247; bh=zNy83JNJ07WUcf2XuDb7bWd83wJfMp4DWSgffFPJik8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HF7coTxD0ryjE46O1YkufM6TKI3gm+iDcgg81e+lQtGWUn3bKq5R7OzSfnkdgdhcM 0AVOqJzGnEBB7k3Le1rfrbTcIL1K14kVFmkX8ggrtpeSd8v/x0/Aa0I8x5uX4jKZ4H RP74bJTNaJ44Wgxd88PW2GtdUFREAHmYr246BCVY= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 09/16] ipa: rkisp1: algorithms: dpf: handle DPF enable toggle Date: Tue, 28 Oct 2025 13:08:38 -0400 Message-ID: <20251028170847.2673396-9-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251028170847.2673396-1-rui.wang@ideasonboard.com> References: <20251028170847.2673396-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" Implement handleEnableControl() to process the DpfEnable control and synchronize the enable state across context and frame state. Update queueRequest() to call this handler, clearing the update flag first. The enable control allows applications to globally enable/disable DPF processing without changing other configuration. Changes are logged and trigger frame updates. This replaces the previous draft::NoiseReductionMode handling with the new RkISP1-specific DpfEnable control. Signed-off-by: Rui Wang --- src/ipa/rkisp1/algorithms/denoise.h | 1 + src/ipa/rkisp1/algorithms/dpf.cpp | 48 ++++++++++------------------- src/ipa/rkisp1/algorithms/dpf.h | 1 + 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/denoise.h b/src/ipa/rkisp1/algorithms/denoise.h index 5fc78588..5bc3f941 100644 --- a/src/ipa/rkisp1/algorithms/denoise.h +++ b/src/ipa/rkisp1/algorithms/denoise.h @@ -37,6 +37,7 @@ protected: template int selectIsoBand(unsigned iso, const LevelContainer &levels) const; virtual bool parseConfig(const YamlObject &tuningData) = 0; + virtual void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) = 0; private: bool manualMode_ = false; /**< Current manual/auto mode state */ diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index a5059741..d0bed3e4 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -229,6 +229,20 @@ bool Dpf::parseSingleConfig(const YamlObject &config, return true; } +void Dpf::handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) +{ + if (const auto &c = controls.get(controls::rkisp1::DpfEnable); c) { + bool requested = *c != 0; + if (requested != enableDpf_) { + enableDpf_ = requested; + frameContext.dpf.update = true; + LOG(RkISP1Dpf, Info) << "DPF global " << (enableDpf_ ? "enabled" : "disabled"); + } + } + context.activeState.dpf.denoise = enableDpf_; + frameContext.dpf.denoise = enableDpf_; +} + /** * \copydoc libcamera::ipa::Algorithm::queueRequest */ @@ -237,38 +251,8 @@ void Dpf::queueRequest(IPAContext &context, IPAFrameContext &frameContext, const ControlList &controls) { - auto &dpf = context.activeState.dpf; - bool update = false; - - const auto &denoise = controls.get(controls::draft::NoiseReductionMode); - if (denoise) { - LOG(RkISP1Dpf, Debug) << "Set denoise to " << *denoise; - - switch (*denoise) { - case controls::draft::NoiseReductionModeOff: - if (dpf.denoise) { - dpf.denoise = false; - update = true; - } - break; - case controls::draft::NoiseReductionModeMinimal: - case controls::draft::NoiseReductionModeHighQuality: - case controls::draft::NoiseReductionModeFast: - if (!dpf.denoise) { - dpf.denoise = true; - update = true; - } - break; - default: - LOG(RkISP1Dpf, Error) - << "Unsupported denoise value " - << *denoise; - break; - } - } - - frameContext.dpf.denoise = dpf.denoise; - frameContext.dpf.update = update; + frameContext.dpf.update = false; + handleEnableControl(controls, frameContext, context); } /** diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index faeb6c27..c01f711c 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -50,6 +50,7 @@ private: bool useIsoLevels_ = false; bool enableDpf_ = true; /* YAML master enable */ + void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) override; bool parseConfig(const YamlObject &tuningData) override; bool parseSingleConfig(const YamlObject &config, rkisp1_cif_isp_dpf_config &cfg,