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>
This commit is contained in:
Laurent Pinchart 2022-07-18 09:15:58 +01:00
parent 735f0ffeaa
commit c1597f9896
32 changed files with 375 additions and 278 deletions

View file

@ -71,12 +71,6 @@ for improved debugging: [optional]
information, and libunwind is not needed if both libdw and the glibc information, and libunwind is not needed if both libdw and the glibc
backtrace() function are available. backtrace() function are available.
for the Raspberry Pi IPA: [optional]
libboost-dev
Support for Raspberry Pi can be disabled through the meson
'pipelines' option to avoid this dependency.
for device hotplug enumeration: [optional] for device hotplug enumeration: [optional]
libudev-dev libudev-dev

View file

@ -9,7 +9,7 @@
using namespace RPiController; using namespace RPiController;
int Algorithm::read([[maybe_unused]] boost::property_tree::ptree const &params) int Algorithm::read([[maybe_unused]] const libcamera::YamlObject &params)
{ {
return 0; return 0;
} }

View file

@ -15,9 +15,9 @@
#include <memory> #include <memory>
#include <map> #include <map>
#include "controller.h" #include "libcamera/internal/yaml_parser.h"
#include <boost/property_tree/ptree.hpp> #include "controller.h"
namespace RPiController { namespace RPiController {
@ -35,7 +35,7 @@ public:
virtual bool isPaused() const { return paused_; } virtual bool isPaused() const { return paused_; }
virtual void pause() { paused_ = true; } virtual void pause() { paused_ = true; }
virtual void resume() { paused_ = false; } virtual void resume() { paused_ = false; }
virtual int read(boost::property_tree::ptree const &params); virtual int read(const libcamera::YamlObject &params);
virtual void initialise(); virtual void initialise();
virtual void switchMode(CameraMode const &cameraMode, Metadata *metadata); virtual void switchMode(CameraMode const &cameraMode, Metadata *metadata);
virtual void prepare(Metadata *imageMetadata); virtual void prepare(Metadata *imageMetadata);

View file

@ -5,14 +5,16 @@
* controller.cpp - ISP controller * controller.cpp - ISP controller
*/ */
#include <assert.h>
#include <libcamera/base/file.h>
#include <libcamera/base/log.h> #include <libcamera/base/log.h>
#include "libcamera/internal/yaml_parser.h"
#include "algorithm.h" #include "algorithm.h"
#include "controller.h" #include "controller.h"
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
using namespace RPiController; using namespace RPiController;
using namespace libcamera; using namespace libcamera;
@ -34,18 +36,25 @@ Controller::~Controller() {}
int Controller::read(char const *filename) int Controller::read(char const *filename)
{ {
boost::property_tree::ptree root; File file(filename);
boost::property_tree::read_json(filename, root); if (!file.open(File::OpenModeFlag::ReadOnly)) {
for (auto const &keyAndValue : root) { LOG(RPiController, Warning)
Algorithm *algo = createAlgorithm(keyAndValue.first.c_str()); << "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) { if (algo) {
int ret = algo->read(keyAndValue.second); int ret = algo->read(value);
if (ret) if (ret)
return ret; return ret;
algorithms_.push_back(AlgorithmPtr(algo)); algorithms_.push_back(AlgorithmPtr(algo));
} else } else
LOG(RPiController, Warning) LOG(RPiController, Warning)
<< "No algorithm found for \"" << keyAndValue.first << "\""; << "No algorithm found for \"" << key << "\"";
} }
return 0; return 0;

View file

@ -12,16 +12,27 @@
using namespace RPiController; using namespace RPiController;
int Pwl::read(boost::property_tree::ptree const &params) int Pwl::read(const libcamera::YamlObject &params)
{ {
for (auto it = params.begin(); it != params.end(); it++) { if (!params.size() || params.size() % 2)
double x = it->second.get_value<double>(); return -EINVAL;
assert(it == params.begin() || x > points_.back().x);
it++; const auto &list = params.asList();
double y = it->second.get_value<double>();
points_.push_back(Point(x, y)); for (auto it = list.begin(); it != list.end(); it++) {
auto x = it->get<double>();
if (!x)
return -EINVAL;
if (it != list.begin() && *x <= points_.back().x)
return -EINVAL;
auto y = (++it)->get<double>();
if (!y)
return -EINVAL;
points_.push_back(Point(*x, *y));
} }
assert(points_.size() >= 2);
return 0; return 0;
} }

View file

@ -9,7 +9,7 @@
#include <math.h> #include <math.h>
#include <vector> #include <vector>
#include <boost/property_tree/ptree.hpp> #include "libcamera/internal/yaml_parser.h"
namespace RPiController { namespace RPiController {
@ -57,7 +57,7 @@ public:
}; };
Pwl() {} Pwl() {}
Pwl(std::vector<Point> const &points) : points_(points) {} Pwl(std::vector<Point> const &points) : points_(points) {}
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
void append(double x, double y, const double eps = 1e-6); void append(double x, double y, const double eps = 1e-6);
void prepend(double x, double y, const double eps = 1e-6); void prepend(double x, double y, const double eps = 1e-6);
Interval domain() const; Interval domain() const;

View file

@ -31,67 +31,76 @@ LOG_DEFINE_CATEGORY(RPiAgc)
static constexpr unsigned int PipelineBits = 13; /* seems to be a 13-bit pipeline */ static constexpr unsigned int PipelineBits = 13; /* seems to be a 13-bit pipeline */
int AgcMeteringMode::read(boost::property_tree::ptree const &params) int AgcMeteringMode::read(const libcamera::YamlObject &params)
{ {
int num = 0; const YamlObject &yamlWeights = params["weights"];
if (yamlWeights.size() != AgcStatsSize) {
for (auto &p : params.get_child("weights")) { LOG(RPiAgc, Error) << "AgcMeteringMode: Incorrect number of weights";
if (num == AgcStatsSize) { return -EINVAL;
LOG(RPiAgc, Error) << "AgcMeteringMode: too many weights";
return -EINVAL;
}
weights[num++] = p.second.get_value<double>();
} }
if (num != AgcStatsSize) { unsigned int num = 0;
LOG(RPiAgc, Error) << "AgcMeteringMode: insufficient weights"; for (const auto &p : yamlWeights.asList()) {
return -EINVAL; auto value = p.get<double>();
if (!value)
return -EINVAL;
weights[num++] = *value;
} }
return 0; return 0;
} }
static std::tuple<int, std::string> static std::tuple<int, std::string>
readMeteringModes(std::map<std::string, AgcMeteringMode> &meteringModes, readMeteringModes(std::map<std::string, AgcMeteringMode> &metering_modes,
boost::property_tree::ptree const &params) const libcamera::YamlObject &params)
{ {
std::string first; std::string first;
int ret; int ret;
for (auto &p : params) { for (const auto &[key, value] : params.asDict()) {
AgcMeteringMode meteringMode; AgcMeteringMode meteringMode;
ret = meteringMode.read(p.second); ret = meteringMode.read(value);
if (ret) if (ret)
return { ret, {} }; return { ret, {} };
meteringModes[p.first] = std::move(meteringMode); metering_modes[key] = std::move(meteringMode);
if (first.empty()) if (first.empty())
first = p.first; first = key;
} }
return { 0, first }; return { 0, first };
} }
static int readList(std::vector<double> &list, static int readList(std::vector<double> &list,
boost::property_tree::ptree const &params) const libcamera::YamlObject &params)
{ {
for (auto &p : params) for (const auto &p : params.asList()) {
list.push_back(p.second.get_value<double>()); auto value = p.get<double>();
if (!value)
return -EINVAL;
list.push_back(*value);
}
return list.size(); return list.size();
} }
static int readList(std::vector<Duration> &list, static int readList(std::vector<Duration> &list,
boost::property_tree::ptree const &params) const libcamera::YamlObject &params)
{ {
for (auto &p : params) for (const auto &p : params.asList()) {
list.push_back(p.second.get_value<double>() * 1us); auto value = p.get<double>();
if (!value)
return -EINVAL;
list.push_back(*value * 1us);
}
return list.size(); return list.size();
} }
int AgcExposureMode::read(boost::property_tree::ptree const &params) int AgcExposureMode::read(const libcamera::YamlObject &params)
{ {
int numShutters = readList(shutter, params.get_child("shutter")); int numShutters = readList(shutter, params["shutter"]);
int numAgs = readList(gain, params.get_child("gain")); int numAgs = readList(gain, params["gain"]);
if (numShutters < 2 || numAgs < 2) { if (numShutters < 2 || numAgs < 2) {
LOG(RPiAgc, Error) LOG(RPiAgc, Error)
@ -110,28 +119,28 @@ int AgcExposureMode::read(boost::property_tree::ptree const &params)
static std::tuple<int, std::string> static std::tuple<int, std::string>
readExposureModes(std::map<std::string, AgcExposureMode> &exposureModes, readExposureModes(std::map<std::string, AgcExposureMode> &exposureModes,
boost::property_tree::ptree const &params) const libcamera::YamlObject &params)
{ {
std::string first; std::string first;
int ret; int ret;
for (auto &p : params) { for (const auto &[key, value] : params.asDict()) {
AgcExposureMode exposureMode; AgcExposureMode exposureMode;
ret = exposureMode.read(p.second); ret = exposureMode.read(value);
if (ret) if (ret)
return { ret, {} }; return { ret, {} };
exposureModes[p.first] = std::move(exposureMode); exposureModes[key] = std::move(exposureMode);
if (first.empty()) if (first.empty())
first = p.first; first = key;
} }
return { 0, first }; return { 0, first };
} }
int AgcConstraint::read(boost::property_tree::ptree const &params) int AgcConstraint::read(const libcamera::YamlObject &params)
{ {
std::string boundString = params.get<std::string>("bound", ""); std::string boundString = params["bound"].get<std::string>("");
transform(boundString.begin(), boundString.end(), transform(boundString.begin(), boundString.end(),
boundString.begin(), ::toupper); boundString.begin(), ::toupper);
if (boundString != "UPPER" && boundString != "LOWER") { if (boundString != "UPPER" && boundString != "LOWER") {
@ -139,20 +148,29 @@ int AgcConstraint::read(boost::property_tree::ptree const &params)
return -EINVAL; return -EINVAL;
} }
bound = boundString == "UPPER" ? Bound::UPPER : Bound::LOWER; bound = boundString == "UPPER" ? Bound::UPPER : Bound::LOWER;
qLo = params.get<double>("q_lo");
qHi = params.get<double>("q_hi"); auto value = params["q_lo"].get<double>();
return yTarget.read(params.get_child("y_target")); if (!value)
return -EINVAL;
qLo = *value;
value = params["q_hi"].get<double>();
if (!value)
return -EINVAL;
qHi = *value;
return yTarget.read(params["y_target"]);
} }
static std::tuple<int, AgcConstraintMode> static std::tuple<int, AgcConstraintMode>
readConstraintMode(boost::property_tree::ptree const &params) readConstraintMode(const libcamera::YamlObject &params)
{ {
AgcConstraintMode mode; AgcConstraintMode mode;
int ret; int ret;
for (auto &p : params) { for (const auto &p : params.asList()) {
AgcConstraint constraint; AgcConstraint constraint;
ret = constraint.read(p.second); ret = constraint.read(p);
if (ret) if (ret)
return { ret, {} }; return { ret, {} };
@ -164,53 +182,55 @@ readConstraintMode(boost::property_tree::ptree const &params)
static std::tuple<int, std::string> static std::tuple<int, std::string>
readConstraintModes(std::map<std::string, AgcConstraintMode> &constraintModes, readConstraintModes(std::map<std::string, AgcConstraintMode> &constraintModes,
boost::property_tree::ptree const &params) const libcamera::YamlObject &params)
{ {
std::string first; std::string first;
int ret; int ret;
for (auto &p : params) { for (const auto &[key, value] : params.asDict()) {
std::tie(ret, constraintModes[p.first]) = readConstraintMode(p.second); std::tie(ret, constraintModes[key]) = readConstraintMode(value);
if (ret) if (ret)
return { ret, {} }; return { ret, {} };
if (first.empty()) if (first.empty())
first = p.first; first = key;
} }
return { 0, first }; return { 0, first };
} }
int AgcConfig::read(boost::property_tree::ptree const &params) int AgcConfig::read(const libcamera::YamlObject &params)
{ {
LOG(RPiAgc, Debug) << "AgcConfig"; LOG(RPiAgc, Debug) << "AgcConfig";
int ret; int ret;
std::tie(ret, defaultMeteringMode) = std::tie(ret, defaultMeteringMode) =
readMeteringModes(meteringModes, params.get_child("metering_modes")); readMeteringModes(meteringModes, params["metering_modes"]);
if (ret) if (ret)
return ret; return ret;
std::tie(ret, defaultExposureMode) = std::tie(ret, defaultExposureMode) =
readExposureModes(exposureModes, params.get_child("exposure_modes")); readExposureModes(exposureModes, params["exposure_modes"]);
if (ret) if (ret)
return ret; return ret;
std::tie(ret, defaultConstraintMode) = std::tie(ret, defaultConstraintMode) =
readConstraintModes(constraintModes, params.get_child("constraint_modes")); readConstraintModes(constraintModes, params["constraint_modes"]);
if (ret) if (ret)
return ret; return ret;
ret = yTarget.read(params.get_child("y_target")); ret = yTarget.read(params["y_target"]);
if (ret) if (ret)
return ret; return ret;
speed = params.get<double>("speed", 0.2); speed = params["speed"].get<double>(0.2);
startupFrames = params.get<uint16_t>("startup_frames", 10); startupFrames = params["startup_frames"].get<uint16_t>(10);
convergenceFrames = params.get<unsigned int>("convergence_frames", 6); convergenceFrames = params["convergence_frames"].get<unsigned int>(6);
fastReduceThreshold = params.get<double>("fast_reduce_threshold", 0.4); fastReduceThreshold = params["fast_reduce_threshold"].get<double>(0.4);
baseEv = params.get<double>("base_ev", 1.0); baseEv = params["base_ev"].get<double>(1.0);
/* Start with quite a low value as ramping up is easier than ramping down. */ /* Start with quite a low value as ramping up is easier than ramping down. */
defaultExposureTime = params.get<double>("default_exposure_time", 1000) * 1us; defaultExposureTime = params["default_exposure_time"].get<double>(1000) * 1us;
defaultAnalogueGain = params.get<double>("default_analogueGain", 1.0); defaultAnalogueGain = params["default_analogue_gain"].get<double>(1.0);
return 0; return 0;
} }
@ -242,7 +262,7 @@ char const *Agc::name() const
return NAME; return NAME;
} }
int Agc::read(boost::property_tree::ptree const &params) int Agc::read(const libcamera::YamlObject &params)
{ {
LOG(RPiAgc, Debug) << "Agc"; LOG(RPiAgc, Debug) << "Agc";

View file

@ -28,13 +28,13 @@ namespace RPiController {
struct AgcMeteringMode { struct AgcMeteringMode {
double weights[AgcStatsSize]; double weights[AgcStatsSize];
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
}; };
struct AgcExposureMode { struct AgcExposureMode {
std::vector<libcamera::utils::Duration> shutter; std::vector<libcamera::utils::Duration> shutter;
std::vector<double> gain; std::vector<double> gain;
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
}; };
struct AgcConstraint { struct AgcConstraint {
@ -43,13 +43,13 @@ struct AgcConstraint {
double qLo; double qLo;
double qHi; double qHi;
Pwl yTarget; Pwl yTarget;
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
}; };
typedef std::vector<AgcConstraint> AgcConstraintMode; typedef std::vector<AgcConstraint> AgcConstraintMode;
struct AgcConfig { struct AgcConfig {
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
std::map<std::string, AgcMeteringMode> meteringModes; std::map<std::string, AgcMeteringMode> meteringModes;
std::map<std::string, AgcExposureMode> exposureModes; std::map<std::string, AgcExposureMode> exposureModes;
std::map<std::string, AgcConstraintMode> constraintModes; std::map<std::string, AgcConstraintMode> constraintModes;
@ -74,7 +74,7 @@ class Agc : public AgcAlgorithm
public: public:
Agc(Controller *controller); Agc(Controller *controller);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
/* AGC handles "pausing" for itself. */ /* AGC handles "pausing" for itself. */
bool isPaused() const override; bool isPaused() const override;
void pause() override; void pause() override;

View file

@ -5,6 +5,7 @@
* alsc.cpp - ALSC (auto lens shading correction) control algorithm * alsc.cpp - ALSC (auto lens shading correction) control algorithm
*/ */
#include <functional>
#include <math.h> #include <math.h>
#include <numeric> #include <numeric>
@ -50,15 +51,15 @@ char const *Alsc::name() const
return NAME; return NAME;
} }
static int generateLut(double *lut, boost::property_tree::ptree const &params) static int generateLut(double *lut, const libcamera::YamlObject &params)
{ {
double cstrength = params.get<double>("corner_strength", 2.0); double cstrength = params["corner_strength"].get<double>(2.0);
if (cstrength <= 1.0) { if (cstrength <= 1.0) {
LOG(RPiAlsc, Error) << "corner_strength must be > 1.0"; LOG(RPiAlsc, Error) << "corner_strength must be > 1.0";
return -EINVAL; return -EINVAL;
} }
double asymmetry = params.get<double>("asymmetry", 1.0); double asymmetry = params["asymmetry"].get<double>(1.0);
if (asymmetry < 0) { if (asymmetry < 0) {
LOG(RPiAlsc, Error) << "asymmetry must be >= 0"; LOG(RPiAlsc, Error) << "asymmetry must be >= 0";
return -EINVAL; return -EINVAL;
@ -80,34 +81,35 @@ static int generateLut(double *lut, boost::property_tree::ptree const &params)
return 0; return 0;
} }
static int readLut(double *lut, boost::property_tree::ptree const &params) static int readLut(double *lut, const libcamera::YamlObject &params)
{ {
int num = 0; if (params.size() != XY) {
const int maxNum = XY; LOG(RPiAlsc, Error) << "Invalid number of entries in LSC table";
for (auto &p : params) {
if (num == maxNum) {
LOG(RPiAlsc, Error) << "Too many entries in LSC table";
return -EINVAL;
}
lut[num++] = p.second.get_value<double>();
}
if (num < maxNum) {
LOG(RPiAlsc, Error) << "Too few entries in LSC table";
return -EINVAL; return -EINVAL;
} }
int num = 0;
for (const auto &p : params.asList()) {
auto value = p.get<double>();
if (!value)
return -EINVAL;
lut[num++] = *value;
}
return 0; return 0;
} }
static int readCalibrations(std::vector<AlscCalibration> &calibrations, static int readCalibrations(std::vector<AlscCalibration> &calibrations,
boost::property_tree::ptree const &params, const libcamera::YamlObject &params,
std::string const &name) std::string const &name)
{ {
if (params.get_child_optional(name)) { if (params.contains(name)) {
double lastCt = 0; double lastCt = 0;
for (auto &p : params.get_child(name)) { for (const auto &p : params[name].asList()) {
double ct = p.second.get<double>("ct"); auto value = p["ct"].get<double>();
if (!value)
return -EINVAL;
double ct = *value;
if (ct <= lastCt) { if (ct <= lastCt) {
LOG(RPiAlsc, Error) LOG(RPiAlsc, Error)
<< "Entries in " << name << " must be in increasing ct order"; << "Entries in " << name << " must be in increasing ct order";
@ -115,23 +117,23 @@ static int readCalibrations(std::vector<AlscCalibration> &calibrations,
} }
AlscCalibration calibration; AlscCalibration calibration;
calibration.ct = lastCt = ct; calibration.ct = lastCt = ct;
boost::property_tree::ptree const &table =
p.second.get_child("table"); const libcamera::YamlObject &table = p["table"];
int num = 0; if (table.size() != XY) {
for (auto it = table.begin(); it != table.end(); it++) {
if (num == XY) {
LOG(RPiAlsc, Error)
<< "Too many values for ct " << ct << " in " << name;
return -EINVAL;
}
calibration.table[num++] =
it->second.get_value<double>();
}
if (num != XY) {
LOG(RPiAlsc, Error) LOG(RPiAlsc, Error)
<< "Too few values for ct " << ct << " in " << name; << "Incorrect number of values for ct "
<< ct << " in " << name;
return -EINVAL; return -EINVAL;
} }
int num = 0;
for (const auto &elem : table.asList()) {
value = elem.get<double>();
if (!value)
return -EINVAL;
calibration.table[num++] = *value;
}
calibrations.push_back(calibration); calibrations.push_back(calibration);
LOG(RPiAlsc, Debug) LOG(RPiAlsc, Debug)
<< "Read " << name << " calibration for ct " << ct; << "Read " << name << " calibration for ct " << ct;
@ -140,30 +142,29 @@ static int readCalibrations(std::vector<AlscCalibration> &calibrations,
return 0; return 0;
} }
int Alsc::read(boost::property_tree::ptree const &params) int Alsc::read(const libcamera::YamlObject &params)
{ {
config_.framePeriod = params.get<uint16_t>("frame_period", 12); config_.framePeriod = params["frame_period"].get<uint16_t>(12);
config_.startupFrames = params.get<uint16_t>("startup_frames", 10); config_.startupFrames = params["startup_frames"].get<uint16_t>(10);
config_.speed = params.get<double>("speed", 0.05); config_.speed = params["speed"].get<double>(0.05);
double sigma = params.get<double>("sigma", 0.01); double sigma = params["sigma"].get<double>(0.01);
config_.sigmaCr = params.get<double>("sigma_Cr", sigma); config_.sigmaCr = params["sigma_Cr"].get<double>(sigma);
config_.sigmaCb = params.get<double>("sigma_Cb", sigma); config_.sigmaCb = params["sigma_Cb"].get<double>(sigma);
config_.minCount = params.get<double>("min_count", 10.0); config_.minCount = params["min_count"].get<double>(10.0);
config_.minG = params.get<uint16_t>("min_G", 50); config_.minG = params["min_G"].get<uint16_t>(50);
config_.omega = params.get<double>("omega", 1.3); config_.omega = params["omega"].get<double>(1.3);
config_.nIter = params.get<uint32_t>("n_iter", X + Y); config_.nIter = params["n_iter"].get<uint32_t>(X + Y);
config_.luminanceStrength = config_.luminanceStrength =
params.get<double>("luminance_strength", 1.0); params["luminance_strength"].get<double>(1.0);
for (int i = 0; i < XY; i++) for (int i = 0; i < XY; i++)
config_.luminanceLut[i] = 1.0; config_.luminanceLut[i] = 1.0;
int ret = 0; int ret = 0;
if (params.get_child_optional("corner_strength")) if (params.contains("corner_strength"))
ret = generateLut(config_.luminanceLut, params); ret = generateLut(config_.luminanceLut, params);
else if (params.get_child_optional("luminance_lut")) else if (params.contains("luminance_lut"))
ret = readLut(config_.luminanceLut, ret = readLut(config_.luminanceLut, params["luminance_lut"]);
params.get_child("luminance_lut"));
else else
LOG(RPiAlsc, Warning) LOG(RPiAlsc, Warning)
<< "no luminance table - assume unity everywhere"; << "no luminance table - assume unity everywhere";
@ -177,9 +178,9 @@ int Alsc::read(boost::property_tree::ptree const &params)
if (ret) if (ret)
return ret; return ret;
config_.defaultCt = params.get<double>("default_ct", 4500.0); config_.defaultCt = params["default_ct"].get<double>(4500.0);
config_.threshold = params.get<double>("threshold", 1e-3); config_.threshold = params["threshold"].get<double>(1e-3);
config_.lambdaBound = params.get<double>("lambda_bound", 0.05); config_.lambdaBound = params["lambda_bound"].get<double>(0.05);
return 0; return 0;
} }

View file

@ -52,7 +52,7 @@ public:
char const *name() const override; char const *name() const override;
void initialise() override; void initialise() override;
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override; void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
void process(StatisticsPtr &stats, Metadata *imageMetadata) override; void process(StatisticsPtr &stats, Metadata *imageMetadata) override;

View file

@ -5,6 +5,8 @@
* awb.cpp - AWB control algorithm * awb.cpp - AWB control algorithm
*/ */
#include <assert.h>
#include <libcamera/base/log.h> #include <libcamera/base/log.h>
#include "../lux_status.h" #include "../lux_status.h"
@ -26,62 +28,87 @@ static constexpr unsigned int AwbStatsSizeY = DEFAULT_AWB_REGIONS_Y;
* elsewhere (ALSC and AGC). * elsewhere (ALSC and AGC).
*/ */
int AwbMode::read(boost::property_tree::ptree const &params) int AwbMode::read(const libcamera::YamlObject &params)
{ {
ctLo = params.get<double>("lo"); auto value = params["lo"].get<double>();
ctHi = params.get<double>("hi"); if (!value)
return -EINVAL;
ctLo = *value;
value = params["hi"].get<double>();
if (!value)
return -EINVAL;
ctHi = *value;
return 0; return 0;
} }
int AwbPrior::read(boost::property_tree::ptree const &params) int AwbPrior::read(const libcamera::YamlObject &params)
{ {
lux = params.get<double>("lux"); auto value = params["lux"].get<double>();
return prior.read(params.get_child("prior")); if (!value)
return -EINVAL;
lux = *value;
return prior.read(params["prior"]);
} }
static int readCtCurve(Pwl &ctR, Pwl &ctB, static int readCtCurve(Pwl &ctR, Pwl &ctB, const libcamera::YamlObject &params)
boost::property_tree::ptree const &params)
{ {
int num = 0; if (params.size() % 3) {
for (auto it = params.begin(); it != params.end(); it++) { LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry";
double ct = it->second.get_value<double>(); return -EINVAL;
assert(it == params.begin() || ct != ctR.domain().end);
if (++it == params.end()) {
LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry";
return -EINVAL;
}
ctR.append(ct, it->second.get_value<double>());
if (++it == params.end()) {
LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry";
return -EINVAL;
}
ctB.append(ct, it->second.get_value<double>());
num++;
} }
if (num < 2) {
if (params.size() < 6) {
LOG(RPiAwb, Error) << "AwbConfig: insufficient points in CT curve"; LOG(RPiAwb, Error) << "AwbConfig: insufficient points in CT curve";
return -EINVAL; return -EINVAL;
} }
const auto &list = params.asList();
for (auto it = list.begin(); it != list.end(); it++) {
auto value = it->get<double>();
if (!value)
return -EINVAL;
double ct = *value;
assert(it == list.begin() || ct != ctR.domain().end);
value = (++it)->get<double>();
if (!value)
return -EINVAL;
ctR.append(ct, *value);
value = (++it)->get<double>();
if (!value)
return -EINVAL;
ctB.append(ct, *value);
}
return 0; return 0;
} }
int AwbConfig::read(boost::property_tree::ptree const &params) int AwbConfig::read(const libcamera::YamlObject &params)
{ {
int ret; int ret;
bayes = params.get<int>("bayes", 1);
framePeriod = params.get<uint16_t>("framePeriod", 10); bayes = params["bayes"].get<int>(1);
startupFrames = params.get<uint16_t>("startupFrames", 10); framePeriod = params["frame_period"].get<uint16_t>(10);
convergenceFrames = params.get<unsigned int>("convergence_frames", 3); startupFrames = params["startup_frames"].get<uint16_t>(10);
speed = params.get<double>("speed", 0.05); convergenceFrames = params["convergence_frames"].get<unsigned int>(3);
if (params.get_child_optional("ct_curve")) { speed = params["speed"].get<double>(0.05);
ret = readCtCurve(ctR, ctB, params.get_child("ct_curve"));
if (params.contains("ct_curve")) {
ret = readCtCurve(ctR, ctB, params["ct_curve"]);
if (ret) if (ret)
return ret; return ret;
} }
if (params.get_child_optional("priors")) {
for (auto &p : params.get_child("priors")) { if (params.contains("priors")) {
for (const auto &p : params["priors"].asList()) {
AwbPrior prior; AwbPrior prior;
ret = prior.read(p.second); ret = prior.read(p);
if (ret) if (ret)
return ret; return ret;
if (!priors.empty() && prior.lux <= priors.back().lux) { if (!priors.empty() && prior.lux <= priors.back().lux) {
@ -95,32 +122,35 @@ int AwbConfig::read(boost::property_tree::ptree const &params)
return ret; return ret;
} }
} }
if (params.get_child_optional("modes")) { if (params.contains("modes")) {
for (auto &p : params.get_child("modes")) { for (const auto &[key, value] : params["modes"].asDict()) {
ret = modes[p.first].read(p.second); ret = modes[key].read(value);
if (ret) if (ret)
return ret; return ret;
if (defaultMode == nullptr) if (defaultMode == nullptr)
defaultMode = &modes[p.first]; defaultMode = &modes[key];
} }
if (defaultMode == nullptr) { if (defaultMode == nullptr) {
LOG(RPiAwb, Error) << "AwbConfig: no AWB modes configured"; LOG(RPiAwb, Error) << "AwbConfig: no AWB modes configured";
return -EINVAL; return -EINVAL;
} }
} }
minPixels = params.get<double>("min_pixels", 16.0);
minG = params.get<uint16_t>("min_G", 32); minPixels = params["min_pixels"].get<double>(16.0);
minRegions = params.get<uint32_t>("min_regions", 10); minG = params["min_G"].get<uint16_t>(32);
deltaLimit = params.get<double>("delta_limit", 0.2); minRegions = params["min_regions"].get<uint32_t>(10);
coarseStep = params.get<double>("coarse_step", 0.2); deltaLimit = params["delta_limit"].get<double>(0.2);
transversePos = params.get<double>("transverse_pos", 0.01); coarseStep = params["coarse_step"].get<double>(0.2);
transverseNeg = params.get<double>("transverse_neg", 0.01); transversePos = params["transverse_pos"].get<double>(0.01);
transverseNeg = params["transverse_neg"].get<double>(0.01);
if (transversePos <= 0 || transverseNeg <= 0) { if (transversePos <= 0 || transverseNeg <= 0) {
LOG(RPiAwb, Error) << "AwbConfig: transverse_pos/neg must be > 0"; LOG(RPiAwb, Error) << "AwbConfig: transverse_pos/neg must be > 0";
return -EINVAL; return -EINVAL;
} }
sensitivityR = params.get<double>("sensitivity_r", 1.0);
sensitivityB = params.get<double>("sensitivity_b", 1.0); sensitivityR = params["sensitivity_r"].get<double>(1.0);
sensitivityB = params["sensitivity_b"].get<double>(1.0);
if (bayes) { if (bayes) {
if (ctR.empty() || ctB.empty() || priors.empty() || if (ctR.empty() || ctB.empty() || priors.empty() ||
defaultMode == nullptr) { defaultMode == nullptr) {
@ -129,9 +159,9 @@ int AwbConfig::read(boost::property_tree::ptree const &params)
bayes = false; bayes = false;
} }
} }
fast = params.get<int>("fast", bayes); /* default to fast for Bayesian, otherwise slow */ fast = params[fast].get<int>(bayes); /* default to fast for Bayesian, otherwise slow */
whitepointR = params.get<double>("whitepoint_r", 0.0); whitepointR = params["whitepoint_r"].get<double>(0.0);
whitepointB = params.get<double>("whitepoint_b", 0.0); whitepointB = params["whitepoint_b"].get<double>(0.0);
if (bayes == false) if (bayes == false)
sensitivityR = sensitivityB = 1.0; /* nor do sensitivities make any sense */ sensitivityR = sensitivityB = 1.0; /* nor do sensitivities make any sense */
return 0; return 0;
@ -162,7 +192,7 @@ char const *Awb::name() const
return NAME; return NAME;
} }
int Awb::read(boost::property_tree::ptree const &params) int Awb::read(const libcamera::YamlObject &params)
{ {
return config_.read(params); return config_.read(params);
} }

View file

@ -19,20 +19,20 @@ namespace RPiController {
/* Control algorithm to perform AWB calculations. */ /* Control algorithm to perform AWB calculations. */
struct AwbMode { struct AwbMode {
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
double ctLo; /* low CT value for search */ double ctLo; /* low CT value for search */
double ctHi; /* high CT value for search */ double ctHi; /* high CT value for search */
}; };
struct AwbPrior { struct AwbPrior {
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
double lux; /* lux level */ double lux; /* lux level */
Pwl prior; /* maps CT to prior log likelihood for this lux level */ Pwl prior; /* maps CT to prior log likelihood for this lux level */
}; };
struct AwbConfig { struct AwbConfig {
AwbConfig() : defaultMode(nullptr) {} AwbConfig() : defaultMode(nullptr) {}
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
/* Only repeat the AWB calculation every "this many" frames */ /* Only repeat the AWB calculation every "this many" frames */
uint16_t framePeriod; uint16_t framePeriod;
/* number of initial frames for which speed taken as 1.0 (maximum) */ /* number of initial frames for which speed taken as 1.0 (maximum) */
@ -90,7 +90,7 @@ public:
~Awb(); ~Awb();
char const *name() const override; char const *name() const override;
void initialise() override; void initialise() override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
/* AWB handles "pausing" for itself. */ /* AWB handles "pausing" for itself. */
bool isPaused() const override; bool isPaused() const override;
void pause() override; void pause() override;

View file

@ -31,13 +31,13 @@ char const *BlackLevel::name() const
return NAME; return NAME;
} }
int BlackLevel::read(boost::property_tree::ptree const &params) int BlackLevel::read(const libcamera::YamlObject &params)
{ {
uint16_t blackLevel = params.get<uint16_t>( /* 64 in 10 bits scaled to 16 bits */
"black_level", 4096); /* 64 in 10 bits scaled to 16 bits */ uint16_t blackLevel = params["black_level"].get<uint16_t>(4096);
blackLevelR_ = params.get<uint16_t>("black_level_r", blackLevel); blackLevelR_ = params["black_level_r"].get<uint16_t>(blackLevel);
blackLevelG_ = params.get<uint16_t>("black_level_g", blackLevel); blackLevelG_ = params["black_level_g"].get<uint16_t>(blackLevel);
blackLevelB_ = params.get<uint16_t>("black_level_b", blackLevel); blackLevelB_ = params["black_level_b"].get<uint16_t>(blackLevel);
LOG(RPiBlackLevel, Debug) LOG(RPiBlackLevel, Debug)
<< " Read black levels red " << blackLevelR_ << " Read black levels red " << blackLevelR_
<< " green " << blackLevelG_ << " green " << blackLevelG_

View file

@ -18,7 +18,7 @@ class BlackLevel : public Algorithm
public: public:
BlackLevel(Controller *controller); BlackLevel(Controller *controller);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
private: private:

View file

@ -39,21 +39,22 @@ Matrix::Matrix(double m0, double m1, double m2, double m3, double m4, double m5,
m[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4, m[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4,
m[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8; m[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8;
} }
int Matrix::read(boost::property_tree::ptree const &params) int Matrix::read(const libcamera::YamlObject &params)
{ {
double *ptr = (double *)m; double *ptr = (double *)m;
int n = 0;
for (auto it = params.begin(); it != params.end(); it++) { if (params.size() != 9) {
if (n++ == 9) { LOG(RPiCcm, Error) << "Wrong number of values in CCM";
LOG(RPiCcm, Error) << "Too many values in CCM";
return -EINVAL;
}
*ptr++ = it->second.get_value<double>();
}
if (n < 9) {
LOG(RPiCcm, Error) << "Too few values in CCM";
return -EINVAL; return -EINVAL;
} }
for (const auto &param : params.asList()) {
auto value = param.get<double>();
if (!value)
return -EINVAL;
*ptr++ = *value;
}
return 0; return 0;
} }
@ -65,27 +66,33 @@ char const *Ccm::name() const
return NAME; return NAME;
} }
int Ccm::read(boost::property_tree::ptree const &params) int Ccm::read(const libcamera::YamlObject &params)
{ {
int ret; int ret;
if (params.get_child_optional("saturation")) { if (params.contains("saturation")) {
ret = config_.saturation.read(params.get_child("saturation")); ret = config_.saturation.read(params["saturation"]);
if (ret) if (ret)
return ret; return ret;
} }
for (auto &p : params.get_child("ccms")) { for (auto &p : params["ccms"].asList()) {
auto value = p["ct"].get<double>();
if (!value)
return -EINVAL;
CtCcm ctCcm; CtCcm ctCcm;
ctCcm.ct = p.second.get<double>("ct"); ctCcm.ct = *value;
ret = ctCcm.ccm.read(p.second.get_child("ccm")); ret = ctCcm.ccm.read(p["ccm"]);
if (ret) if (ret)
return ret; return ret;
if (!config_.ccms.empty() &&
ctCcm.ct <= config_.ccms.back().ct) { if (!config_.ccms.empty() && ctCcm.ct <= config_.ccms.back().ct) {
LOG(RPiCcm, Error) << "CCM not in increasing colour temperature order"; LOG(RPiCcm, Error)
<< "CCM not in increasing colour temperature order";
return -EINVAL; return -EINVAL;
} }
config_.ccms.push_back(std::move(ctCcm)); config_.ccms.push_back(std::move(ctCcm));
} }

View file

@ -20,7 +20,7 @@ struct Matrix {
double m6, double m7, double m8); double m6, double m7, double m8);
Matrix(); Matrix();
double m[3][3]; double m[3][3];
int read(boost::property_tree::ptree const &params); int read(const libcamera::YamlObject &params);
}; };
static inline Matrix operator*(double d, Matrix const &m) static inline Matrix operator*(double d, Matrix const &m)
{ {
@ -62,7 +62,7 @@ class Ccm : public CcmAlgorithm
public: public:
Ccm(Controller *controller = NULL); Ccm(Controller *controller = NULL);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void setSaturation(double saturation) override; void setSaturation(double saturation) override;
void initialise() override; void initialise() override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;

View file

@ -38,21 +38,21 @@ char const *Contrast::name() const
return NAME; return NAME;
} }
int Contrast::read(boost::property_tree::ptree const &params) int Contrast::read(const libcamera::YamlObject &params)
{ {
/* enable adaptive enhancement by default */ // enable adaptive enhancement by default
config_.ceEnable = params.get<int>("ce_enable", 1); config_.ceEnable = params["ce_enable"].get<int>(1);
/* the point near the bottom of the histogram to move */ // the point near the bottom of the histogram to move
config_.loHistogram = params.get<double>("lo_histogram", 0.01); config_.loHistogram = params["lo_histogram"].get<double>(0.01);
/* where in the range to try and move it to */ // where in the range to try and move it to
config_.loLevel = params.get<double>("lo_level", 0.015); config_.loLevel = params["lo_level"].get<double>(0.015);
/* but don't move by more than this */ // but don't move by more than this
config_.loMax = params.get<double>("lo_max", 500); config_.loMax = params["lo_max"].get<double>(500);
/* equivalent values for the top of the histogram... */ // equivalent values for the top of the histogram...
config_.hiHistogram = params.get<double>("hi_histogram", 0.95); config_.hiHistogram = params["hi_histogram"].get<double>(0.95);
config_.hiLevel = params.get<double>("hi_level", 0.95); config_.hiLevel = params["hi_level"].get<double>(0.95);
config_.hiMax = params.get<double>("hi_max", 2000); config_.hiMax = params["hi_max"].get<double>(2000);
return config_.gammaCurve.read(params.get_child("gamma_curve")); return config_.gammaCurve.read(params["gamma_curve"]);
} }
void Contrast::setBrightness(double brightness) void Contrast::setBrightness(double brightness)

View file

@ -34,7 +34,7 @@ class Contrast : public ContrastAlgorithm
public: public:
Contrast(Controller *controller = NULL); Contrast(Controller *controller = NULL);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void setBrightness(double brightness) override; void setBrightness(double brightness) override;
void setContrast(double contrast) override; void setContrast(double contrast) override;
void initialise() override; void initialise() override;

View file

@ -31,13 +31,14 @@ char const *Dpc::name() const
return NAME; return NAME;
} }
int Dpc::read(boost::property_tree::ptree const &params) int Dpc::read(const libcamera::YamlObject &params)
{ {
config_.strength = params.get<int>("strength", 1); config_.strength = params["strength"].get<int>(1);
if (config_.strength < 0 || config_.strength > 2) { if (config_.strength < 0 || config_.strength > 2) {
LOG(RPiDpc, Error) << "bad strength value"; LOG(RPiDpc, Error) << "Bad strength value";
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
} }

View file

@ -22,7 +22,7 @@ class Dpc : public Algorithm
public: public:
Dpc(Controller *controller); Dpc(Controller *controller);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
private: private:

View file

@ -35,17 +35,17 @@ char const *Geq::name() const
return NAME; return NAME;
} }
int Geq::read(boost::property_tree::ptree const &params) int Geq::read(const libcamera::YamlObject &params)
{ {
config_.offset = params.get<uint16_t>("offset", 0); config_.offset = params["offset"].get<uint16_t>(0);
config_.slope = params.get<double>("slope", 0.0); config_.slope = params["slope"].get<double>(0.0);
if (config_.slope < 0.0 || config_.slope >= 1.0) { if (config_.slope < 0.0 || config_.slope >= 1.0) {
LOG(RPiGeq, Error) << "Bad slope value"; LOG(RPiGeq, Error) << "Bad slope value";
return -EINVAL; return -EINVAL;
} }
if (params.get_child_optional("strength")) { if (params.contains("strength")) {
int ret = config_.strength.read(params.get_child("strength")); int ret = config_.strength.read(params["strength"]);
if (ret) if (ret)
return ret; return ret;
} }

View file

@ -24,7 +24,7 @@ class Geq : public Algorithm
public: public:
Geq(Controller *controller); Geq(Controller *controller);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
private: private:

View file

@ -38,14 +38,30 @@ char const *Lux::name() const
return NAME; return NAME;
} }
int Lux::read(boost::property_tree::ptree const &params) int Lux::read(const libcamera::YamlObject &params)
{ {
referenceShutterSpeed_ = auto value = params["reference_shutter_speed"].get<double>();
params.get<double>("reference_shutter_speed") * 1.0us; if (!value)
referenceGain_ = params.get<double>("reference_gain"); return -EINVAL;
referenceAperture_ = params.get<double>("reference_aperture", 1.0); referenceShutterSpeed_ = *value * 1.0us;
referenceY_ = params.get<double>("reference_Y");
referenceLux_ = params.get<double>("reference_lux"); value = params["reference_gain"].get<double>();
if (!value)
return -EINVAL;
referenceGain_ = *value;
referenceAperture_ = params["reference_aperture"].get<double>(1.0);
value = params["reference_Y"].get<double>();
if (!value)
return -EINVAL;
referenceY_ = *value;
value = params["reference_lux"].get<double>();
if (!value)
return -EINVAL;
referenceLux_ = *value;
currentAperture_ = referenceAperture_; currentAperture_ = referenceAperture_;
return 0; return 0;
} }

View file

@ -22,7 +22,7 @@ class Lux : public Algorithm
public: public:
Lux(Controller *controller); Lux(Controller *controller);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
void process(StatisticsPtr &stats, Metadata *imageMetadata) override; void process(StatisticsPtr &stats, Metadata *imageMetadata) override;
void setCurrentAperture(double aperture); void setCurrentAperture(double aperture);

View file

@ -41,10 +41,18 @@ void Noise::switchMode(CameraMode const &cameraMode,
modeFactor_ = std::max(1.0, cameraMode.noiseFactor); modeFactor_ = std::max(1.0, cameraMode.noiseFactor);
} }
int Noise::read(boost::property_tree::ptree const &params) int Noise::read(const libcamera::YamlObject &params)
{ {
referenceConstant_ = params.get<double>("reference_constant"); auto value = params["reference_constant"].get<double>();
referenceSlope_ = params.get<double>("reference_slope"); if (!value)
return -EINVAL;
referenceConstant_ = *value;
value = params["reference_slope"].get<double>();
if (!value)
return -EINVAL;
referenceSlope_ = *value;
return 0; return 0;
} }

View file

@ -19,7 +19,7 @@ public:
Noise(Controller *controller); Noise(Controller *controller);
char const *name() const override; char const *name() const override;
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override; void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
private: private:

View file

@ -34,10 +34,10 @@ char const *Sdn::name() const
return NAME; return NAME;
} }
int Sdn::read(boost::property_tree::ptree const &params) int Sdn::read(const libcamera::YamlObject &params)
{ {
deviation_ = params.get<double>("deviation", 3.2); deviation_ = params["deviation"].get<double>(3.2);
strength_ = params.get<double>("strength", 0.75); strength_ = params["strength"].get<double>(0.75);
return 0; return 0;
} }

View file

@ -18,7 +18,7 @@ class Sdn : public DenoiseAlgorithm
public: public:
Sdn(Controller *controller = NULL); Sdn(Controller *controller = NULL);
char const *name() const override; char const *name() const override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void initialise() override; void initialise() override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;
void setMode(DenoiseMode mode) override; void setMode(DenoiseMode mode) override;

View file

@ -37,11 +37,11 @@ void Sharpen::switchMode(CameraMode const &cameraMode,
modeFactor_ = std::max(1.0, cameraMode.noiseFactor); modeFactor_ = std::max(1.0, cameraMode.noiseFactor);
} }
int Sharpen::read(boost::property_tree::ptree const &params) int Sharpen::read(const libcamera::YamlObject &params)
{ {
threshold_ = params.get<double>("threshold", 1.0); threshold_ = params["threshold"].get<double>(1.0);
strength_ = params.get<double>("strength", 1.0); strength_ = params["strength"].get<double>(1.0);
limit_ = params.get<double>("limit", 1.0); limit_ = params["limit"].get<double>(1.0);
LOG(RPiSharpen, Debug) LOG(RPiSharpen, Debug)
<< "Read threshold " << threshold_ << "Read threshold " << threshold_
<< " strength " << strength_ << " strength " << strength_

View file

@ -19,7 +19,7 @@ public:
Sharpen(Controller *controller); Sharpen(Controller *controller);
char const *name() const override; char const *name() const override;
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override; void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
int read(boost::property_tree::ptree const &params) override; int read(const libcamera::YamlObject &params) override;
void setStrength(double strength) override; void setStrength(double strength) override;
void prepare(Metadata *imageMetadata) override; void prepare(Metadata *imageMetadata) override;

View file

@ -4,7 +4,6 @@ ipa_name = 'ipa_rpi'
rpi_ipa_deps = [ rpi_ipa_deps = [
libcamera_private, libcamera_private,
dependency('boost'),
libatomic, libatomic,
] ]

View file

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cstring>
#include <fcntl.h> #include <fcntl.h>
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>