From patchwork Fri Nov 21 11:34:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac Scott X-Patchwork-Id: 25148 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 A40F4BD80A for ; Fri, 21 Nov 2025 11:34:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4FA6760A80; Fri, 21 Nov 2025 12:34:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Oslrzfoz"; 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 71A2E60805 for ; Fri, 21 Nov 2025 12:34:16 +0100 (CET) Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 870E79CA; Fri, 21 Nov 2025 12:32:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763724730; bh=rGnmKyrbTOBk8N4Mfyo5+0Xvn4O7Jd88yqmcIamMrIs=; h=From:To:Cc:Subject:Date:From; b=Oslrzfozxw5HdcE5JThycOvT6tDEcy9sQzrz8AiPCbRLF2GCdA3ykS5ylfssyvNDF 4ujCMzdk2mQZdeZx360tPwawveIA6Cyt/ucro6p9lG3FLjNvjLtnpNKZsrsjVosONh euuQTEZCenythHfuV4a0NiuO+JBzYQo8jGBd1Qfs= From: Isaac Scott To: libcamera-devel@lists.libcamera.org Cc: Isaac Scott Subject: [PATCH v3] libipa: module: Allow algorithms to be disabled via the tuning file Date: Fri, 21 Nov 2025 11:34:11 +0000 Message-ID: <20251121113411.111096-1-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 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" It is beneficial to have the option during development to disable and enable algorithms via the tuning file without having to delete their entries. Add support for an optional "enabled" parameter to accomplish this. Usage example: version: 1 algorithms: - Agc: enabled: true - Awb: enabled: false This will enable AGC, and disable AWB. If the enabled flag is not present, the algorithm will be enabled. Signed-off-by: Isaac Scott --- v1 of this patch can be found here: https://patchwork.libcamera.org/patch/23299/ Changelog: v2 -> v3: - Moved parsing back to createAlgorithm(). - Added documentation to module.cpp. - Ensured the 'enabled' flag is part of the algoData for an algorithm to help avoid ambiguity. v1 -> v2: - Moved parsing to createAlgorithms() instead of createAlgorithm() - Changed "disabled" flag to "enabled: [boolean]" --- src/ipa/libipa/module.cpp | 8 ++++++++ src/ipa/libipa/module.h | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp index 64ca91419..f142c5257 100644 --- a/src/ipa/libipa/module.cpp +++ b/src/ipa/libipa/module.cpp @@ -94,6 +94,14 @@ namespace ipa { * algorithms. The configuration data is expected to be correct, any error * causes the function to fail and return immediately. * + * Algorithms can optionally be disabled via the tuning file of the camera module + * as shown here, with AGC being used as an example: + * + * - Agc: + * enabled: false + * + * If this is the case, the algorithm will not be instantiated. + * * \return 0 on success, or a negative error code on failure */ diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h index 116cb8968..0b3b84219 100644 --- a/src/ipa/libipa/module.h +++ b/src/ipa/libipa/module.h @@ -82,6 +82,17 @@ private: return -EINVAL; } + /* + * Optionally, algorithms can be disabled via the tuning file by including + * enabled: false as a parameter within the algorithm tuning data. + * This is not an error, so we return 0. + */ + if (!algoData["enabled"].get(true)) { + LOG(IPAModuleAlgo, Debug) + << "Algorithm '" << name << "' disabled via tuning file"; + return 0; + } + int ret = algo->init(context, algoData); if (ret) { LOG(IPAModuleAlgo, Error)