[1/1] libipa: Allow disabling algorithms via the tuning file
diff mbox series

Message ID 20250429124806.138056-2-isaac.scott@ideasonboard.com
State New
Headers show
Series
  • Allow algorithms to be disabled via the tuning file
Related show

Commit Message

Isaac Scott April 29, 2025, 12:48 p.m. UTC
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@ideasonboard.com>
---
 src/ipa/libipa/module.h | 7 +++++++
 1 file changed, 7 insertions(+)

Patch
diff mbox series

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)