diff options
author | Stefan Klug <stefan.klug@ideasonboard.com> | 2025-01-23 12:40:53 +0100 |
---|---|---|
committer | Stefan Klug <stefan.klug@ideasonboard.com> | 2025-02-21 17:35:03 +0100 |
commit | 6f663990a0f73f6b1e058470bc3129a21b252f17 (patch) | |
tree | 96cb9db3a864935cc1c41c29ed8ed4ccf45161bc /src/ipa/libipa/awb.h | |
parent | 3acacb089dbe8aa26b8085591bad10e317f3de1a (diff) |
libipa: Add AWB algorithm base class
Add a class to provide a generic interface for auto white balance
algorithms. Concrete AWB algorithms are expected to subclass the
AwbAlgorithm class to implement their functionality.
IPAs are expected to subclass the AwbStats class and implement the
necessary functions to give the algorithm access to the hardware
specific statistics data.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/awb.h')
-rw-r--r-- | src/ipa/libipa/awb.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h new file mode 100644 index 00000000..95be01b0 --- /dev/null +++ b/src/ipa/libipa/awb.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024 Ideas on Board Oy + * + * Generic AWB algorithms + */ + +#pragma once + +#include <libcamera/controls.h> +#include "libcamera/internal/vector.h" +#include "libcamera/internal/yaml_parser.h" + +namespace libcamera { + +namespace ipa { + +struct AwbResult { + RGB<double> gains; + double colourTemperature; +}; + +struct AwbStats { + virtual double computeColourError(const RGB<double> &gains) const = 0; + virtual RGB<double> getRGBMeans() const = 0; +}; + +class AwbAlgorithm +{ +public: + virtual ~AwbAlgorithm() = default; + + virtual int init(const YamlObject &tuningData) = 0; + virtual AwbResult calculateAwb(const AwbStats &stats, int lux) = 0; + virtual RGB<double> gainsFromColourTemperature(double colourTemperature) = 0; + + const ControlInfoMap::Map &controls() const + { + return controls_; + } + + virtual void handleControls([[maybe_unused]] const ControlList &controls) {} + +protected: + ControlInfoMap::Map controls_; +}; + +} /* namespace ipa */ + +} /* namespace libcamera */ |