From 43ab0d487b59235818aefdb74fc017362c72420b Mon Sep 17 00:00:00 2001 From: Isaac Scott Date: Fri, 21 Nov 2025 17:31:24 +0000 Subject: [PATCH] libipa: module: Allow algorithms to be disabled via the tuning file 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart [Kieran: Reflow text] Signed-off-by: Kieran Bingham --- src/ipa/libipa/module.cpp | 8 ++++++++ src/ipa/libipa/module.h | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp index 64ca9141..a95dca69 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 0fb51916..c27af771 100644 --- a/src/ipa/libipa/module.h +++ b/src/ipa/libipa/module.h @@ -74,6 +74,18 @@ private: int createAlgorithm(Context &context, const YamlObject &data) { const auto &[name, algoData] = *data.asDict().begin(); + + /* + * 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, Info) + << "Algorithm '" << name << "' disabled via tuning file"; + return 0; + } + std::unique_ptr> algo = createAlgorithm(name); if (!algo) { LOG(IPAModuleAlgo, Error)