From patchwork Tue Oct 28 17:08:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 24855 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 3D218BE080 for ; Tue, 28 Oct 2025 17:09:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C8B75607F9; Tue, 28 Oct 2025 18:09:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="q9fZfeUd"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 569A0607F9 for ; Tue, 28 Oct 2025 18:09:07 +0100 (CET) Received: from rui-Precision-7560.local (unknown [209.216.122.90]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 50FEB16CD; Tue, 28 Oct 2025 18:07:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761671238; bh=SsvWV+xB3JRGT/WULtXjRSmec9iz3gykbMx1sCx7sMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9fZfeUd2LjzQIwOw/zso8WqbGz9MnZw6n0hPKCiAhvDO+QQY3cU47FYut6Ae022z algfT4q31DigwJar7Nn2YYY32GWkqOWRZd3r/W6SKABDP+SAInoOrFo2qk+4LYqbyr 7ZVOUKtUkfmHZzbapTaYlbzmqqWFT8dAykTTMyNk= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 03/16] ipa: rkisp1: algorithms: add Denoise state toggles Date: Tue, 28 Oct 2025 13:08:32 -0400 Message-ID: <20251028170847.2673396-3-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" 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 {