From patchwork Tue Oct 28 21:17:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 24873 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 25190BE080 for ; Tue, 28 Oct 2025 21:18:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CBA976083B; Tue, 28 Oct 2025 22:18:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XJc6h0Qw"; 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 42D42606DE for ; Tue, 28 Oct 2025 22:18:32 +0100 (CET) Received: from rui-Precision-7560.local (unknown [209.216.122.90]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 78E8EAD0; Tue, 28 Oct 2025 22:16:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761686203; bh=SsvWV+xB3JRGT/WULtXjRSmec9iz3gykbMx1sCx7sMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJc6h0QwxbfCGk+z+e+hN2MUm/ntTkGD/PusHInrueIA5rC5hXu297reMyxq/LixI Gk0i1RlGVr8xXHpzrqBQY3cHmUKNk55JiEzijqe0Ct9nurVYh07VzTXC7xW9BDYMUa mNoQlArfMXkzGzZlTFdQPTCFJQIUGFUSmA1A63Xk= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 03/17] ipa: rkisp1: algorithms: add Denoise state toggles Date: Tue, 28 Oct 2025 17:17:36 -0400 Message-ID: <20251028211751.2761420-3-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251028211751.2761420-1-rui.wang@ideasonboard.com> References: <20251028211751.2761420-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" Add state management helpers to DenoiseBaseAlgorithm: - EnableState struct to track enable/disable state changes - processEnableToggle() to detect state transitions - Manual mode setters/getters (setManualMode, isManualMode) - Developer mode setters/getters (setDevMode, isDevMode) - Private member variables for mode tracking These helpers provide shared state management for derived DPF and Filter algorithms. Signed-off-by: Rui Wang --- src/ipa/rkisp1/algorithms/denoise.h | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/denoise.h b/src/ipa/rkisp1/algorithms/denoise.h index d97301f0..f40e5aa1 100644 --- a/src/ipa/rkisp1/algorithms/denoise.h +++ b/src/ipa/rkisp1/algorithms/denoise.h @@ -15,27 +15,40 @@ namespace libcamera { namespace ipa::rkisp1::algorithms { -/** - * \class DenoiseBaseAlgorithm - * \brief Base class for RkISP1 denoising algorithms - * - * This abstract base class provides common functionality for denoising algorithms - * in the RkISP1 Image Processing Algorithm (IPA). - * - * Derived classes must implement algorithm-specific behavior. - */ class DenoiseBaseAlgorithm : public ipa::rkisp1::Algorithm { protected: DenoiseBaseAlgorithm() = default; ~DenoiseBaseAlgorithm() = default; + struct EnableState { + bool enabled = true; /**< Current enable state */ + bool lastEnabled = true; /**< Previous enable state for change detection */ + }; + bool processEnableToggle(bool value, EnableState &state); + + void setManualMode(bool manual) { manualMode_ = manual; } + + void setDevMode(bool dev) { devMode_ = dev; } + bool isManualMode() const { return manualMode_; } + bool isDevMode() const { return devMode_; } unsigned computeIso(const IPAContext &context, const IPAFrameContext &frameContext) const; template int selectIsoBand(unsigned iso, const LevelContainer &levels) const; + +private: + bool manualMode_ = false; /**< Current manual/auto mode state */ + bool devMode_ = false; /**< Developer mode state for advanced controls */ }; +inline bool DenoiseBaseAlgorithm::processEnableToggle(bool value, EnableState &state) +{ + state.lastEnabled = state.enabled; + state.enabled = value; + return state.enabled != state.lastEnabled; +} + inline unsigned DenoiseBaseAlgorithm::computeIso(const IPAContext &context, const IPAFrameContext &frameContext) const {