summaryrefslogtreecommitdiff
path: root/src/ipa/libipa/awb_bayes.cpp
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2025-04-03 17:49:18 +0200
committerStefan Klug <stefan.klug@ideasonboard.com>2025-05-20 11:20:08 +0200
commitc699d26573ebc3a6275d697a9032aedd9d19f974 (patch)
treedf7c5d0588cbbcc212318f32d5d9784a883bc040 /src/ipa/libipa/awb_bayes.cpp
parent66e9604684ebc09ee848ecf7738beb329bd40c22 (diff)
libipa: awb: Make result of gainsFromColourTemp optional
In the grey world AWB case, if no colour gains are contained in the tuning file, the colour gains get reset to 1 when the colour temperature is set manually. This is unexpected and undesirable. Allow the gainsFromColourTemp() function to return a std::nullopt to handle that case. While at it, remove an unnecessary import from rkisp1/algorithms/awb.h. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/awb_bayes.cpp')
-rw-r--r--src/ipa/libipa/awb_bayes.cpp4
1 files changed, 2 insertions, 2 deletions
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)