summaryrefslogtreecommitdiff
path: root/src/ipa/libipa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/libipa')
-rw-r--r--src/ipa/libipa/awb.cpp2
-rw-r--r--src/ipa/libipa/awb.h3
-rw-r--r--src/ipa/libipa/awb_bayes.cpp4
-rw-r--r--src/ipa/libipa/awb_bayes.h2
-rw-r--r--src/ipa/libipa/awb_grey.cpp6
-rw-r--r--src/ipa/libipa/awb_grey.h2
6 files changed, 10 insertions, 9 deletions
diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp
index 925fac23..214bac8b 100644
--- a/src/ipa/libipa/awb.cpp
+++ b/src/ipa/libipa/awb.cpp
@@ -114,7 +114,7 @@ namespace ipa {
* does not take any statistics into account. It is used to compute the colour
* gains when the user manually specifies a colour temperature.
*
- * \return The colour gains
+ * \return The colour gains or std::nullopt if the conversion is not possible
*/
/**
diff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h
index 4bab7a45..f4a86038 100644
--- a/src/ipa/libipa/awb.h
+++ b/src/ipa/libipa/awb.h
@@ -8,6 +8,7 @@
#pragma once
#include <map>
+#include <optional>
#include <libcamera/control_ids.h>
#include <libcamera/controls.h>
@@ -39,7 +40,7 @@ public:
virtual int init(const YamlObject &tuningData) = 0;
virtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0;
- virtual RGB<double> gainsFromColourTemperature(double colourTemperature) = 0;
+ virtual std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) = 0;
const ControlInfoMap::Map &controls() const
{
diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
index d1d0eaf0..d2bcbd83 100644
--- a/src/ipa/libipa/awb_bayes.cpp
+++ b/src/ipa/libipa/awb_bayes.cpp
@@ -270,7 +270,7 @@ void AwbBayes::handleControls(const ControlList &controls)
}
}
-RGB<double> AwbBayes::gainsFromColourTemperature(double colourTemperature)
+std::optional<RGB<double>> AwbBayes::gainsFromColourTemperature(double colourTemperature)
{
/*
* \todo In the RaspberryPi code, the ct curve was interpolated in
@@ -278,7 +278,7 @@ RGB<double> AwbBayes::gainsFromColourTemperature(double colourTemperature)
* intuitive, as the gains are in linear space. But I can't prove it.
*/
const auto &gains = colourGainCurve_.getInterpolated(colourTemperature);
- return { { gains[0], 1.0, gains[1] } };
+ return RGB<double>{ { gains[0], 1.0, gains[1] } };
}
AwbResult AwbBayes::calculateAwb(const AwbStats &stats, unsigned int lux)
diff --git a/src/ipa/libipa/awb_bayes.h b/src/ipa/libipa/awb_bayes.h
index bb933038..47ef3cce 100644
--- a/src/ipa/libipa/awb_bayes.h
+++ b/src/ipa/libipa/awb_bayes.h
@@ -27,7 +27,7 @@ public:
int init(const YamlObject &tuningData) override;
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
- RGB<double> gainsFromColourTemperature(double temperatureK) override;
+ std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
void handleControls(const ControlList &controls) override;
private:
diff --git a/src/ipa/libipa/awb_grey.cpp b/src/ipa/libipa/awb_grey.cpp
index d3d2132b..d252edb2 100644
--- a/src/ipa/libipa/awb_grey.cpp
+++ b/src/ipa/libipa/awb_grey.cpp
@@ -98,15 +98,15 @@ AwbResult AwbGrey::calculateAwb(const AwbStats &stats, [[maybe_unused]] unsigned
* \return The colour gains if a colour temperature curve is available,
* [1, 1, 1] otherwise.
*/
-RGB<double> AwbGrey::gainsFromColourTemperature(double colourTemperature)
+std::optional<RGB<double>> AwbGrey::gainsFromColourTemperature(double colourTemperature)
{
if (!colourGainCurve_) {
LOG(Awb, Error) << "No gains defined";
- return RGB<double>({ 1.0, 1.0, 1.0 });
+ return std::nullopt;
}
auto gains = colourGainCurve_->getInterpolated(colourTemperature);
- return { { gains[0], 1.0, gains[1] } };
+ return RGB<double>{ { gains[0], 1.0, gains[1] } };
}
} /* namespace ipa */
diff --git a/src/ipa/libipa/awb_grey.h b/src/ipa/libipa/awb_grey.h
index 7ec7bfa5..f82a368d 100644
--- a/src/ipa/libipa/awb_grey.h
+++ b/src/ipa/libipa/awb_grey.h
@@ -25,7 +25,7 @@ public:
int init(const YamlObject &tuningData) override;
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
- RGB<double> gainsFromColourTemperature(double colourTemperature) override;
+ std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) override;
private:
std::optional<Interpolator<Vector<double, 2>>> colourGainCurve_;