diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-26 02:36:38 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-28 13:47:50 +0300 |
commit | 735f0ffeaac736f91c35774e575b1280ba868d69 (patch) | |
tree | cce1f93a65029a6faed34d8a7993b5ecae175577 /src/ipa/raspberrypi/controller/rpi/awb.cpp | |
parent | 0821497ddd70a748e4758ecac3536fb73ed0c81c (diff) |
ipa: raspberrypi: Replace Fatal log by error propagation
Replace the Fatal log messages that cause an abort during tuning data
read with Error messages and proper error propagation to the caller.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/rpi/awb.cpp')
-rw-r--r-- | src/ipa/raspberrypi/controller/rpi/awb.cpp | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index cd97d9f4..d8c96654 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -46,16 +46,22 @@ static int readCtCurve(Pwl &ctR, Pwl &ctB, for (auto it = params.begin(); it != params.end(); it++) { double ct = it->second.get_value<double>(); assert(it == params.begin() || ct != ctR.domain().end); - if (++it == params.end()) - LOG(RPiAwb, Fatal) << "AwbConfig: incomplete CT curve entry"; + if (++it == params.end()) { + LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry"; + return -EINVAL; + } ctR.append(ct, it->second.get_value<double>()); - if (++it == params.end()) - LOG(RPiAwb, Fatal) << "AwbConfig: incomplete CT curve entry"; + if (++it == params.end()) { + LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry"; + return -EINVAL; + } ctB.append(ct, it->second.get_value<double>()); num++; } - if (num < 2) - LOG(RPiAwb, Fatal) << "AwbConfig: insufficient points in CT curve"; + if (num < 2) { + LOG(RPiAwb, Error) << "AwbConfig: insufficient points in CT curve"; + return -EINVAL; + } return 0; } @@ -78,12 +84,16 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) ret = prior.read(p.second); if (ret) return ret; - if (!priors.empty() && prior.lux <= priors.back().lux) - LOG(RPiAwb, Fatal) << "AwbConfig: Prior must be ordered in increasing lux value"; + if (!priors.empty() && prior.lux <= priors.back().lux) { + LOG(RPiAwb, Error) << "AwbConfig: Prior must be ordered in increasing lux value"; + return -EINVAL; + } priors.push_back(prior); } - if (priors.empty()) - LOG(RPiAwb, Fatal) << "AwbConfig: no AWB priors configured"; + if (priors.empty()) { + LOG(RPiAwb, Error) << "AwbConfig: no AWB priors configured"; + return ret; + } } if (params.get_child_optional("modes")) { for (auto &p : params.get_child("modes")) { @@ -93,8 +103,10 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) if (defaultMode == nullptr) defaultMode = &modes[p.first]; } - if (defaultMode == nullptr) - LOG(RPiAwb, Fatal) << "AwbConfig: no AWB modes configured"; + if (defaultMode == nullptr) { + LOG(RPiAwb, Error) << "AwbConfig: no AWB modes configured"; + return -EINVAL; + } } minPixels = params.get<double>("min_pixels", 16.0); minG = params.get<uint16_t>("min_G", 32); @@ -103,8 +115,10 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) coarseStep = params.get<double>("coarse_step", 0.2); transversePos = params.get<double>("transverse_pos", 0.01); transverseNeg = params.get<double>("transverse_neg", 0.01); - if (transversePos <= 0 || transverseNeg <= 0) - LOG(RPiAwb, Fatal) << "AwbConfig: transverse_pos/neg must be > 0"; + if (transversePos <= 0 || transverseNeg <= 0) { + LOG(RPiAwb, Error) << "AwbConfig: transverse_pos/neg must be > 0"; + return -EINVAL; + } sensitivityR = params.get<double>("sensitivity_r", 1.0); sensitivityB = params.get<double>("sensitivity_b", 1.0); if (bayes) { |