ipa: raspberryip: Remove all exception throw statements

Replace all exception throw statements with LOG(RPi*, Fatal) error messages.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2022-07-27 09:55:22 +01:00 committed by Laurent Pinchart
parent f95bae418c
commit 8757cc7c42
6 changed files with 34 additions and 48 deletions

View file

@ -54,10 +54,10 @@ static void generateLut(double *lut, boost::property_tree::ptree const &params)
{
double cstrength = params.get<double>("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<double>("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 &params)
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<double>();
}
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<AlscCalibration> &calibrations,
@ -96,9 +95,8 @@ static void readCalibrations(std::vector<AlscCalibration> &calibrations,
for (auto &p : params.get_child(name)) {
double ct = p.second.get<double>("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<AlscCalibration> &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<double>();
}
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;