From c699d26573ebc3a6275d697a9032aedd9d19f974 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Thu, 3 Apr 2025 17:49:18 +0200 Subject: 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 Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/ipa/libipa/awb_bayes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ipa/libipa/awb_bayes.cpp') 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 AwbBayes::gainsFromColourTemperature(double colourTemperature) +std::optional> AwbBayes::gainsFromColourTemperature(double colourTemperature) { /* * \todo In the RaspberryPi code, the ct curve was interpolated in @@ -278,7 +278,7 @@ RGB 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{ { gains[0], 1.0, gains[1] } }; } AwbResult AwbBayes::calculateAwb(const AwbStats &stats, unsigned int lux) -- cgit v1.2.1