[PATCH 1/1] libipa: Allow disabling algorithms via the tuning file

Isaac Scott isaac.scott at ideasonboard.com
Tue Apr 29 14:48:06 CEST 2025


Allows the user to add "disabled" as a parameter in their tuning file,
which lets them test disabling algorithms without having to delete them.

Usage example:

version: 1
algorithms:
  - Agc:
      disabled:
      AeMeteringMode:
        MeteringCentreWeighted: [ 0, 0, 0, 0, 0, 0, 6, 8, 6, 0, 0, 8, 16, 8, 0, 0, 6, 8, 6, 0, 0, 0, 0, 0, 0 ]
        MeteringSpot: [ 0, 0, 0, 0, 0, 0, 2, 4, 2, 0, 0, 4, 16, 4, 0, 0, 2, 4, 2, 0, 0, 0, 0, 0, 0 ]
        MeteringMatrix: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
      AeExposureMode:

This example will disable the Agc algorithm.

Signed-off-by: Isaac Scott <isaac.scott at ideasonboard.com>
---
 src/ipa/libipa/module.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h
index 0fb51916..86cc382b 100644
--- a/src/ipa/libipa/module.h
+++ b/src/ipa/libipa/module.h
@@ -74,6 +74,13 @@ private:
 	int createAlgorithm(Context &context, const YamlObject &data)
 	{
 		const auto &[name, algoData] = *data.asDict().begin();
+		if (algoData.contains("disabled")) {
+			LOG(IPAModuleAlgo, Debug)
+				<< "Algorithm " << name << " is disabled"
+				<< " in the tuning file!";
+			/* If we return an error code, the IPA does not work */
+			return 0;
+		}
 		std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);
 		if (!algo) {
 			LOG(IPAModuleAlgo, Error)
-- 
2.43.0



More information about the libcamera-devel mailing list