From 8757cc7c4291420e94047ea54a735cbaa1eb6adb Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Wed, 27 Jul 2022 09:55:22 +0100 Subject: ipa: raspberryip: Remove all exception throw statements Replace all exception throw statements with LOG(RPi*, Fatal) error messages. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/ipa/raspberrypi/controller/rpi/alsc.cpp') diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 35da336e..7df89445 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -54,10 +54,10 @@ static void generateLut(double *lut, boost::property_tree::ptree const ¶ms) { double cstrength = params.get("corner_strength", 2.0); if (cstrength <= 1.0) - throw std::runtime_error("Alsc: corner_strength must be > 1.0"); + LOG(RPiAlsc, Fatal) << "Alsc: corner_strength must be > 1.0"; double asymmetry = params.get("asymmetry", 1.0); if (asymmetry < 0) - throw std::runtime_error("Alsc: asymmetry must be >= 0"); + LOG(RPiAlsc, Fatal) << "Alsc: asymmetry must be >= 0"; double f1 = cstrength - 1, f2 = 1 + sqrt(cstrength); double R2 = X * Y / 4 * (1 + asymmetry * asymmetry); int num = 0; @@ -79,12 +79,11 @@ static void readLut(double *lut, boost::property_tree::ptree const ¶ms) const int maxNum = XY; for (auto &p : params) { if (num == maxNum) - throw std::runtime_error( - "Alsc: too many entries in LSC table"); + LOG(RPiAlsc, Fatal) << "Alsc: too many entries in LSC table"; lut[num++] = p.second.get_value(); } if (num < maxNum) - throw std::runtime_error("Alsc: too few entries in LSC table"); + LOG(RPiAlsc, Fatal) << "Alsc: too few entries in LSC table"; } static void readCalibrations(std::vector &calibrations, @@ -96,9 +95,8 @@ static void readCalibrations(std::vector &calibrations, for (auto &p : params.get_child(name)) { double ct = p.second.get("ct"); if (ct <= lastCt) - throw std::runtime_error( - "Alsc: entries in " + name + - " must be in increasing ct order"); + LOG(RPiAlsc, Fatal) + << "Alsc: entries in " << name << " must be in increasing ct order"; AlscCalibration calibration; calibration.ct = lastCt = ct; boost::property_tree::ptree const &table = @@ -106,17 +104,14 @@ static void readCalibrations(std::vector &calibrations, int num = 0; for (auto it = table.begin(); it != table.end(); it++) { if (num == XY) - throw std::runtime_error( - "Alsc: too many values for ct " + - std::to_string(ct) + " in " + - name); + LOG(RPiAlsc, Fatal) + << "Alsc: too many values for ct " << ct << " in " << name; calibration.table[num++] = it->second.get_value(); } if (num != XY) - throw std::runtime_error( - "Alsc: too few values for ct " + - std::to_string(ct) + " in " + name); + LOG(RPiAlsc, Fatal) + << "Alsc: too few values for ct " << ct << " in " << name; calibrations.push_back(calibration); LOG(RPiAlsc, Debug) << "Read " << name << " calibration for ct " << ct; -- cgit v1.2.1