From 6f663990a0f73f6b1e058470bc3129a21b252f17 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Thu, 23 Jan 2025 12:40:53 +0100 Subject: 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 Reviewed-by: Daniel Scally Reviewed-by: Paul Elder --- src/ipa/libipa/awb.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/ipa/libipa/awb.h (limited to 'src/ipa/libipa/awb.h') 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 +#include "libcamera/internal/vector.h" +#include "libcamera/internal/yaml_parser.h" + +namespace libcamera { + +namespace ipa { + +struct AwbResult { + RGB gains; + double colourTemperature; +}; + +struct AwbStats { + virtual double computeColourError(const RGB &gains) const = 0; + virtual RGB 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 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 */ -- cgit v1.2.1