Patch Detail
Show a patch.
GET /api/1.1/patches/16817/?format=api
{ "id": 16817, "url": "https://patchwork.libcamera.org/api/1.1/patches/16817/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16817/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220727023816.30008-6-laurent.pinchart@ideasonboard.com>", "date": "2022-07-27T02:38:07", "name": "[libcamera-devel,v7,05/14] ipa: raspberrypi: Return an error code from Algorithm::read()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "be1818452c4f9c0dfb1bc73c64869995cfd2802a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16817/mbox/", "series": [ { "id": 3331, "url": "https://patchwork.libcamera.org/api/1.1/series/3331/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3331", "date": "2022-07-27T02:38:02", "name": "Replace boost JSON parser with libyaml in Raspberry Pi IPA", "version": 7, "mbox": "https://patchwork.libcamera.org/series/3331/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16817/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16817/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 16E64BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 02:38:27 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D8AE6331E;\n\tWed, 27 Jul 2022 04:38:26 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 101056331E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 04:38:24 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 731D056D;\n\tWed, 27 Jul 2022 04:38:23 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658889506;\n\tbh=df6bZ3shg6DqoUt0Q/ozuXWcEgnsXNoG/22xf4VFlz8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=P13UzFXEl2yWihOskDhrfxGDoq0xruSv56I8rZffU2T7DmMFcGqm52ZUTz+C1WAIk\n\tANdflrrpQhM2A6Jum49ZsBvSr2EbP2PfdjqcRPUGg+QbPGCDWE4IdJxijPakoPc8Db\n\tJKO73TG709JPnjfuroqtiEThgfm4W0SKg4d3k2oGUt22COzSzum/dUtQYIjqhJLDWJ\n\tLN3huxQB2ZSFWrMPvFetRp5MNcPJJssRmsPRoqAIs3Tqek48prTxh0PS13UL0O2gVH\n\trnN6RqbP1C3RqdX4h+8Ryp33rIkyJpeBbIs0RxAy32Ri+GIv1IsE+D5YszcBH6JT83\n\tiWThYxceOrYCQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658889503;\n\tbh=df6bZ3shg6DqoUt0Q/ozuXWcEgnsXNoG/22xf4VFlz8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ifft18cFnv3FPPW1L5IjsNC+RzpSuL+VoAopxYHVmJ95SgGnXFJCqefWMstbLw6S2\n\tk0WTlh118856GP2+s9nBrP9lE7cDnJOk5/j7One2UiLQHMqtbUI2SFiQbwTm56BKGK\n\t5wNTdw+Ldapc30RIX+Rfx0j9g80dfxkNdyth3Mdk=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ifft18cF\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Jul 2022 05:38:07 +0300", "Message-Id": "<20220727023816.30008-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220727023816.30008-1-laurent.pinchart@ideasonboard.com>", "References": "<20220727023816.30008-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 05/14] ipa: raspberrypi: Return an\n\terror code from Algorithm::read()", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "When encountering errors, the Algorithm::read() function either uses\nLOG(Fatal) or throws exceptions from the boost property_tree functions.\nTo prepare for replacing boost JSON parse with the YamlParser class,\ngive the Algorithm::read() function the ability to return an error code,\nand propagate it all the way to the IPA module init() function.\n\nAll algorithm classes return a hardcoded 0 value for now, subsequent\ncommits will change that.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/algorithm.cpp | 3 +-\n src/ipa/raspberrypi/controller/algorithm.h | 2 +-\n src/ipa/raspberrypi/controller/controller.cpp | 8 +++-\n src/ipa/raspberrypi/controller/controller.h | 2 +-\n src/ipa/raspberrypi/controller/pwl.cpp | 3 +-\n src/ipa/raspberrypi/controller/pwl.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 28 ++++++++++----\n src/ipa/raspberrypi/controller/rpi/agc.h | 10 ++---\n src/ipa/raspberrypi/controller/rpi/alsc.cpp | 38 +++++++++++++------\n src/ipa/raspberrypi/controller/rpi/alsc.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/awb.cpp | 35 +++++++++++------\n src/ipa/raspberrypi/controller/rpi/awb.h | 8 ++--\n .../controller/rpi/black_level.cpp | 3 +-\n .../raspberrypi/controller/rpi/black_level.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/ccm.cpp | 22 ++++++++---\n src/ipa/raspberrypi/controller/rpi/ccm.h | 4 +-\n .../raspberrypi/controller/rpi/contrast.cpp | 4 +-\n src/ipa/raspberrypi/controller/rpi/contrast.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/dpc.cpp | 3 +-\n src/ipa/raspberrypi/controller/rpi/dpc.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/geq.cpp | 12 ++++--\n src/ipa/raspberrypi/controller/rpi/geq.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/lux.cpp | 3 +-\n src/ipa/raspberrypi/controller/rpi/lux.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/noise.cpp | 3 +-\n src/ipa/raspberrypi/controller/rpi/noise.h | 2 +-\n src/ipa/raspberrypi/controller/rpi/sdn.cpp | 3 +-\n src/ipa/raspberrypi/controller/rpi/sdn.h | 2 +-\n .../raspberrypi/controller/rpi/sharpen.cpp | 3 +-\n src/ipa/raspberrypi/controller/rpi/sharpen.h | 2 +-\n src/ipa/raspberrypi/raspberrypi.cpp | 9 ++++-\n 31 files changed, 151 insertions(+), 75 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp\nindex 1a7d20a4731b..d73cb36fe2d6 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.cpp\n+++ b/src/ipa/raspberrypi/controller/algorithm.cpp\n@@ -9,8 +9,9 @@\n \n using namespace RPiController;\n \n-void Algorithm::read([[maybe_unused]] boost::property_tree::ptree const ¶ms)\n+int Algorithm::read([[maybe_unused]] boost::property_tree::ptree const ¶ms)\n {\n+\treturn 0;\n }\n \n void Algorithm::initialise()\ndiff --git a/src/ipa/raspberrypi/controller/algorithm.h b/src/ipa/raspberrypi/controller/algorithm.h\nindex 92fd895d2b06..0c5566fda874 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.h\n+++ b/src/ipa/raspberrypi/controller/algorithm.h\n@@ -35,7 +35,7 @@ public:\n \tvirtual bool isPaused() const { return paused_; }\n \tvirtual void pause() { paused_ = true; }\n \tvirtual void resume() { paused_ = false; }\n-\tvirtual void read(boost::property_tree::ptree const ¶ms);\n+\tvirtual int read(boost::property_tree::ptree const ¶ms);\n \tvirtual void initialise();\n \tvirtual void switchMode(CameraMode const &cameraMode, Metadata *metadata);\n \tvirtual void prepare(Metadata *imageMetadata);\ndiff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex 872a32302410..d91ac90704cb 100644\n--- a/src/ipa/raspberrypi/controller/controller.cpp\n+++ b/src/ipa/raspberrypi/controller/controller.cpp\n@@ -32,19 +32,23 @@ Controller::Controller(char const *jsonFilename)\n \n Controller::~Controller() {}\n \n-void Controller::read(char const *filename)\n+int Controller::read(char const *filename)\n {\n \tboost::property_tree::ptree root;\n \tboost::property_tree::read_json(filename, root);\n \tfor (auto const &keyAndValue : root) {\n \t\tAlgorithm *algo = createAlgorithm(keyAndValue.first.c_str());\n \t\tif (algo) {\n-\t\t\talgo->read(keyAndValue.second);\n+\t\t\tint ret = algo->read(keyAndValue.second);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\talgorithms_.push_back(AlgorithmPtr(algo));\n \t\t} else\n \t\t\tLOG(RPiController, Warning)\n \t\t\t\t<< \"No algorithm found for \\\"\" << keyAndValue.first << \"\\\"\";\n \t}\n+\n+\treturn 0;\n }\n \n Algorithm *Controller::createAlgorithm(char const *name)\ndiff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h\nindex e28e30d7d574..841783bb7a5c 100644\n--- a/src/ipa/raspberrypi/controller/controller.h\n+++ b/src/ipa/raspberrypi/controller/controller.h\n@@ -41,7 +41,7 @@ public:\n \tController(char const *jsonFilename);\n \t~Controller();\n \tAlgorithm *createAlgorithm(char const *name);\n-\tvoid read(char const *filename);\n+\tint read(char const *filename);\n \tvoid initialise();\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata);\n \tvoid prepare(Metadata *imageMetadata);\ndiff --git a/src/ipa/raspberrypi/controller/pwl.cpp b/src/ipa/raspberrypi/controller/pwl.cpp\nindex 8b8db722966b..fde0b298c6ce 100644\n--- a/src/ipa/raspberrypi/controller/pwl.cpp\n+++ b/src/ipa/raspberrypi/controller/pwl.cpp\n@@ -12,7 +12,7 @@\n \n using namespace RPiController;\n \n-void Pwl::read(boost::property_tree::ptree const ¶ms)\n+int Pwl::read(boost::property_tree::ptree const ¶ms)\n {\n \tfor (auto it = params.begin(); it != params.end(); it++) {\n \t\tdouble x = it->second.get_value<double>();\n@@ -22,6 +22,7 @@ void Pwl::read(boost::property_tree::ptree const ¶ms)\n \t\tpoints_.push_back(Point(x, y));\n \t}\n \tassert(points_.size() >= 2);\n+\treturn 0;\n }\n \n void Pwl::append(double x, double y, const double eps)\ndiff --git a/src/ipa/raspberrypi/controller/pwl.h b/src/ipa/raspberrypi/controller/pwl.h\nindex 973efdf59945..ef1cc2ed113a 100644\n--- a/src/ipa/raspberrypi/controller/pwl.h\n+++ b/src/ipa/raspberrypi/controller/pwl.h\n@@ -57,7 +57,7 @@ public:\n \t};\n \tPwl() {}\n \tPwl(std::vector<Point> const &points) : points_(points) {}\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n \tvoid append(double x, double y, const double eps = 1e-6);\n \tvoid prepend(double x, double y, const double eps = 1e-6);\n \tInterval domain() const;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex adec8592626d..130c606d4136 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -30,7 +30,7 @@ LOG_DEFINE_CATEGORY(RPiAgc)\n \n static constexpr unsigned int PipelineBits = 13; /* seems to be a 13-bit pipeline */\n \n-void AgcMeteringMode::read(boost::property_tree::ptree const ¶ms)\n+int AgcMeteringMode::read(boost::property_tree::ptree const ¶ms)\n {\n \tint num = 0;\n \tfor (auto &p : params.get_child(\"weights\")) {\n@@ -40,6 +40,7 @@ void AgcMeteringMode::read(boost::property_tree::ptree const ¶ms)\n \t}\n \tif (num != AgcStatsSize)\n \t\tLOG(RPiAgc, Fatal) << \"AgcMeteringMode: insufficient weights\";\n+\treturn 0;\n }\n \n static std::string\n@@ -73,7 +74,7 @@ static int readList(std::vector<Duration> &list,\n \treturn list.size();\n }\n \n-void AgcExposureMode::read(boost::property_tree::ptree const ¶ms)\n+int AgcExposureMode::read(boost::property_tree::ptree const ¶ms)\n {\n \tint numShutters = readList(shutter, params.get_child(\"shutter\"));\n \tint numAgs = readList(gain, params.get_child(\"gain\"));\n@@ -83,6 +84,7 @@ void AgcExposureMode::read(boost::property_tree::ptree const ¶ms)\n \tif (numShutters != numAgs)\n \t\tLOG(RPiAgc, Fatal)\n \t\t\t<< \"AgcExposureMode: expect same number of exposure and gain entries in exposure profile\";\n+\treturn 0;\n }\n \n static std::string\n@@ -100,7 +102,7 @@ readExposureModes(std::map<std::string, AgcExposureMode> &exposureModes,\n \treturn first;\n }\n \n-void AgcConstraint::read(boost::property_tree::ptree const ¶ms)\n+int AgcConstraint::read(boost::property_tree::ptree const ¶ms)\n {\n \tstd::string boundString = params.get<std::string>(\"bound\", \"\");\n \ttransform(boundString.begin(), boundString.end(),\n@@ -110,7 +112,7 @@ void AgcConstraint::read(boost::property_tree::ptree const ¶ms)\n \tbound = boundString == \"UPPER\" ? Bound::UPPER : Bound::LOWER;\n \tqLo = params.get<double>(\"q_lo\");\n \tqHi = params.get<double>(\"q_hi\");\n-\tyTarget.read(params.get_child(\"y_target\"));\n+\treturn yTarget.read(params.get_child(\"y_target\"));\n }\n \n static AgcConstraintMode\n@@ -137,13 +139,17 @@ static std::string readConstraintModes(std::map<std::string, AgcConstraintMode>\n \treturn first;\n }\n \n-void AgcConfig::read(boost::property_tree::ptree const ¶ms)\n+int AgcConfig::read(boost::property_tree::ptree const ¶ms)\n {\n \tLOG(RPiAgc, Debug) << \"AgcConfig\";\n \tdefaultMeteringMode = readMeteringModes(meteringModes, params.get_child(\"metering_modes\"));\n \tdefaultExposureMode = readExposureModes(exposureModes, params.get_child(\"exposure_modes\"));\n \tdefaultConstraintMode = readConstraintModes(constraintModes, params.get_child(\"constraint_modes\"));\n-\tyTarget.read(params.get_child(\"y_target\"));\n+\n+\tint ret = yTarget.read(params.get_child(\"y_target\"));\n+\tif (ret)\n+\t\treturn ret;\n+\n \tspeed = params.get<double>(\"speed\", 0.2);\n \tstartupFrames = params.get<uint16_t>(\"startup_frames\", 10);\n \tconvergenceFrames = params.get<unsigned int>(\"convergence_frames\", 6);\n@@ -152,6 +158,7 @@ void AgcConfig::read(boost::property_tree::ptree const ¶ms)\n \t/* Start with quite a low value as ramping up is easier than ramping down. */\n \tdefaultExposureTime = params.get<double>(\"default_exposure_time\", 1000) * 1us;\n \tdefaultAnalogueGain = params.get<double>(\"default_analogueGain\", 1.0);\n+\treturn 0;\n }\n \n Agc::ExposureValues::ExposureValues()\n@@ -182,10 +189,14 @@ char const *Agc::name() const\n \treturn NAME;\n }\n \n-void Agc::read(boost::property_tree::ptree const ¶ms)\n+int Agc::read(boost::property_tree::ptree const ¶ms)\n {\n \tLOG(RPiAgc, Debug) << \"Agc\";\n-\tconfig_.read(params);\n+\n+\tint ret = config_.read(params);\n+\tif (ret)\n+\t\treturn ret;\n+\n \t/*\n \t * Set the config's defaults (which are the first ones it read) as our\n \t * current modes, until someone changes them. (they're all known to\n@@ -200,6 +211,7 @@ void Agc::read(boost::property_tree::ptree const ¶ms)\n \t/* Set up the \"last shutter/gain\" values, in case AGC starts \"disabled\". */\n \tstatus_.shutterTime = config_.defaultExposureTime;\n \tstatus_.analogueGain = config_.defaultAnalogueGain;\n+\treturn 0;\n }\n \n bool Agc::isPaused() const\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.h b/src/ipa/raspberrypi/controller/rpi/agc.h\nindex f57afa6dc80c..1351b0ee079c 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.h\n@@ -28,13 +28,13 @@ namespace RPiController {\n \n struct AgcMeteringMode {\n \tdouble weights[AgcStatsSize];\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n };\n \n struct AgcExposureMode {\n \tstd::vector<libcamera::utils::Duration> shutter;\n \tstd::vector<double> gain;\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n };\n \n struct AgcConstraint {\n@@ -43,13 +43,13 @@ struct AgcConstraint {\n \tdouble qLo;\n \tdouble qHi;\n \tPwl yTarget;\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n };\n \n typedef std::vector<AgcConstraint> AgcConstraintMode;\n \n struct AgcConfig {\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n \tstd::map<std::string, AgcMeteringMode> meteringModes;\n \tstd::map<std::string, AgcExposureMode> exposureModes;\n \tstd::map<std::string, AgcConstraintMode> constraintModes;\n@@ -74,7 +74,7 @@ class Agc : public AgcAlgorithm\n public:\n \tAgc(Controller *controller);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \t/* AGC handles \"pausing\" for itself. */\n \tbool isPaused() const override;\n \tvoid pause() override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex 03ae33501dc0..b36277696a52 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -50,7 +50,7 @@ char const *Alsc::name() const\n \treturn NAME;\n }\n \n-static void generateLut(double *lut, boost::property_tree::ptree const ¶ms)\n+static int generateLut(double *lut, boost::property_tree::ptree const ¶ms)\n {\n \tdouble cstrength = params.get<double>(\"corner_strength\", 2.0);\n \tif (cstrength <= 1.0)\n@@ -71,9 +71,10 @@ static void generateLut(double *lut, boost::property_tree::ptree const ¶ms)\n \t\t\t\t(f2 * f2); /* this reproduces the cos^4 rule */\n \t\t}\n \t}\n+\treturn 0;\n }\n \n-static void readLut(double *lut, boost::property_tree::ptree const ¶ms)\n+static int readLut(double *lut, boost::property_tree::ptree const ¶ms)\n {\n \tint num = 0;\n \tconst int maxNum = XY;\n@@ -84,11 +85,12 @@ static void readLut(double *lut, boost::property_tree::ptree const ¶ms)\n \t}\n \tif (num < maxNum)\n \t\tLOG(RPiAlsc, Fatal) << \"Alsc: too few entries in LSC table\";\n+\treturn 0;\n }\n \n-static void readCalibrations(std::vector<AlscCalibration> &calibrations,\n-\t\t\t boost::property_tree::ptree const ¶ms,\n-\t\t\t std::string const &name)\n+static int readCalibrations(std::vector<AlscCalibration> &calibrations,\n+\t\t\t boost::property_tree::ptree const ¶ms,\n+\t\t\t std::string const &name)\n {\n \tif (params.get_child_optional(name)) {\n \t\tdouble lastCt = 0;\n@@ -117,9 +119,10 @@ static void readCalibrations(std::vector<AlscCalibration> &calibrations,\n \t\t\t\t<< \"Read \" << name << \" calibration for ct \" << ct;\n \t\t}\n \t}\n+\treturn 0;\n }\n \n-void Alsc::read(boost::property_tree::ptree const ¶ms)\n+int Alsc::read(boost::property_tree::ptree const ¶ms)\n {\n \tconfig_.framePeriod = params.get<uint16_t>(\"frame_period\", 12);\n \tconfig_.startupFrames = params.get<uint16_t>(\"startup_frames\", 10);\n@@ -135,19 +138,32 @@ void Alsc::read(boost::property_tree::ptree const ¶ms)\n \t\tparams.get<double>(\"luminance_strength\", 1.0);\n \tfor (int i = 0; i < XY; i++)\n \t\tconfig_.luminanceLut[i] = 1.0;\n+\n+\tint ret = 0;\n+\n \tif (params.get_child_optional(\"corner_strength\"))\n-\t\tgenerateLut(config_.luminanceLut, params);\n+\t\tret = generateLut(config_.luminanceLut, params);\n \telse if (params.get_child_optional(\"luminance_lut\"))\n-\t\treadLut(config_.luminanceLut,\n-\t\t\tparams.get_child(\"luminance_lut\"));\n+\t\tret = readLut(config_.luminanceLut,\n+\t\t\t params.get_child(\"luminance_lut\"));\n \telse\n \t\tLOG(RPiAlsc, Warning)\n \t\t\t<< \"no luminance table - assume unity everywhere\";\n-\treadCalibrations(config_.calibrationsCr, params, \"calibrations_Cr\");\n-\treadCalibrations(config_.calibrationsCb, params, \"calibrations_Cb\");\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = readCalibrations(config_.calibrationsCr, params, \"calibrations_Cr\");\n+\tif (ret)\n+\t\treturn ret;\n+\tret = readCalibrations(config_.calibrationsCb, params, \"calibrations_Cb\");\n+\tif (ret)\n+\t\treturn ret;\n+\n \tconfig_.defaultCt = params.get<double>(\"default_ct\", 4500.0);\n \tconfig_.threshold = params.get<double>(\"threshold\", 1e-3);\n \tconfig_.lambdaBound = params.get<double>(\"lambda_bound\", 0.05);\n+\n+\treturn 0;\n }\n \n static double getCt(Metadata *metadata, double defaultCt);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.h b/src/ipa/raspberrypi/controller/rpi/alsc.h\nindex 4e9a715ae0ab..773fd338ea8e 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.h\n@@ -52,7 +52,7 @@ public:\n \tchar const *name() const override;\n \tvoid initialise() override;\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata) override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \tvoid process(StatisticsPtr &stats, Metadata *imageMetadata) override;\n \ndiff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp\nindex ad75d55f0976..a9e776a344a1 100644\n--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp\n@@ -26,20 +26,21 @@ static constexpr unsigned int AwbStatsSizeY = DEFAULT_AWB_REGIONS_Y;\n * elsewhere (ALSC and AGC).\n */\n \n-void AwbMode::read(boost::property_tree::ptree const ¶ms)\n+int AwbMode::read(boost::property_tree::ptree const ¶ms)\n {\n \tctLo = params.get<double>(\"lo\");\n \tctHi = params.get<double>(\"hi\");\n+\treturn 0;\n }\n \n-void AwbPrior::read(boost::property_tree::ptree const ¶ms)\n+int AwbPrior::read(boost::property_tree::ptree const ¶ms)\n {\n \tlux = params.get<double>(\"lux\");\n-\tprior.read(params.get_child(\"prior\"));\n+\treturn prior.read(params.get_child(\"prior\"));\n }\n \n-static void readCtCurve(Pwl &ctR, Pwl &ctB,\n-\t\t\tboost::property_tree::ptree const ¶ms)\n+static int readCtCurve(Pwl &ctR, Pwl &ctB,\n+\t\t boost::property_tree::ptree const ¶ms)\n {\n \tint num = 0;\n \tfor (auto it = params.begin(); it != params.end(); it++) {\n@@ -55,21 +56,28 @@ static void readCtCurve(Pwl &ctR, Pwl &ctB,\n \t}\n \tif (num < 2)\n \t\tLOG(RPiAwb, Fatal) << \"AwbConfig: insufficient points in CT curve\";\n+\treturn 0;\n }\n \n-void AwbConfig::read(boost::property_tree::ptree const ¶ms)\n+int AwbConfig::read(boost::property_tree::ptree const ¶ms)\n {\n+\tint ret;\n \tbayes = params.get<int>(\"bayes\", 1);\n \tframePeriod = params.get<uint16_t>(\"framePeriod\", 10);\n \tstartupFrames = params.get<uint16_t>(\"startupFrames\", 10);\n \tconvergenceFrames = params.get<unsigned int>(\"convergence_frames\", 3);\n \tspeed = params.get<double>(\"speed\", 0.05);\n-\tif (params.get_child_optional(\"ct_curve\"))\n-\t\treadCtCurve(ctR, ctB, params.get_child(\"ct_curve\"));\n+\tif (params.get_child_optional(\"ct_curve\")) {\n+\t\tret = readCtCurve(ctR, ctB, params.get_child(\"ct_curve\"));\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n \tif (params.get_child_optional(\"priors\")) {\n \t\tfor (auto &p : params.get_child(\"priors\")) {\n \t\t\tAwbPrior prior;\n-\t\t\tprior.read(p.second);\n+\t\t\tret = prior.read(p.second);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\tif (!priors.empty() && prior.lux <= priors.back().lux)\n \t\t\t\tLOG(RPiAwb, Fatal) << \"AwbConfig: Prior must be ordered in increasing lux value\";\n \t\t\tpriors.push_back(prior);\n@@ -79,7 +87,9 @@ void AwbConfig::read(boost::property_tree::ptree const ¶ms)\n \t}\n \tif (params.get_child_optional(\"modes\")) {\n \t\tfor (auto &p : params.get_child(\"modes\")) {\n-\t\t\tmodes[p.first].read(p.second);\n+\t\t\tret = modes[p.first].read(p.second);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\tif (defaultMode == nullptr)\n \t\t\t\tdefaultMode = &modes[p.first];\n \t\t}\n@@ -110,6 +120,7 @@ void AwbConfig::read(boost::property_tree::ptree const ¶ms)\n \twhitepointB = params.get<double>(\"whitepoint_b\", 0.0);\n \tif (bayes == false)\n \t\tsensitivityR = sensitivityB = 1.0; /* nor do sensitivities make any sense */\n+\treturn 0;\n }\n \n Awb::Awb(Controller *controller)\n@@ -137,9 +148,9 @@ char const *Awb::name() const\n \treturn NAME;\n }\n \n-void Awb::read(boost::property_tree::ptree const ¶ms)\n+int Awb::read(boost::property_tree::ptree const ¶ms)\n {\n-\tconfig_.read(params);\n+\treturn config_.read(params);\n }\n \n void Awb::initialise()\ndiff --git a/src/ipa/raspberrypi/controller/rpi/awb.h b/src/ipa/raspberrypi/controller/rpi/awb.h\nindex 9e075624c429..fa0715735fcf 100644\n--- a/src/ipa/raspberrypi/controller/rpi/awb.h\n+++ b/src/ipa/raspberrypi/controller/rpi/awb.h\n@@ -19,20 +19,20 @@ namespace RPiController {\n /* Control algorithm to perform AWB calculations. */\n \n struct AwbMode {\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n \tdouble ctLo; /* low CT value for search */\n \tdouble ctHi; /* high CT value for search */\n };\n \n struct AwbPrior {\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n \tdouble lux; /* lux level */\n \tPwl prior; /* maps CT to prior log likelihood for this lux level */\n };\n \n struct AwbConfig {\n \tAwbConfig() : defaultMode(nullptr) {}\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n \t/* Only repeat the AWB calculation every \"this many\" frames */\n \tuint16_t framePeriod;\n \t/* number of initial frames for which speed taken as 1.0 (maximum) */\n@@ -92,7 +92,7 @@ public:\n \t~Awb();\n \tchar const *name() const override;\n \tvoid initialise() override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \t/* AWB handles \"pausing\" for itself. */\n \tbool isPaused() const override;\n \tvoid pause() override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/black_level.cpp b/src/ipa/raspberrypi/controller/rpi/black_level.cpp\nindex 0799d7b9195a..aa6f602acd7d 100644\n--- a/src/ipa/raspberrypi/controller/rpi/black_level.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/black_level.cpp\n@@ -31,7 +31,7 @@ char const *BlackLevel::name() const\n \treturn NAME;\n }\n \n-void BlackLevel::read(boost::property_tree::ptree const ¶ms)\n+int BlackLevel::read(boost::property_tree::ptree const ¶ms)\n {\n \tuint16_t blackLevel = params.get<uint16_t>(\n \t\t\"black_level\", 4096); /* 64 in 10 bits scaled to 16 bits */\n@@ -42,6 +42,7 @@ void BlackLevel::read(boost::property_tree::ptree const ¶ms)\n \t\t<< \" Read black levels red \" << blackLevelR_\n \t\t<< \" green \" << blackLevelG_\n \t\t<< \" blue \" << blackLevelB_;\n+\treturn 0;\n }\n \n void BlackLevel::prepare(Metadata *imageMetadata)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/black_level.h b/src/ipa/raspberrypi/controller/rpi/black_level.h\nindex 7789f261cf03..6ec8c4f9ba8f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/black_level.h\n+++ b/src/ipa/raspberrypi/controller/rpi/black_level.h\n@@ -18,7 +18,7 @@ class BlackLevel : public Algorithm\n public:\n \tBlackLevel(Controller *controller);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \n private:\ndiff --git a/src/ipa/raspberrypi/controller/rpi/ccm.cpp b/src/ipa/raspberrypi/controller/rpi/ccm.cpp\nindex cf0c85d26cf9..f0110d38f548 100644\n--- a/src/ipa/raspberrypi/controller/rpi/ccm.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/ccm.cpp\n@@ -39,7 +39,7 @@ Matrix::Matrix(double m0, double m1, double m2, double m3, double m4, double m5,\n \tm[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4,\n \tm[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8;\n }\n-void Matrix::read(boost::property_tree::ptree const ¶ms)\n+int Matrix::read(boost::property_tree::ptree const ¶ms)\n {\n \tdouble *ptr = (double *)m;\n \tint n = 0;\n@@ -50,6 +50,7 @@ void Matrix::read(boost::property_tree::ptree const ¶ms)\n \t}\n \tif (n < 9)\n \t\tLOG(RPiCcm, Fatal) << \"Ccm: too few values in CCM\";\n+\treturn 0;\n }\n \n Ccm::Ccm(Controller *controller)\n@@ -60,21 +61,32 @@ char const *Ccm::name() const\n \treturn NAME;\n }\n \n-void Ccm::read(boost::property_tree::ptree const ¶ms)\n+int Ccm::read(boost::property_tree::ptree const ¶ms)\n {\n-\tif (params.get_child_optional(\"saturation\"))\n-\t\tconfig_.saturation.read(params.get_child(\"saturation\"));\n+\tint ret;\n+\n+\tif (params.get_child_optional(\"saturation\")) {\n+\t\tret = config_.saturation.read(params.get_child(\"saturation\"));\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \tfor (auto &p : params.get_child(\"ccms\")) {\n \t\tCtCcm ctCcm;\n \t\tctCcm.ct = p.second.get<double>(\"ct\");\n-\t\tctCcm.ccm.read(p.second.get_child(\"ccm\"));\n+\t\tret = ctCcm.ccm.read(p.second.get_child(\"ccm\"));\n+\t\tif (ret)\n+\t\t\treturn ret;\n \t\tif (!config_.ccms.empty() &&\n \t\t ctCcm.ct <= config_.ccms.back().ct)\n \t\t\tLOG(RPiCcm, Fatal) << \"Ccm: CCM not in increasing colour temperature order\";\n \t\tconfig_.ccms.push_back(std::move(ctCcm));\n \t}\n+\n \tif (config_.ccms.empty())\n \t\tLOG(RPiCcm, Fatal) << \"Ccm: no CCMs specified\";\n+\n+\treturn 0;\n }\n \n void Ccm::setSaturation(double saturation)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/ccm.h b/src/ipa/raspberrypi/controller/rpi/ccm.h\nindex b44f1576528f..6b65c7aea8a6 100644\n--- a/src/ipa/raspberrypi/controller/rpi/ccm.h\n+++ b/src/ipa/raspberrypi/controller/rpi/ccm.h\n@@ -20,7 +20,7 @@ struct Matrix {\n \t double m6, double m7, double m8);\n \tMatrix();\n \tdouble m[3][3];\n-\tvoid read(boost::property_tree::ptree const ¶ms);\n+\tint read(boost::property_tree::ptree const ¶ms);\n };\n static inline Matrix operator*(double d, Matrix const &m)\n {\n@@ -62,7 +62,7 @@ class Ccm : public CcmAlgorithm\n public:\n \tCcm(Controller *controller = NULL);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid setSaturation(double saturation) override;\n \tvoid initialise() override;\n \tvoid prepare(Metadata *imageMetadata) override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\nindex 9e60dc5d47e7..d76dc43b837f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n@@ -38,7 +38,7 @@ char const *Contrast::name() const\n \treturn NAME;\n }\n \n-void Contrast::read(boost::property_tree::ptree const ¶ms)\n+int Contrast::read(boost::property_tree::ptree const ¶ms)\n {\n \t/* enable adaptive enhancement by default */\n \tconfig_.ceEnable = params.get<int>(\"ce_enable\", 1);\n@@ -52,7 +52,7 @@ void Contrast::read(boost::property_tree::ptree const ¶ms)\n \tconfig_.hiHistogram = params.get<double>(\"hi_histogram\", 0.95);\n \tconfig_.hiLevel = params.get<double>(\"hi_level\", 0.95);\n \tconfig_.hiMax = params.get<double>(\"hi_max\", 2000);\n-\tconfig_.gammaCurve.read(params.get_child(\"gamma_curve\"));\n+\treturn config_.gammaCurve.read(params.get_child(\"gamma_curve\"));\n }\n \n void Contrast::setBrightness(double brightness)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.h b/src/ipa/raspberrypi/controller/rpi/contrast.h\nindex b1375d819dbc..5c3d2f56b310 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.h\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.h\n@@ -34,7 +34,7 @@ class Contrast : public ContrastAlgorithm\n public:\n \tContrast(Controller *controller = NULL);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid setBrightness(double brightness) override;\n \tvoid setContrast(double contrast) override;\n \tvoid initialise() override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/dpc.cpp b/src/ipa/raspberrypi/controller/rpi/dpc.cpp\nindex d5d784e7ca64..be014a05fd41 100644\n--- a/src/ipa/raspberrypi/controller/rpi/dpc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/dpc.cpp\n@@ -31,11 +31,12 @@ char const *Dpc::name() const\n \treturn NAME;\n }\n \n-void Dpc::read(boost::property_tree::ptree const ¶ms)\n+int Dpc::read(boost::property_tree::ptree const ¶ms)\n {\n \tconfig_.strength = params.get<int>(\"strength\", 1);\n \tif (config_.strength < 0 || config_.strength > 2)\n \t\tLOG(RPiDpc, Fatal) << \"Dpc: bad strength value\";\n+\treturn 0;\n }\n \n void Dpc::prepare(Metadata *imageMetadata)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/dpc.h b/src/ipa/raspberrypi/controller/rpi/dpc.h\nindex 4c1bdec6dd87..2bb6cef565a7 100644\n--- a/src/ipa/raspberrypi/controller/rpi/dpc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/dpc.h\n@@ -22,7 +22,7 @@ class Dpc : public Algorithm\n public:\n \tDpc(Controller *controller);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \n private:\ndiff --git a/src/ipa/raspberrypi/controller/rpi/geq.cpp b/src/ipa/raspberrypi/controller/rpi/geq.cpp\nindex 696da4aeea59..a74447877bf8 100644\n--- a/src/ipa/raspberrypi/controller/rpi/geq.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/geq.cpp\n@@ -35,14 +35,20 @@ char const *Geq::name() const\n \treturn NAME;\n }\n \n-void Geq::read(boost::property_tree::ptree const ¶ms)\n+int Geq::read(boost::property_tree::ptree const ¶ms)\n {\n \tconfig_.offset = params.get<uint16_t>(\"offset\", 0);\n \tconfig_.slope = params.get<double>(\"slope\", 0.0);\n \tif (config_.slope < 0.0 || config_.slope >= 1.0)\n \t\tLOG(RPiGeq, Fatal) << \"Geq: bad slope value\";\n-\tif (params.get_child_optional(\"strength\"))\n-\t\tconfig_.strength.read(params.get_child(\"strength\"));\n+\n+\tif (params.get_child_optional(\"strength\")) {\n+\t\tint ret = config_.strength.read(params.get_child(\"strength\"));\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n void Geq::prepare(Metadata *imageMetadata)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/geq.h b/src/ipa/raspberrypi/controller/rpi/geq.h\nindex 5d06b9cbd529..677a0510c6ac 100644\n--- a/src/ipa/raspberrypi/controller/rpi/geq.h\n+++ b/src/ipa/raspberrypi/controller/rpi/geq.h\n@@ -24,7 +24,7 @@ class Geq : public Algorithm\n public:\n \tGeq(Controller *controller);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \n private:\ndiff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp\nindex 95c0a93b2810..ca1e827191fd 100644\n--- a/src/ipa/raspberrypi/controller/rpi/lux.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp\n@@ -38,7 +38,7 @@ char const *Lux::name() const\n \treturn NAME;\n }\n \n-void Lux::read(boost::property_tree::ptree const ¶ms)\n+int Lux::read(boost::property_tree::ptree const ¶ms)\n {\n \treferenceShutterSpeed_ =\n \t\tparams.get<double>(\"reference_shutter_speed\") * 1.0us;\n@@ -47,6 +47,7 @@ void Lux::read(boost::property_tree::ptree const ¶ms)\n \treferenceY_ = params.get<double>(\"reference_Y\");\n \treferenceLux_ = params.get<double>(\"reference_lux\");\n \tcurrentAperture_ = referenceAperture_;\n+\treturn 0;\n }\n \n void Lux::setCurrentAperture(double aperture)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/lux.h b/src/ipa/raspberrypi/controller/rpi/lux.h\nindex 26af8185911c..6416dfb52553 100644\n--- a/src/ipa/raspberrypi/controller/rpi/lux.h\n+++ b/src/ipa/raspberrypi/controller/rpi/lux.h\n@@ -22,7 +22,7 @@ class Lux : public Algorithm\n public:\n \tLux(Controller *controller);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \tvoid process(StatisticsPtr &stats, Metadata *imageMetadata) override;\n \tvoid setCurrentAperture(double aperture);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/noise.cpp b/src/ipa/raspberrypi/controller/rpi/noise.cpp\nindex 5d2c85ad3e74..74fa99bafe48 100644\n--- a/src/ipa/raspberrypi/controller/rpi/noise.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/noise.cpp\n@@ -41,10 +41,11 @@ void Noise::switchMode(CameraMode const &cameraMode,\n \tmodeFactor_ = std::max(1.0, cameraMode.noiseFactor);\n }\n \n-void Noise::read(boost::property_tree::ptree const ¶ms)\n+int Noise::read(boost::property_tree::ptree const ¶ms)\n {\n \treferenceConstant_ = params.get<double>(\"reference_constant\");\n \treferenceSlope_ = params.get<double>(\"reference_slope\");\n+\treturn 0;\n }\n \n void Noise::prepare(Metadata *imageMetadata)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/noise.h b/src/ipa/raspberrypi/controller/rpi/noise.h\nindex 144e36529f4c..b33a5fc75ec7 100644\n--- a/src/ipa/raspberrypi/controller/rpi/noise.h\n+++ b/src/ipa/raspberrypi/controller/rpi/noise.h\n@@ -19,7 +19,7 @@ public:\n \tNoise(Controller *controller);\n \tchar const *name() const override;\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata) override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \n private:\ndiff --git a/src/ipa/raspberrypi/controller/rpi/sdn.cpp b/src/ipa/raspberrypi/controller/rpi/sdn.cpp\nindex af31bd0881f0..03d9f119a338 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sdn.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/sdn.cpp\n@@ -34,10 +34,11 @@ char const *Sdn::name() const\n \treturn NAME;\n }\n \n-void Sdn::read(boost::property_tree::ptree const ¶ms)\n+int Sdn::read(boost::property_tree::ptree const ¶ms)\n {\n \tdeviation_ = params.get<double>(\"deviation\", 3.2);\n \tstrength_ = params.get<double>(\"strength\", 0.75);\n+\treturn 0;\n }\n \n void Sdn::initialise()\ndiff --git a/src/ipa/raspberrypi/controller/rpi/sdn.h b/src/ipa/raspberrypi/controller/rpi/sdn.h\nindex 90ea37ff5550..4287ef08a79f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sdn.h\n+++ b/src/ipa/raspberrypi/controller/rpi/sdn.h\n@@ -18,7 +18,7 @@ class Sdn : public DenoiseAlgorithm\n public:\n \tSdn(Controller *controller = NULL);\n \tchar const *name() const override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid initialise() override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \tvoid setMode(DenoiseMode mode) override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\nindex 36b75f69afce..9c4cffa4128c 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\n@@ -37,7 +37,7 @@ void Sharpen::switchMode(CameraMode const &cameraMode,\n \tmodeFactor_ = std::max(1.0, cameraMode.noiseFactor);\n }\n \n-void Sharpen::read(boost::property_tree::ptree const ¶ms)\n+int Sharpen::read(boost::property_tree::ptree const ¶ms)\n {\n \tthreshold_ = params.get<double>(\"threshold\", 1.0);\n \tstrength_ = params.get<double>(\"strength\", 1.0);\n@@ -46,6 +46,7 @@ void Sharpen::read(boost::property_tree::ptree const ¶ms)\n \t\t<< \"Read threshold \" << threshold_\n \t\t<< \" strength \" << strength_\n \t\t<< \" limit \" << limit_;\n+\treturn 0;\n }\n \n void Sharpen::setStrength(double strength)\ndiff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.h b/src/ipa/raspberrypi/controller/rpi/sharpen.h\nindex 8846f2ae09a2..0cd8b92f2224 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sharpen.h\n+++ b/src/ipa/raspberrypi/controller/rpi/sharpen.h\n@@ -19,7 +19,7 @@ public:\n \tSharpen(Controller *controller);\n \tchar const *name() const override;\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata) override;\n-\tvoid read(boost::property_tree::ptree const ¶ms) override;\n+\tint read(boost::property_tree::ptree const ¶ms) override;\n \tvoid setStrength(double strength) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 9d550354d78e..b9e9b814e886 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -229,7 +229,14 @@ int IPARPi::init(const IPASettings &settings, IPAInitResult *result)\n \tresult->sensorConfig.sensorMetadata = sensorMetadata;\n \n \t/* Load the tuning file for this sensor. */\n-\tcontroller_.read(settings.configurationFile.c_str());\n+\tint ret = controller_.read(settings.configurationFile.c_str());\n+\tif (ret) {\n+\t\tLOG(IPARPI, Error)\n+\t\t\t<< \"Failed to load tuning data file \"\n+\t\t\t<< settings.configurationFile;\n+\t\treturn ret;\n+\t}\n+\n \tcontroller_.initialise();\n \n \t/* Return the controls handled by the IPA */\n", "prefixes": [ "libcamera-devel", "v7", "05/14" ] }