summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/controller.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-18 09:15:58 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-28 13:47:50 +0300
commitc1597f989654618f782012104f547b367082fa3e (patch)
tree7cbf0a2ff11609d0dbe60d145711f67a0f606ff6 /src/ipa/raspberrypi/controller/controller.cpp
parent735f0ffeaac736f91c35774e575b1280ba868d69 (diff)
ipa: raspberrypi: Use YamlParser to replace dependency on boost
The Raspberry Pi IPA module depends on boost only to parse the JSON tuning data files. As libcamera depends on libyaml, use the YamlParser class to parse those files and drop the dependency on boost. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/controller.cpp')
-rw-r--r--src/ipa/raspberrypi/controller/controller.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp
index d91ac907..bceb6254 100644
--- a/src/ipa/raspberrypi/controller/controller.cpp
+++ b/src/ipa/raspberrypi/controller/controller.cpp
@@ -5,14 +5,16 @@
* controller.cpp - ISP controller
*/
+#include <assert.h>
+
+#include <libcamera/base/file.h>
#include <libcamera/base/log.h>
+#include "libcamera/internal/yaml_parser.h"
+
#include "algorithm.h"
#include "controller.h"
-#include <boost/property_tree/json_parser.hpp>
-#include <boost/property_tree/ptree.hpp>
-
using namespace RPiController;
using namespace libcamera;
@@ -34,18 +36,25 @@ Controller::~Controller() {}
int Controller::read(char const *filename)
{
- boost::property_tree::ptree root;
- boost::property_tree::read_json(filename, root);
- for (auto const &keyAndValue : root) {
- Algorithm *algo = createAlgorithm(keyAndValue.first.c_str());
+ File file(filename);
+ if (!file.open(File::OpenModeFlag::ReadOnly)) {
+ LOG(RPiController, Warning)
+ << "Failed to open tuning file '" << filename << "'";
+ return -EINVAL;
+ }
+
+ std::unique_ptr<YamlObject> root = YamlParser::parse(file);
+
+ for (auto const &[key, value] : root->asDict()) {
+ Algorithm *algo = createAlgorithm(key.c_str());
if (algo) {
- int ret = algo->read(keyAndValue.second);
+ int ret = algo->read(value);
if (ret)
return ret;
algorithms_.push_back(AlgorithmPtr(algo));
} else
LOG(RPiController, Warning)
- << "No algorithm found for \"" << keyAndValue.first << "\"";
+ << "No algorithm found for \"" << key << "\"";
}
return 0;