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 <isaac.scott@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Reflow text]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
5a33bc10e9
commit
43ab0d487b
@@ -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
|
||||
*/
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user