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

Stefan Klug stefan.klug at ideasonboard.com
Wed Apr 30 11:36:00 CEST 2025


Hi Isaac,

Thank you for the patch. 

On Tue, Apr 29, 2025 at 01:48:06PM +0100, Isaac Scott wrote:
> Allows the user to add "disabled" as a parameter in their tuning file,
> which lets them test disabling algorithms without having to delete them.

I think such a property would be useful. Ideally I'd like to toggle that
at runtime also, but that is for later.

One suggestion though: Can we call the property "enabled" with a boolean
value?

Best regards,
Stefan

> 
> 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