| Message ID | 20251121173124.178430-1-isaac.scott@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Isaac Scott (2025-11-21 17:31:24) > 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. > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com> > > --- > > v1 of this patch can be found here: > > https://patchwork.libcamera.org/patch/23299/ > > Changelog: > > v3 -> v4: > - Made DEBUG logging into INFO > - Checked whether enabled exists before attempting to create the > algorithm. > > v2 -> v3: > - Moved parsing back to createAlgorithm(). > - Added documentation to module.cpp. > - Ensured the 'enabled' flag is part of the algoData for an > algorithm to help avoid ambiguity. > > v1 -> v2: > - Moved parsing to createAlgorithms() instead of createAlgorithm() > - Changed "disabled" flag to "enabled: [boolean]" > --- > 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 64ca91419..f142c5257 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 0fb51916f..826b34dab 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<bool>(true)) { > + LOG(IPAModuleAlgo, Info) > + << "Algorithm '" << name << "' disabled via tuning file"; > + return 0; > + } > + > std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name); > if (!algo) { > LOG(IPAModuleAlgo, Error) > -- > 2.43.0 >
On Fri, Nov 21, 2025 at 05:31:24PM +0000, Isaac Scott wrote: > 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 <isaac.scott@ideasonboard.com> > > --- > > v1 of this patch can be found here: > > https://patchwork.libcamera.org/patch/23299/ > > Changelog: > > v3 -> v4: > - Made DEBUG logging into INFO > - Checked whether enabled exists before attempting to create the > algorithm. > > v2 -> v3: > - Moved parsing back to createAlgorithm(). > - Added documentation to module.cpp. > - Ensured the 'enabled' flag is part of the algoData for an > algorithm to help avoid ambiguity. > > v1 -> v2: > - Moved parsing to createAlgorithms() instead of createAlgorithm() > - Changed "disabled" flag to "enabled: [boolean]" > --- > 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 64ca91419..f142c5257 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 0fb51916f..826b34dab 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. > + */ With the comment reflowed to 80 columns, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + if (!algoData["enabled"].get<bool>(true)) { > + LOG(IPAModuleAlgo, Info) > + << "Algorithm '" << name << "' disabled via tuning file"; > + return 0; > + } > + > std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name); > if (!algo) { > LOG(IPAModuleAlgo, Error)
diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp index 64ca91419..f142c5257 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 0fb51916f..826b34dab 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<bool>(true)) { + LOG(IPAModuleAlgo, Info) + << "Algorithm '" << name << "' disabled via tuning file"; + return 0; + } + std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name); if (!algo) { LOG(IPAModuleAlgo, Error)
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 <isaac.scott@ideasonboard.com> --- v1 of this patch can be found here: https://patchwork.libcamera.org/patch/23299/ Changelog: v3 -> v4: - Made DEBUG logging into INFO - Checked whether enabled exists before attempting to create the algorithm. v2 -> v3: - Moved parsing back to createAlgorithm(). - Added documentation to module.cpp. - Ensured the 'enabled' flag is part of the algoData for an algorithm to help avoid ambiguity. v1 -> v2: - Moved parsing to createAlgorithms() instead of createAlgorithm() - Changed "disabled" flag to "enabled: [boolean]" --- src/ipa/libipa/module.cpp | 8 ++++++++ src/ipa/libipa/module.h | 12 ++++++++++++ 2 files changed, 20 insertions(+)