{"id":25151,"url":"https://patchwork.libcamera.org/api/patches/25151/?format=json","web_url":"https://patchwork.libcamera.org/patch/25151/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","date":"2025-11-21T17:31:24","name":"[v4] libipa: module: Allow algorithms to be disabled via the tuning file","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e12fd75f64e58e63ffa1d2a88c10658193a0271b","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/?format=json","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25151/mbox/","series":[{"id":5604,"url":"https://patchwork.libcamera.org/api/series/5604/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5604","date":"2025-11-21T17:31:24","name":"[v4] libipa: module: Allow algorithms to be disabled via the tuning file","version":4,"mbox":"https://patchwork.libcamera.org/series/5604/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25151/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25151/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6F609C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 17:31:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A165960A8B;\n\tFri, 21 Nov 2025 18:31:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0DC7560805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 18:31:29 +0100 (CET)","from isaac-ThinkPad-T16-Gen-2.infra.iob\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A90FE66B;\n\tFri, 21 Nov 2025 18:29:22 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XVtrd20V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763746162;\n\tbh=jPiwPePkkfeI4m0VI6KdzPi0VFhpqCEv9vso6Mf4kps=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=XVtrd20VTC6U26X98p+d2HHiF/xcI39PelsEJBB+z70d8YOlWTahg6/cVEBrq85k3\n\tAYOuzAfbC5j8lb6T9ZjuzMKwSL5Qapfbu7QrLQJ9klq2TG4cMXSw5TQu0fTJk8qoW+\n\tqwXI/d1ofZdlauIVru7rTXpTKW6peBG9kQ1/fXf4=","From":"Isaac Scott <isaac.scott@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Isaac Scott <isaac.scott@ideasonboard.com>","Subject":"[PATCH v4] libipa: module: Allow algorithms to be disabled via the\n\ttuning file","Date":"Fri, 21 Nov 2025 17:31:24 +0000","Message-ID":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"It is beneficial to have the option during development to disable and\nenable algorithms via the tuning file without having to delete their\nentries.\n\nAdd support for an optional \"enabled\" parameter to accomplish this.\n\nUsage example:\nversion: 1\nalgorithms:\n  - Agc:\n      enabled: true\n  - Awb:\n      enabled: false\n\nThis will enable AGC, and disable AWB. If the enabled flag is not\npresent, the algorithm will be enabled.\n\nSigned-off-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n---\n\nv1 of this patch can be found here:\n\nhttps://patchwork.libcamera.org/patch/23299/\n\nChangelog:\n\nv3 -> v4:\n- Made DEBUG logging into INFO\n- Checked whether enabled exists before attempting to create the\n  algorithm.\n\nv2 -> v3:\n- Moved parsing back to createAlgorithm().\n- Added documentation to module.cpp.\n- Ensured the 'enabled' flag is part of the algoData for an\n  algorithm to help avoid ambiguity.\n\nv1 -> v2:\n- Moved parsing to createAlgorithms() instead of createAlgorithm()\n- Changed \"disabled\" flag to \"enabled: [boolean]\"\n---\n src/ipa/libipa/module.cpp |  8 ++++++++\n src/ipa/libipa/module.h   | 12 ++++++++++++\n 2 files changed, 20 insertions(+)","diff":"diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\nindex 64ca91419..f142c5257 100644\n--- a/src/ipa/libipa/module.cpp\n+++ b/src/ipa/libipa/module.cpp\n@@ -94,6 +94,14 @@ namespace ipa {\n  * algorithms. The configuration data is expected to be correct, any error\n  * causes the function to fail and return immediately.\n  *\n+ * Algorithms can optionally be disabled via the tuning file of the camera module\n+ * as shown here, with AGC being used as an example:\n+ *\n+ * - Agc:\n+ *     enabled: false\n+ *\n+ * If this is the case, the algorithm will not be instantiated.\n+ *\n  * \\return 0 on success, or a negative error code on failure\n  */\n \ndiff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\nindex 0fb51916f..826b34dab 100644\n--- a/src/ipa/libipa/module.h\n+++ b/src/ipa/libipa/module.h\n@@ -74,6 +74,18 @@ private:\n \tint createAlgorithm(Context &context, const YamlObject &data)\n \t{\n \t\tconst auto &[name, algoData] = *data.asDict().begin();\n+\n+\t\t/*\n+\t\t * Optionally, algorithms can be disabled via the tuning file by including\n+\t\t * enabled: false as a parameter within the algorithm tuning data.\n+\t\t * This is not an error, so we return 0.\n+\t\t */\n+\t\tif (!algoData[\"enabled\"].get<bool>(true)) {\n+\t\t\tLOG(IPAModuleAlgo, Info)\n+\t\t\t\t<< \"Algorithm '\" << name << \"' disabled via tuning file\";\n+\t\t\treturn 0;\n+\t\t}\n+\n \t\tstd::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n \t\tif (!algo) {\n \t\t\tLOG(IPAModuleAlgo, Error)\n","prefixes":["v4"]}