summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/agc.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-26 02:36:38 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-28 13:47:50 +0300
commit735f0ffeaac736f91c35774e575b1280ba868d69 (patch)
treecce1f93a65029a6faed34d8a7993b5ecae175577 /src/ipa/raspberrypi/controller/rpi/agc.cpp
parent0821497ddd70a748e4758ecac3536fb73ed0c81c (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/agc.cpp')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/agc.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp
index cf03fb10..7fd5d18b 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
@@ -34,13 +34,20 @@ static constexpr unsigned int PipelineBits = 13; /* seems to be a 13-bit pipelin
int AgcMeteringMode::read(boost::property_tree::ptree const &params)
{
int num = 0;
+
for (auto &p : params.get_child("weights")) {
- if (num == AgcStatsSize)
- LOG(RPiAgc, Fatal) << "AgcMeteringMode: too many weights";
+ if (num == AgcStatsSize) {
+ LOG(RPiAgc, Error) << "AgcMeteringMode: too many weights";
+ return -EINVAL;
+ }
weights[num++] = p.second.get_value<double>();
}
- if (num != AgcStatsSize)
- LOG(RPiAgc, Fatal) << "AgcMeteringMode: insufficient weights";
+
+ if (num != AgcStatsSize) {
+ LOG(RPiAgc, Error) << "AgcMeteringMode: insufficient weights";
+ return -EINVAL;
+ }
+
return 0;
}
@@ -85,12 +92,19 @@ int AgcExposureMode::read(boost::property_tree::ptree const &params)
{
int numShutters = readList(shutter, params.get_child("shutter"));
int numAgs = readList(gain, params.get_child("gain"));
- if (numShutters < 2 || numAgs < 2)
- LOG(RPiAgc, Fatal)
+
+ if (numShutters < 2 || numAgs < 2) {
+ LOG(RPiAgc, Error)
<< "AgcExposureMode: must have at least two entries in exposure profile";
- if (numShutters != numAgs)
- LOG(RPiAgc, Fatal)
+ return -EINVAL;
+ }
+
+ if (numShutters != numAgs) {
+ LOG(RPiAgc, Error)
<< "AgcExposureMode: expect same number of exposure and gain entries in exposure profile";
+ return -EINVAL;
+ }
+
return 0;
}
@@ -120,8 +134,10 @@ int AgcConstraint::read(boost::property_tree::ptree const &params)
std::string boundString = params.get<std::string>("bound", "");
transform(boundString.begin(), boundString.end(),
boundString.begin(), ::toupper);
- if (boundString != "UPPER" && boundString != "LOWER")
- LOG(RPiAgc, Fatal) << "AGC constraint type should be UPPER or LOWER";
+ if (boundString != "UPPER" && boundString != "LOWER") {
+ LOG(RPiAgc, Error) << "AGC constraint type should be UPPER or LOWER";
+ return -EINVAL;
+ }
bound = boundString == "UPPER" ? Bound::UPPER : Bound::LOWER;
qLo = params.get<double>("q_lo");
qHi = params.get<double>("q_hi");