summaryrefslogtreecommitdiff
path: root/src/ipa/libipa/awb_grey.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_grey.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_grey.cpp')
-rw-r--r--src/ipa/libipa/awb_grey.cpp6
1 files changed, 3 insertions, 3 deletions
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 */