libcamera: Rename YamlObject to ValueNode
The YamlObject class is now a generic data container to model trees of values. Rename it to ValueNode and expand the class documentation. While at it, drop the unneeded libcamera:: namespace prefix when using the ValueNode class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
This commit is contained in:
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
static std::unique_ptr<ConverterDW100Module> createModule(DeviceEnumerator *enumerator);
|
static std::unique_ptr<ConverterDW100Module> createModule(DeviceEnumerator *enumerator);
|
||||||
|
|
||||||
int init(const YamlObject ¶ms);
|
int init(const ValueNode ¶ms);
|
||||||
|
|
||||||
int configure(const StreamConfiguration &inputCfg,
|
int configure(const StreamConfiguration &inputCfg,
|
||||||
const std::vector<std::reference_wrapper<const StreamConfiguration>>
|
const std::vector<std::reference_wrapper<const StreamConfiguration>>
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
class GlobalConfiguration
|
class GlobalConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Configuration = const YamlObject &;
|
using Configuration = const ValueNode &;
|
||||||
|
|
||||||
GlobalConfiguration();
|
GlobalConfiguration();
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
std::optional<T> option(
|
std::optional<T> option(
|
||||||
const std::initializer_list<std::string_view> confPath) const
|
const std::initializer_list<std::string_view> confPath) const
|
||||||
{
|
{
|
||||||
const YamlObject *c = &configuration();
|
const ValueNode *c = &configuration();
|
||||||
for (auto part : confPath) {
|
for (auto part : confPath) {
|
||||||
c = &(*c)[part];
|
c = &(*c)[part];
|
||||||
if (!*c)
|
if (!*c)
|
||||||
@@ -55,8 +55,8 @@ private:
|
|||||||
bool loadFile(const std::filesystem::path &fileName);
|
bool loadFile(const std::filesystem::path &fileName);
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
std::unique_ptr<YamlObject> yamlConfiguration_ =
|
std::unique_ptr<ValueNode> yamlConfiguration_ =
|
||||||
std::make_unique<YamlObject>();
|
std::make_unique<ValueNode>();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/base/span.h>
|
#include <libcamera/base/span.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ constexpr Matrix<T, Rows, Cols> operator+(const Matrix<T, Rows, Cols> &m1, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
bool matrixValidateYaml(const YamlObject &obj, unsigned int size);
|
bool matrixValidateYaml(const ValueNode &obj, unsigned int size);
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
@@ -200,8 +200,8 @@ std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, unsigned int Rows, unsigned int Cols>
|
template<typename T, unsigned int Rows, unsigned int Cols>
|
||||||
struct YamlObject::Accessor<Matrix<T, Rows, Cols>> {
|
struct ValueNode::Accessor<Matrix<T, Rows, Cols>> {
|
||||||
std::optional<Matrix<T, Rows, Cols>> get(const YamlObject &obj) const
|
std::optional<Matrix<T, Rows, Cols>> get(const ValueNode &obj) const
|
||||||
{
|
{
|
||||||
if (!matrixValidateYaml(obj, Rows * Cols))
|
if (!matrixValidateYaml(obj, Rows * Cols))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@@ -210,7 +210,7 @@ struct YamlObject::Accessor<Matrix<T, Rows, Cols>> {
|
|||||||
T *data = &matrix[0][0];
|
T *data = &matrix[0][0];
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (const YamlObject &entry : obj.asList()) {
|
for (const ValueNode &entry : obj.asList()) {
|
||||||
const auto value = entry.get<T>();
|
const auto value = entry.get<T>();
|
||||||
if (!value)
|
if (!value)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ libcamera_internal_headers = files([
|
|||||||
'v4l2_request.h',
|
'v4l2_request.h',
|
||||||
'v4l2_subdevice.h',
|
'v4l2_subdevice.h',
|
||||||
'v4l2_videodevice.h',
|
'v4l2_videodevice.h',
|
||||||
|
'value_node.h',
|
||||||
'vector.h',
|
'vector.h',
|
||||||
'yaml_object.h',
|
|
||||||
'yaml_parser.h',
|
'yaml_parser.h',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2022, Google Inc.
|
* Copyright (C) 2022, Google Inc.
|
||||||
* Copyright (C) 2026, Ideas on Board
|
* Copyright (C) 2026, Ideas on Board
|
||||||
*
|
*
|
||||||
* libcamera YAML object
|
* Data structure to manage tree of values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -22,16 +22,16 @@
|
|||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
class YamlObject
|
class ValueNode
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct Value {
|
struct Value {
|
||||||
Value(std::string k, std::unique_ptr<YamlObject> &&v)
|
Value(std::string k, std::unique_ptr<ValueNode> &&v)
|
||||||
: key(std::move(k)), value(std::move(v))
|
: key(std::move(k)), value(std::move(v))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
std::string key;
|
std::string key;
|
||||||
std::unique_ptr<YamlObject> value;
|
std::unique_ptr<ValueNode> value;
|
||||||
};
|
};
|
||||||
|
|
||||||
using ValueContainer = std::vector<Value>;
|
using ValueContainer = std::vector<Value>;
|
||||||
@@ -103,8 +103,8 @@ public:
|
|||||||
class ListIterator : public Iterator<ListIterator>
|
class ListIterator : public Iterator<ListIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using value_type = const YamlObject &;
|
using value_type = const ValueNode &;
|
||||||
using pointer = const YamlObject *;
|
using pointer = const ValueNode *;
|
||||||
using reference = value_type;
|
using reference = value_type;
|
||||||
|
|
||||||
value_type operator*() const
|
value_type operator*() const
|
||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
class DictIterator : public Iterator<DictIterator>
|
class DictIterator : public Iterator<DictIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using value_type = std::pair<const std::string &, const YamlObject &>;
|
using value_type = std::pair<const std::string &, const ValueNode &>;
|
||||||
using pointer = value_type *;
|
using pointer = value_type *;
|
||||||
using reference = value_type &;
|
using reference = value_type &;
|
||||||
|
|
||||||
@@ -142,8 +142,8 @@ public:
|
|||||||
};
|
};
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
YamlObject();
|
ValueNode();
|
||||||
~YamlObject();
|
~ValueNode();
|
||||||
|
|
||||||
bool isValue() const
|
bool isValue() const
|
||||||
{
|
{
|
||||||
@@ -190,16 +190,16 @@ public:
|
|||||||
DictAdapter asDict() const { return DictAdapter{ list_ }; }
|
DictAdapter asDict() const { return DictAdapter{ list_ }; }
|
||||||
ListAdapter asList() const { return ListAdapter{ list_ }; }
|
ListAdapter asList() const { return ListAdapter{ list_ }; }
|
||||||
|
|
||||||
const YamlObject &operator[](std::size_t index) const;
|
const ValueNode &operator[](std::size_t index) const;
|
||||||
|
|
||||||
bool contains(std::string_view key) const;
|
bool contains(std::string_view key) const;
|
||||||
const YamlObject &operator[](std::string_view key) const;
|
const ValueNode &operator[](std::string_view key) const;
|
||||||
|
|
||||||
YamlObject *add(std::unique_ptr<YamlObject> &&child);
|
ValueNode *add(std::unique_ptr<ValueNode> &&child);
|
||||||
YamlObject *add(std::string key, std::unique_ptr<YamlObject> &&child);
|
ValueNode *add(std::string key, std::unique_ptr<ValueNode> &&child);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)
|
LIBCAMERA_DISABLE_COPY_AND_MOVE(ValueNode)
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
friend struct Accessor;
|
friend struct Accessor;
|
||||||
@@ -213,15 +213,15 @@ private:
|
|||||||
|
|
||||||
template<typename T, typename Enable = void>
|
template<typename T, typename Enable = void>
|
||||||
struct Accessor {
|
struct Accessor {
|
||||||
std::optional<T> get(const YamlObject &obj) const;
|
std::optional<T> get(const ValueNode &obj) const;
|
||||||
void set(YamlObject &obj, T value);
|
void set(ValueNode &obj, T value);
|
||||||
};
|
};
|
||||||
|
|
||||||
Type type_;
|
Type type_;
|
||||||
|
|
||||||
std::string value_;
|
std::string value_;
|
||||||
ValueContainer list_;
|
ValueContainer list_;
|
||||||
std::map<std::string, YamlObject *, std::less<>> dictionary_;
|
std::map<std::string, ValueNode *, std::less<>> dictionary_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <libcamera/base/span.h>
|
#include <libcamera/base/span.h>
|
||||||
|
|
||||||
#include "libcamera/internal/matrix.h"
|
#include "libcamera/internal/matrix.h"
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ bool operator!=(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
bool vectorValidateYaml(const YamlObject &obj, unsigned int size);
|
bool vectorValidateYaml(const ValueNode &obj, unsigned int size);
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
@@ -347,8 +347,8 @@ std::ostream &operator<<(std::ostream &out, const Vector<T, Rows> &v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, unsigned int Rows>
|
template<typename T, unsigned int Rows>
|
||||||
struct YamlObject::Accessor<Vector<T, Rows>> {
|
struct ValueNode::Accessor<Vector<T, Rows>> {
|
||||||
std::optional<Vector<T, Rows>> get(const YamlObject &obj) const
|
std::optional<Vector<T, Rows>> get(const ValueNode &obj) const
|
||||||
{
|
{
|
||||||
if (!vectorValidateYaml(obj, Rows))
|
if (!vectorValidateYaml(obj, Rows))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@@ -356,7 +356,7 @@ struct YamlObject::Accessor<Vector<T, Rows>> {
|
|||||||
Vector<T, Rows> vector;
|
Vector<T, Rows> vector;
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (const YamlObject &entry : obj.asList()) {
|
for (const ValueNode &entry : obj.asList()) {
|
||||||
const auto value = entry.get<T>();
|
const auto value = entry.get<T>();
|
||||||
if (!value)
|
if (!value)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ class File;
|
|||||||
class YamlParser final
|
class YamlParser final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<YamlObject> parse(File &file);
|
static std::unique_ptr<ValueNode> parse(File &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ public:
|
|||||||
int parseConfigFile(File &file, std::map<std::string, CameraConfigData> *cameras);
|
int parseConfigFile(File &file, std::map<std::string, CameraConfigData> *cameras);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int parseCameraConfigData(const std::string &cameraId, const YamlObject &);
|
int parseCameraConfigData(const std::string &cameraId, const ValueNode &);
|
||||||
int parseLocation(const YamlObject &, CameraConfigData &cameraConfigData);
|
int parseLocation(const ValueNode &, CameraConfigData &cameraConfigData);
|
||||||
int parseRotation(const YamlObject &, CameraConfigData &cameraConfigData);
|
int parseRotation(const ValueNode &, CameraConfigData &cameraConfigData);
|
||||||
|
|
||||||
std::map<std::string, CameraConfigData> *cameras_;
|
std::map<std::string, CameraConfigData> *cameras_;
|
||||||
};
|
};
|
||||||
@@ -65,7 +65,7 @@ int CameraHalConfig::Private::parseConfigFile(File &file,
|
|||||||
|
|
||||||
cameras_ = cameras;
|
cameras_ = cameras;
|
||||||
|
|
||||||
std::unique_ptr<YamlObject> root = YamlParser::parse(file);
|
std::unique_ptr<ValueNode> root = YamlParser::parse(file);
|
||||||
if (!root)
|
if (!root)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ int CameraHalConfig::Private::parseConfigFile(File &file,
|
|||||||
if (!root->contains("cameras"))
|
if (!root->contains("cameras"))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
const YamlObject &yamlObjectCameras = (*root)["cameras"];
|
const ValueNode &yamlObjectCameras = (*root)["cameras"];
|
||||||
|
|
||||||
if (!yamlObjectCameras.isDictionary())
|
if (!yamlObjectCameras.isDictionary())
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -90,7 +90,7 @@ int CameraHalConfig::Private::parseConfigFile(File &file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CameraHalConfig::Private::parseCameraConfigData(const std::string &cameraId,
|
int CameraHalConfig::Private::parseCameraConfigData(const std::string &cameraId,
|
||||||
const YamlObject &cameraObject)
|
const ValueNode &cameraObject)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!cameraObject.isDictionary())
|
if (!cameraObject.isDictionary())
|
||||||
@@ -109,7 +109,7 @@ int CameraHalConfig::Private::parseCameraConfigData(const std::string &cameraId,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CameraHalConfig::Private::parseLocation(const YamlObject &cameraObject,
|
int CameraHalConfig::Private::parseLocation(const ValueNode &cameraObject,
|
||||||
CameraConfigData &cameraConfigData)
|
CameraConfigData &cameraConfigData)
|
||||||
{
|
{
|
||||||
if (!cameraObject.contains("location"))
|
if (!cameraObject.contains("location"))
|
||||||
@@ -127,7 +127,7 @@ int CameraHalConfig::Private::parseLocation(const YamlObject &cameraObject,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CameraHalConfig::Private::parseRotation(const YamlObject &cameraObject,
|
int CameraHalConfig::Private::parseRotation(const ValueNode &cameraObject,
|
||||||
CameraConfigData &cameraConfigData)
|
CameraConfigData &cameraConfigData)
|
||||||
{
|
{
|
||||||
if (!cameraObject.contains("rotation"))
|
if (!cameraObject.contains("rotation"))
|
||||||
|
|||||||
@@ -65,14 +65,14 @@ Agc::Agc()
|
|||||||
/**
|
/**
|
||||||
* \brief Initialise the AGC algorithm from tuning files
|
* \brief Initialise the AGC algorithm from tuning files
|
||||||
* \param[in] context The shared IPA context
|
* \param[in] context The shared IPA context
|
||||||
* \param[in] tuningData The YamlObject containing Agc tuning data
|
* \param[in] tuningData The ValueNode containing Agc tuning data
|
||||||
*
|
*
|
||||||
* This function calls the base class' tuningData parsers to discover which
|
* This function calls the base class' tuningData parsers to discover which
|
||||||
* control values are supported.
|
* control values are supported.
|
||||||
*
|
*
|
||||||
* \return 0 on success or errors from the base class
|
* \return 0 on success or errors from the base class
|
||||||
*/
|
*/
|
||||||
int Agc::init(IPAContext &context, const YamlObject &tuningData)
|
int Agc::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
Agc();
|
Agc();
|
||||||
~Agc() = default;
|
~Agc() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||||
void process(IPAContext &context, const uint32_t frame,
|
void process(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ int IPAIPU3::init(const IPASettings &settings,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<libcamera::YamlObject> data = YamlParser::parse(file);
|
std::unique_ptr<ValueNode> data = YamlParser::parse(file);
|
||||||
if (!data)
|
if (!data)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ AgcMeanLuminance::AgcMeanLuminance()
|
|||||||
|
|
||||||
AgcMeanLuminance::~AgcMeanLuminance() = default;
|
AgcMeanLuminance::~AgcMeanLuminance() = default;
|
||||||
|
|
||||||
int AgcMeanLuminance::parseRelativeLuminanceTarget(const YamlObject &tuningData)
|
int AgcMeanLuminance::parseRelativeLuminanceTarget(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto &target = tuningData["relativeLuminanceTarget"];
|
auto &target = tuningData["relativeLuminanceTarget"];
|
||||||
if (!target) {
|
if (!target) {
|
||||||
@@ -178,7 +178,7 @@ int AgcMeanLuminance::parseRelativeLuminanceTarget(const YamlObject &tuningData)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcMeanLuminance::parseConstraint(const YamlObject &modeDict, int32_t id)
|
int AgcMeanLuminance::parseConstraint(const ValueNode &modeDict, int32_t id)
|
||||||
{
|
{
|
||||||
for (const auto &[boundName, content] : modeDict.asDict()) {
|
for (const auto &[boundName, content] : modeDict.asDict()) {
|
||||||
if (boundName != "upper" && boundName != "lower") {
|
if (boundName != "upper" && boundName != "lower") {
|
||||||
@@ -212,11 +212,11 @@ int AgcMeanLuminance::parseConstraint(const YamlObject &modeDict, int32_t id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcMeanLuminance::parseConstraintModes(const YamlObject &tuningData)
|
int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
std::vector<ControlValue> availableConstraintModes;
|
std::vector<ControlValue> availableConstraintModes;
|
||||||
|
|
||||||
const YamlObject &yamlConstraintModes = tuningData[controls::AeConstraintMode.name()];
|
const ValueNode &yamlConstraintModes = tuningData[controls::AeConstraintMode.name()];
|
||||||
if (yamlConstraintModes.isDictionary()) {
|
if (yamlConstraintModes.isDictionary()) {
|
||||||
for (const auto &[modeName, modeDict] : yamlConstraintModes.asDict()) {
|
for (const auto &[modeName, modeDict] : yamlConstraintModes.asDict()) {
|
||||||
if (AeConstraintModeNameValueMap.find(modeName) ==
|
if (AeConstraintModeNameValueMap.find(modeName) ==
|
||||||
@@ -267,11 +267,11 @@ int AgcMeanLuminance::parseConstraintModes(const YamlObject &tuningData)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)
|
int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
std::vector<ControlValue> availableExposureModes;
|
std::vector<ControlValue> availableExposureModes;
|
||||||
|
|
||||||
const YamlObject &yamlExposureModes = tuningData[controls::AeExposureMode.name()];
|
const ValueNode &yamlExposureModes = tuningData[controls::AeExposureMode.name()];
|
||||||
if (yamlExposureModes.isDictionary()) {
|
if (yamlExposureModes.isDictionary()) {
|
||||||
for (const auto &[modeName, modeValues] : yamlExposureModes.asDict()) {
|
for (const auto &[modeName, modeValues] : yamlExposureModes.asDict()) {
|
||||||
if (AeExposureModeNameValueMap.find(modeName) ==
|
if (AeExposureModeNameValueMap.find(modeName) ==
|
||||||
@@ -361,7 +361,7 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Parse tuning data for AeConstraintMode and AeExposureMode controls
|
* \brief Parse tuning data for AeConstraintMode and AeExposureMode controls
|
||||||
* \param[in] tuningData the YamlObject representing the tuning data
|
* \param[in] tuningData the ValueNode representing the tuning data
|
||||||
*
|
*
|
||||||
* This function parses tuning data to build the list of allowed values for the
|
* This function parses tuning data to build the list of allowed values for the
|
||||||
* AeConstraintMode and AeExposureMode controls. Those tuning data must provide
|
* AeConstraintMode and AeExposureMode controls. Those tuning data must provide
|
||||||
@@ -414,7 +414,7 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration,
|
|||||||
*
|
*
|
||||||
* \return 0 on success or a negative error code
|
* \return 0 on success or a negative error code
|
||||||
*/
|
*/
|
||||||
int AgcMeanLuminance::parseTuningData(const YamlObject &tuningData)
|
int AgcMeanLuminance::parseTuningData(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include <libcamera/controls.h>
|
#include <libcamera/controls.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "exposure_mode_helper.h"
|
#include "exposure_mode_helper.h"
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void configure(utils::Duration lineDuration, const CameraSensorHelper *sensorHelper);
|
void configure(utils::Duration lineDuration, const CameraSensorHelper *sensorHelper);
|
||||||
int parseTuningData(const YamlObject &tuningData);
|
int parseTuningData(const ValueNode &tuningData);
|
||||||
|
|
||||||
void setExposureCompensation(double gain)
|
void setExposureCompensation(double gain)
|
||||||
{
|
{
|
||||||
@@ -88,10 +88,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
virtual double estimateLuminance(const double gain) const = 0;
|
virtual double estimateLuminance(const double gain) const = 0;
|
||||||
|
|
||||||
int parseRelativeLuminanceTarget(const YamlObject &tuningData);
|
int parseRelativeLuminanceTarget(const ValueNode &tuningData);
|
||||||
int parseConstraint(const YamlObject &modeDict, int32_t id);
|
int parseConstraint(const ValueNode &modeDict, int32_t id);
|
||||||
int parseConstraintModes(const YamlObject &tuningData);
|
int parseConstraintModes(const ValueNode &tuningData);
|
||||||
int parseExposureModes(const YamlObject &tuningData);
|
int parseExposureModes(const ValueNode &tuningData);
|
||||||
double estimateInitialGain() const;
|
double estimateInitialGain() const;
|
||||||
double constraintClampGain(uint32_t constraintModeIndex,
|
double constraintClampGain(uint32_t constraintModeIndex,
|
||||||
const Histogram &hist,
|
const Histogram &hist,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace ipa {
|
|||||||
* \param[in] tuningData The tuning data for the algorithm
|
* \param[in] tuningData The tuning data for the algorithm
|
||||||
*
|
*
|
||||||
* This function is called once, when the IPA module is initialized, to
|
* This function is called once, when the IPA module is initialized, to
|
||||||
* initialize the algorithm. The \a tuningData YamlObject contains the tuning
|
* initialize the algorithm. The \a tuningData ValueNode contains the tuning
|
||||||
* data for algorithm.
|
* data for algorithm.
|
||||||
*
|
*
|
||||||
* \return 0 if successful, an error code otherwise
|
* \return 0 if successful, an error code otherwise
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
class YamlObject;
|
class ValueNode;
|
||||||
|
|
||||||
namespace ipa {
|
namespace ipa {
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
virtual ~Algorithm() {}
|
virtual ~Algorithm() {}
|
||||||
|
|
||||||
virtual int init([[maybe_unused]] typename Module::Context &context,
|
virtual int init([[maybe_unused]] typename Module::Context &context,
|
||||||
[[maybe_unused]] const YamlObject &tuningData)
|
[[maybe_unused]] const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace ipa {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Parse the mode configurations from the tuning data
|
* \brief Parse the mode configurations from the tuning data
|
||||||
* \param[in] tuningData the YamlObject representing the tuning data
|
* \param[in] tuningData the ValueNode representing the tuning data
|
||||||
* \param[in] def The default value for the AwbMode control
|
* \param[in] def The default value for the AwbMode control
|
||||||
*
|
*
|
||||||
* Utility function to parse the tuning data for an AwbMode entry and read all
|
* Utility function to parse the tuning data for an AwbMode entry and read all
|
||||||
@@ -162,12 +162,12 @@ namespace ipa {
|
|||||||
* \sa controls::AwbModeEnum
|
* \sa controls::AwbModeEnum
|
||||||
* \return Zero on success, negative error code otherwise
|
* \return Zero on success, negative error code otherwise
|
||||||
*/
|
*/
|
||||||
int AwbAlgorithm::parseModeConfigs(const YamlObject &tuningData,
|
int AwbAlgorithm::parseModeConfigs(const ValueNode &tuningData,
|
||||||
const ControlValue &def)
|
const ControlValue &def)
|
||||||
{
|
{
|
||||||
std::vector<ControlValue> availableModes;
|
std::vector<ControlValue> availableModes;
|
||||||
|
|
||||||
const YamlObject &yamlModes = tuningData[controls::AwbMode.name()];
|
const ValueNode &yamlModes = tuningData[controls::AwbMode.name()];
|
||||||
if (!yamlModes.isDictionary()) {
|
if (!yamlModes.isDictionary()) {
|
||||||
LOG(Awb, Error)
|
LOG(Awb, Error)
|
||||||
<< "AwbModes must be a dictionary.";
|
<< "AwbModes must be a dictionary.";
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
#include <libcamera/controls.h>
|
#include <libcamera/controls.h>
|
||||||
|
|
||||||
|
#include "libcamera/internal/value_node.h"
|
||||||
#include "libcamera/internal/vector.h"
|
#include "libcamera/internal/vector.h"
|
||||||
#include "libcamera/internal/yaml_object.h"
|
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class AwbAlgorithm
|
|||||||
public:
|
public:
|
||||||
virtual ~AwbAlgorithm() = default;
|
virtual ~AwbAlgorithm() = default;
|
||||||
|
|
||||||
virtual int init(const YamlObject &tuningData) = 0;
|
virtual int init(const ValueNode &tuningData) = 0;
|
||||||
virtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0;
|
virtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0;
|
||||||
virtual std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) = 0;
|
virtual std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) = 0;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
virtual void handleControls([[maybe_unused]] const ControlList &controls) {}
|
virtual void handleControls([[maybe_unused]] const ControlList &controls) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int parseModeConfigs(const YamlObject &tuningData,
|
int parseModeConfigs(const ValueNode &tuningData,
|
||||||
const ControlValue &def = {});
|
const ControlValue &def = {});
|
||||||
|
|
||||||
struct ModeConfig {
|
struct ModeConfig {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void Interpolator<Pwl>::interpolate(const Pwl &a, const Pwl &b, Pwl &dest, doubl
|
|||||||
* \brief The currently selected mode
|
* \brief The currently selected mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int AwbBayes::init(const YamlObject &tuningData)
|
int AwbBayes::init(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
int ret = colourGainCurve_.readYaml(tuningData["colourGains"], "ct", "gains");
|
int ret = colourGainCurve_.readYaml(tuningData["colourGains"], "ct", "gains");
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -188,7 +188,7 @@ int AwbBayes::init(const YamlObject &tuningData)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AwbBayes::readPriors(const YamlObject &tuningData)
|
int AwbBayes::readPriors(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
const auto &priorsList = tuningData["priors"];
|
const auto &priorsList = tuningData["priors"];
|
||||||
std::map<uint32_t, Pwl> priors;
|
std::map<uint32_t, Pwl> priors;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <libcamera/controls.h>
|
#include <libcamera/controls.h>
|
||||||
|
|
||||||
|
#include "libcamera/internal/value_node.h"
|
||||||
#include "libcamera/internal/vector.h"
|
#include "libcamera/internal/vector.h"
|
||||||
#include "libcamera/internal/yaml_object.h"
|
|
||||||
|
|
||||||
#include "awb.h"
|
#include "awb.h"
|
||||||
#include "interpolator.h"
|
#include "interpolator.h"
|
||||||
@@ -25,13 +25,13 @@ class AwbBayes : public AwbAlgorithm
|
|||||||
public:
|
public:
|
||||||
AwbBayes() = default;
|
AwbBayes() = default;
|
||||||
|
|
||||||
int init(const YamlObject &tuningData) override;
|
int init(const ValueNode &tuningData) override;
|
||||||
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
|
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
|
||||||
std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
|
std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
|
||||||
void handleControls(const ControlList &controls) override;
|
void handleControls(const ControlList &controls) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int readPriors(const YamlObject &tuningData);
|
int readPriors(const ValueNode &tuningData);
|
||||||
|
|
||||||
void fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior,
|
void fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior,
|
||||||
const AwbStats &stats) const;
|
const AwbStats &stats) const;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace ipa {
|
|||||||
*
|
*
|
||||||
* \return 0 on success, a negative error code otherwise
|
* \return 0 on success, a negative error code otherwise
|
||||||
*/
|
*/
|
||||||
int AwbGrey::init(const YamlObject &tuningData)
|
int AwbGrey::init(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
Interpolator<Vector<double, 2>> gains;
|
Interpolator<Vector<double, 2>> gains;
|
||||||
int ret = gains.readYaml(tuningData["colourGains"], "ct", "gains");
|
int ret = gains.readYaml(tuningData["colourGains"], "ct", "gains");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class AwbGrey : public AwbAlgorithm
|
|||||||
public:
|
public:
|
||||||
AwbGrey() = default;
|
AwbGrey() = default;
|
||||||
|
|
||||||
int init(const YamlObject &tuningData) override;
|
int init(const ValueNode &tuningData) override;
|
||||||
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
|
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
|
||||||
std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) override;
|
std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) override;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace ipa {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int Interpolator<T>::readYaml(const libcamera::YamlObject &yaml,
|
* \fn int Interpolator<T>::readYaml(const ValueNode &yaml,
|
||||||
const std::string &key_name,
|
const std::string &key_name,
|
||||||
const std::string &value_name)
|
const std::string &value_name)
|
||||||
* \brief Initialize an Interpolator instance from yaml
|
* \brief Initialize an Interpolator instance from yaml
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
~Interpolator() = default;
|
~Interpolator() = default;
|
||||||
|
|
||||||
int readYaml(const libcamera::YamlObject &yaml,
|
int readYaml(const ValueNode &yaml,
|
||||||
const std::string &key_name,
|
const std::string &key_name,
|
||||||
const std::string &value_name)
|
const std::string &value_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include <libcamera/geometry.h>
|
#include <libcamera/geometry.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -83,8 +83,8 @@ private:
|
|||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct YamlObject::Accessor<ipa::LscPolynomial> {
|
struct ValueNode::Accessor<ipa::LscPolynomial> {
|
||||||
std::optional<ipa::LscPolynomial> get(const YamlObject &obj) const
|
std::optional<ipa::LscPolynomial> get(const ValueNode &obj) const
|
||||||
{
|
{
|
||||||
std::optional<double> cx = obj["cx"].get<double>();
|
std::optional<double> cx = obj["cx"].get<double>();
|
||||||
std::optional<double> cy = obj["cy"].get<double>();
|
std::optional<double> cy = obj["cy"].get<double>();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ Lux::Lux()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Parse tuning data
|
* \brief Parse tuning data
|
||||||
* \param[in] tuningData The YamlObject representing the tuning data
|
* \param[in] tuningData The ValueNode representing the tuning data
|
||||||
*
|
*
|
||||||
* This function parses yaml tuning data for the common Lux module. It requires
|
* This function parses yaml tuning data for the common Lux module. It requires
|
||||||
* reference exposure time, analogue gain, digital gain, and lux values.
|
* reference exposure time, analogue gain, digital gain, and lux values.
|
||||||
@@ -95,7 +95,7 @@ Lux::Lux()
|
|||||||
*
|
*
|
||||||
* \return 0 on success or a negative error code
|
* \return 0 on success or a negative error code
|
||||||
*/
|
*/
|
||||||
int Lux::parseTuningData(const YamlObject &tuningData)
|
int Lux::parseTuningData(const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto value = tuningData["referenceExposureTime"].get<double>();
|
auto value = tuningData["referenceExposureTime"].get<double>();
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
class YamlObject;
|
class ValueNode;
|
||||||
|
|
||||||
namespace ipa {
|
namespace ipa {
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Lux
|
|||||||
public:
|
public:
|
||||||
Lux();
|
Lux();
|
||||||
|
|
||||||
int parseTuningData(const YamlObject &tuningData);
|
int parseTuningData(const ValueNode &tuningData);
|
||||||
double estimateLux(utils::Duration exposureTime,
|
double estimateLux(utils::Duration exposureTime,
|
||||||
double aGain, double dGain,
|
double aGain, double dGain,
|
||||||
const Histogram &yHist) const;
|
const Histogram &yHist) const;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace ipa {
|
|||||||
* \fn Module::createAlgorithms()
|
* \fn Module::createAlgorithms()
|
||||||
* \brief Create algorithms from YAML configuration data
|
* \brief Create algorithms from YAML configuration data
|
||||||
* \param[in] context The IPA context
|
* \param[in] context The IPA context
|
||||||
* \param[in] algorithms Algorithms configuration data as a parsed YamlObject
|
* \param[in] algorithms Algorithms configuration data as a parsed ValueNode
|
||||||
*
|
*
|
||||||
* This function iterates over the list of \a algorithms parsed from the YAML
|
* This function iterates over the list of \a algorithms parsed from the YAML
|
||||||
* configuration file, and instantiates and initializes the corresponding
|
* configuration file, and instantiates and initializes the corresponding
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "algorithm.h"
|
#include "algorithm.h"
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
return algorithms_;
|
return algorithms_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int createAlgorithms(Context &context, const YamlObject &algorithms)
|
int createAlgorithms(Context &context, const ValueNode &algorithms)
|
||||||
{
|
{
|
||||||
const auto &list = algorithms.asList();
|
const auto &list = algorithms.asList();
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int createAlgorithm(Context &context, const YamlObject &data)
|
int createAlgorithm(Context &context, const ValueNode &data)
|
||||||
{
|
{
|
||||||
const auto &[name, algoData] = *data.asDict().begin();
|
const auto &[name, algoData] = *data.asDict().begin();
|
||||||
|
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ std::string Pwl::toString() const
|
|||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
std::optional<ipa::Pwl>
|
std::optional<ipa::Pwl>
|
||||||
YamlObject::Accessor<ipa::Pwl>::get(const YamlObject &obj) const
|
ValueNode::Accessor<ipa::Pwl>::get(const ValueNode &obj) const
|
||||||
{
|
{
|
||||||
/* Treat a single value as single point PWL. */
|
/* Treat a single value as single point PWL. */
|
||||||
if (obj.isValue()) {
|
if (obj.isValue()) {
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ Agc::Agc()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Agc::init(IPAContext &context, const YamlObject &tuningData)
|
int Agc::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
int ret = parseTuningData(tuningData);
|
int ret = parseTuningData(tuningData);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
Agc();
|
Agc();
|
||||||
~Agc() = default;
|
~Agc() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file blc.h
|
* \file blc.h
|
||||||
@@ -36,7 +36,7 @@ BlackLevelCorrection::BlackLevelCorrection()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,
|
int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,
|
||||||
const YamlObject &tuningData)
|
const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
offset00 = tuningData["offset00"].get<uint32_t>(0);
|
offset00 = tuningData["offset00"].get<uint32_t>(0);
|
||||||
offset01 = tuningData["offset01"].get<uint32_t>(0);
|
offset01 = tuningData["offset01"].get<uint32_t>(0);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
BlackLevelCorrection();
|
BlackLevelCorrection();
|
||||||
~BlackLevelCorrection() = default;
|
~BlackLevelCorrection() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "lsc.h"
|
#include "lsc.h"
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ namespace ipa::mali_c55::algorithms {
|
|||||||
|
|
||||||
LOG_DEFINE_CATEGORY(MaliC55Lsc)
|
LOG_DEFINE_CATEGORY(MaliC55Lsc)
|
||||||
|
|
||||||
int Lsc::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)
|
int Lsc::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
if (!tuningData.contains("meshScale")) {
|
if (!tuningData.contains("meshScale")) {
|
||||||
LOG(MaliC55Lsc, Error) << "meshScale missing from tuningData";
|
LOG(MaliC55Lsc, Error) << "meshScale missing from tuningData";
|
||||||
@@ -24,7 +24,7 @@ int Lsc::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData
|
|||||||
|
|
||||||
meshScale_ = tuningData["meshScale"].get<uint32_t>(0);
|
meshScale_ = tuningData["meshScale"].get<uint32_t>(0);
|
||||||
|
|
||||||
const YamlObject &yamlSets = tuningData["sets"];
|
const ValueNode &yamlSets = tuningData["sets"];
|
||||||
if (!yamlSets.isList()) {
|
if (!yamlSets.isList()) {
|
||||||
LOG(MaliC55Lsc, Error) << "LSC tables missing or invalid";
|
LOG(MaliC55Lsc, Error) << "LSC tables missing or invalid";
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
Lsc() = default;
|
Lsc() = default;
|
||||||
~Lsc() = default;
|
~Lsc() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
MaliC55Params *params) override;
|
MaliC55Params *params) override;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ int IPAMaliC55::init(const IPASettings &settings, const IPAConfigInfo &ipaConfig
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<libcamera::YamlObject> data = YamlParser::parse(file);
|
std::unique_ptr<ValueNode> data = YamlParser::parse(file);
|
||||||
if (!data)
|
if (!data)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
#include <libcamera/ipa/core_ipa_interface.h>
|
#include <libcamera/ipa/core_ipa_interface.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "libipa/histogram.h"
|
#include "libipa/histogram.h"
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ namespace ipa::rkisp1::algorithms {
|
|||||||
|
|
||||||
LOG_DEFINE_CATEGORY(RkISP1Agc)
|
LOG_DEFINE_CATEGORY(RkISP1Agc)
|
||||||
|
|
||||||
int Agc::parseMeteringModes(IPAContext &context, const YamlObject &tuningData)
|
int Agc::parseMeteringModes(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
if (!tuningData.isDictionary())
|
if (!tuningData.isDictionary())
|
||||||
LOG(RkISP1Agc, Warning)
|
LOG(RkISP1Agc, Warning)
|
||||||
@@ -127,14 +127,14 @@ Agc::Agc()
|
|||||||
/**
|
/**
|
||||||
* \brief Initialise the AGC algorithm from tuning files
|
* \brief Initialise the AGC algorithm from tuning files
|
||||||
* \param[in] context The shared IPA context
|
* \param[in] context The shared IPA context
|
||||||
* \param[in] tuningData The YamlObject containing Agc tuning data
|
* \param[in] tuningData The ValueNode containing Agc tuning data
|
||||||
*
|
*
|
||||||
* This function calls the base class' tuningData parsers to discover which
|
* This function calls the base class' tuningData parsers to discover which
|
||||||
* control values are supported.
|
* control values are supported.
|
||||||
*
|
*
|
||||||
* \return 0 on success or errors from the base class
|
* \return 0 on success or errors from the base class
|
||||||
*/
|
*/
|
||||||
int Agc::init(IPAContext &context, const YamlObject &tuningData)
|
int Agc::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
const YamlObject &yamlMeteringModes = tuningData["AeMeteringMode"];
|
const ValueNode &yamlMeteringModes = tuningData["AeMeteringMode"];
|
||||||
ret = parseMeteringModes(context, yamlMeteringModes);
|
ret = parseMeteringModes(context, yamlMeteringModes);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
Agc();
|
Agc();
|
||||||
~Agc() = default;
|
~Agc() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context,
|
void queueRequest(IPAContext &context,
|
||||||
const uint32_t frame,
|
const uint32_t frame,
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
ControlList &metadata) override;
|
ControlList &metadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int parseMeteringModes(IPAContext &context, const YamlObject &tuningData);
|
int parseMeteringModes(IPAContext &context, const ValueNode &tuningData);
|
||||||
uint8_t computeHistogramPredivider(const Size &size,
|
uint8_t computeHistogramPredivider(const Size &size,
|
||||||
enum rkisp1_cif_isp_histogram_mode mode);
|
enum rkisp1_cif_isp_histogram_mode mode);
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Awb::Awb()
|
|||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int Awb::init(IPAContext &context, const YamlObject &tuningData)
|
int Awb::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto &cmap = context.ctrlMap;
|
auto &cmap = context.ctrlMap;
|
||||||
cmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,
|
cmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
Awb();
|
Awb();
|
||||||
~Awb() = default;
|
~Awb() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file blc.h
|
* \file blc.h
|
||||||
@@ -53,7 +53,7 @@ BlackLevelCorrection::BlackLevelCorrection()
|
|||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int BlackLevelCorrection::init(IPAContext &context, const YamlObject &tuningData)
|
int BlackLevelCorrection::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
std::optional<int16_t> levelRed = tuningData["R"].get<int16_t>();
|
std::optional<int16_t> levelRed = tuningData["R"].get<int16_t>();
|
||||||
std::optional<int16_t> levelGreenR = tuningData["Gr"].get<int16_t>();
|
std::optional<int16_t> levelGreenR = tuningData["Gr"].get<int16_t>();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
BlackLevelCorrection();
|
BlackLevelCorrection();
|
||||||
~BlackLevelCorrection() = default;
|
~BlackLevelCorrection() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include <libcamera/ipa/core_ipa_interface.h>
|
#include <libcamera/ipa/core_ipa_interface.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "libipa/fixedpoint.h"
|
#include "libipa/fixedpoint.h"
|
||||||
#include "libipa/interpolator.h"
|
#include "libipa/interpolator.h"
|
||||||
@@ -41,7 +41,7 @@ constexpr Matrix<float, 3, 3> kIdentity3x3 = Matrix<float, 3, 3>::identity();
|
|||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)
|
int Ccm::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto &cmap = context.ctrlMap;
|
auto &cmap = context.ctrlMap;
|
||||||
cmap[&controls::ColourCorrectionMatrix] = ControlInfo(
|
cmap[&controls::ColourCorrectionMatrix] = ControlInfo(
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
Ccm() {}
|
Ccm() {}
|
||||||
~Ccm() = default;
|
~Ccm() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context,
|
void queueRequest(IPAContext &context,
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
ControlList &metadata) override;
|
ControlList &metadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseYaml(const YamlObject &tuningData);
|
void parseYaml(const ValueNode &tuningData);
|
||||||
void setParameters(struct rkisp1_cif_isp_ctk_config &config,
|
void setParameters(struct rkisp1_cif_isp_ctk_config &config,
|
||||||
const Matrix<float, 3, 3> &matrix,
|
const Matrix<float, 3, 3> &matrix,
|
||||||
const Matrix<int16_t, 3, 1> &offsets);
|
const Matrix<int16_t, 3, 1> &offsets);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ constexpr float kHueScale = -90.0f;
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int ColorProcessing::init(IPAContext &context,
|
int ColorProcessing::init(IPAContext &context,
|
||||||
[[maybe_unused]] const YamlObject &tuningData)
|
[[maybe_unused]] const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto &cmap = context.ctrlMap;
|
auto &cmap = context.ctrlMap;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
ColorProcessing() = default;
|
ColorProcessing() = default;
|
||||||
~ColorProcessing() = default;
|
~ColorProcessing() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "linux/rkisp1-config.h"
|
#include "linux/rkisp1-config.h"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ DefectPixelClusterCorrection::DefectPixelClusterCorrection()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
||||||
const YamlObject &tuningData)
|
const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
config_.mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE;
|
config_.mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE;
|
||||||
config_.output_mode = RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER
|
config_.output_mode = RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER
|
||||||
@@ -55,7 +55,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
? RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET : 0;
|
? RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET : 0;
|
||||||
|
|
||||||
/* Get all defined sets to apply (up to 3). */
|
/* Get all defined sets to apply (up to 3). */
|
||||||
const YamlObject &setsObject = tuningData["sets"];
|
const ValueNode &setsObject = tuningData["sets"];
|
||||||
if (!setsObject.isList()) {
|
if (!setsObject.isList()) {
|
||||||
LOG(RkISP1Dpcc, Error)
|
LOG(RkISP1Dpcc, Error)
|
||||||
<< "'sets' parameter not found in tuning file";
|
<< "'sets' parameter not found in tuning file";
|
||||||
@@ -71,14 +71,14 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
|
|
||||||
for (std::size_t i = 0; i < setsObject.size(); ++i) {
|
for (std::size_t i = 0; i < setsObject.size(); ++i) {
|
||||||
struct rkisp1_cif_isp_dpcc_methods_config &method = config_.methods[i];
|
struct rkisp1_cif_isp_dpcc_methods_config &method = config_.methods[i];
|
||||||
const YamlObject &set = setsObject[i];
|
const ValueNode &set = setsObject[i];
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
|
|
||||||
/* Enable set if described in YAML tuning file. */
|
/* Enable set if described in YAML tuning file. */
|
||||||
config_.set_use |= 1 << i;
|
config_.set_use |= 1 << i;
|
||||||
|
|
||||||
/* PG Method */
|
/* PG Method */
|
||||||
const YamlObject &pgObject = set["pg-factor"];
|
const ValueNode &pgObject = set["pg-factor"];
|
||||||
|
|
||||||
if (pgObject.contains("green")) {
|
if (pgObject.contains("green")) {
|
||||||
method.method |=
|
method.method |=
|
||||||
@@ -97,7 +97,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* RO Method */
|
/* RO Method */
|
||||||
const YamlObject &roObject = set["ro-limits"];
|
const ValueNode &roObject = set["ro-limits"];
|
||||||
|
|
||||||
if (roObject.contains("green")) {
|
if (roObject.contains("green")) {
|
||||||
method.method |=
|
method.method |=
|
||||||
@@ -118,7 +118,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* RG Method */
|
/* RG Method */
|
||||||
const YamlObject &rgObject = set["rg-factor"];
|
const ValueNode &rgObject = set["rg-factor"];
|
||||||
method.rg_fac = 0;
|
method.rg_fac = 0;
|
||||||
|
|
||||||
if (rgObject.contains("green")) {
|
if (rgObject.contains("green")) {
|
||||||
@@ -138,7 +138,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* RND Method */
|
/* RND Method */
|
||||||
const YamlObject &rndOffsetsObject = set["rnd-offsets"];
|
const ValueNode &rndOffsetsObject = set["rnd-offsets"];
|
||||||
|
|
||||||
if (rndOffsetsObject.contains("green")) {
|
if (rndOffsetsObject.contains("green")) {
|
||||||
method.method |=
|
method.method |=
|
||||||
@@ -158,7 +158,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(i, value);
|
RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(i, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const YamlObject &rndThresholdObject = set["rnd-threshold"];
|
const ValueNode &rndThresholdObject = set["rnd-threshold"];
|
||||||
method.rnd_thresh = 0;
|
method.rnd_thresh = 0;
|
||||||
|
|
||||||
if (rndThresholdObject.contains("green")) {
|
if (rndThresholdObject.contains("green")) {
|
||||||
@@ -180,7 +180,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* LC Method */
|
/* LC Method */
|
||||||
const YamlObject &lcThresholdObject = set["line-threshold"];
|
const ValueNode &lcThresholdObject = set["line-threshold"];
|
||||||
method.line_thresh = 0;
|
method.line_thresh = 0;
|
||||||
|
|
||||||
if (lcThresholdObject.contains("green")) {
|
if (lcThresholdObject.contains("green")) {
|
||||||
@@ -201,7 +201,7 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(value);
|
RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const YamlObject &lcTMadFactorObject = set["line-mad-factor"];
|
const ValueNode &lcTMadFactorObject = set["line-mad-factor"];
|
||||||
method.line_mad_fac = 0;
|
method.line_mad_fac = 0;
|
||||||
|
|
||||||
if (lcTMadFactorObject.contains("green")) {
|
if (lcTMadFactorObject.contains("green")) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
DefectPixelClusterCorrection();
|
DefectPixelClusterCorrection();
|
||||||
~DefectPixelClusterCorrection() = default;
|
~DefectPixelClusterCorrection() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
RkISP1Params *params) override;
|
RkISP1Params *params) override;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Dpf::Dpf()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int Dpf::init([[maybe_unused]] IPAContext &context,
|
int Dpf::init([[maybe_unused]] IPAContext &context,
|
||||||
const YamlObject &tuningData)
|
const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> values;
|
std::vector<uint8_t> values;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ int Dpf::init([[maybe_unused]] IPAContext &context,
|
|||||||
* The domain kernel is configured with a 9x9 kernel for the green
|
* The domain kernel is configured with a 9x9 kernel for the green
|
||||||
* pixels, and a 13x9 or 9x9 kernel for red and blue pixels.
|
* pixels, and a 13x9 or 9x9 kernel for red and blue pixels.
|
||||||
*/
|
*/
|
||||||
const YamlObject &dFObject = tuningData["DomainFilter"];
|
const ValueNode &dFObject = tuningData["DomainFilter"];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the green component, we have the 9x9 kernel specified
|
* For the green component, we have the 9x9 kernel specified
|
||||||
@@ -134,7 +134,7 @@ int Dpf::init([[maybe_unused]] IPAContext &context,
|
|||||||
* which stores a piecewise linear function that characterizes the
|
* which stores a piecewise linear function that characterizes the
|
||||||
* sensor noise profile as a noise level function curve (NLF).
|
* sensor noise profile as a noise level function curve (NLF).
|
||||||
*/
|
*/
|
||||||
const YamlObject &rFObject = tuningData["NoiseLevelFunction"];
|
const ValueNode &rFObject = tuningData["NoiseLevelFunction"];
|
||||||
|
|
||||||
std::vector<uint16_t> nllValues;
|
std::vector<uint16_t> nllValues;
|
||||||
nllValues = rFObject["coeff"].get<std::vector<uint16_t>>().value_or(std::vector<uint16_t>{});
|
nllValues = rFObject["coeff"].get<std::vector<uint16_t>>().value_or(std::vector<uint16_t>{});
|
||||||
@@ -162,7 +162,7 @@ int Dpf::init([[maybe_unused]] IPAContext &context,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const YamlObject &fSObject = tuningData["FilterStrength"];
|
const ValueNode &fSObject = tuningData["FilterStrength"];
|
||||||
|
|
||||||
strengthConfig_.r = fSObject["r"].get<uint16_t>(64);
|
strengthConfig_.r = fSObject["r"].get<uint16_t>(64);
|
||||||
strengthConfig_.g = fSObject["g"].get<uint16_t>(64);
|
strengthConfig_.g = fSObject["g"].get<uint16_t>(64);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
Dpf();
|
Dpf();
|
||||||
~Dpf() = default;
|
~Dpf() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
const ControlList &controls) override;
|
const ControlList &controls) override;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ static constexpr uint32_t kFiltModeDefault = 0x000004f2;
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int Filter::init(IPAContext &context,
|
int Filter::init(IPAContext &context,
|
||||||
[[maybe_unused]] const YamlObject &tuningData)
|
[[maybe_unused]] const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
auto &cmap = context.ctrlMap;
|
auto &cmap = context.ctrlMap;
|
||||||
cmap[&controls::Sharpness] = ControlInfo(0.0f, 10.0f, 1.0f);
|
cmap[&controls::Sharpness] = ControlInfo(0.0f, 10.0f, 1.0f);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
Filter() = default;
|
Filter() = default;
|
||||||
~Filter() = default;
|
~Filter() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
const ControlList &controls) override;
|
const ControlList &controls) override;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "linux/rkisp1-config.h"
|
#include "linux/rkisp1-config.h"
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ const float kDefaultGamma = 2.2f;
|
|||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int GammaOutCorrection::init(IPAContext &context, const YamlObject &tuningData)
|
int GammaOutCorrection::init(IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
if (context.hw.numGammaOutSamples !=
|
if (context.hw.numGammaOutSamples !=
|
||||||
RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10) {
|
RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
GammaOutCorrection() = default;
|
GammaOutCorrection() = default;
|
||||||
~GammaOutCorrection() = default;
|
~GammaOutCorrection() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context,
|
int configure(IPAContext &context,
|
||||||
const IPACameraSensorInfo &configInfo) override;
|
const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context,
|
void queueRequest(IPAContext &context,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "linux/rkisp1-config.h"
|
#include "linux/rkisp1-config.h"
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ GammaSensorLinearization::GammaSensorLinearization()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context,
|
int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context,
|
||||||
const YamlObject &tuningData)
|
const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
std::vector<uint16_t> xIntervals =
|
std::vector<uint16_t> xIntervals =
|
||||||
tuningData["x-intervals"].get<std::vector<uint16_t>>().value_or(std::vector<uint16_t>{});
|
tuningData["x-intervals"].get<std::vector<uint16_t>>().value_or(std::vector<uint16_t>{});
|
||||||
@@ -75,7 +75,7 @@ int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context,
|
|||||||
for (unsigned int i = 0; i < kDegammaXIntervals; ++i)
|
for (unsigned int i = 0; i < kDegammaXIntervals; ++i)
|
||||||
gammaDx_[i / 8] |= (xIntervals[i] & 0x07) << ((i % 8) * 4);
|
gammaDx_[i / 8] |= (xIntervals[i] & 0x07) << ((i % 8) * 4);
|
||||||
|
|
||||||
const YamlObject &yObject = tuningData["y"];
|
const ValueNode &yObject = tuningData["y"];
|
||||||
if (!yObject.isDictionary()) {
|
if (!yObject.isDictionary()) {
|
||||||
LOG(RkISP1Gsl, Error)
|
LOG(RkISP1Gsl, Error)
|
||||||
<< "Issue while parsing 'y' in tuning file: "
|
<< "Issue while parsing 'y' in tuning file: "
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
GammaSensorLinearization();
|
GammaSensorLinearization();
|
||||||
~GammaSensorLinearization() = default;
|
~GammaSensorLinearization() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
RkISP1Params *params) override;
|
RkISP1Params *params) override;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "libipa/lsc_polynomial.h"
|
#include "libipa/lsc_polynomial.h"
|
||||||
#include "linux/rkisp1-config.h"
|
#include "linux/rkisp1-config.h"
|
||||||
@@ -184,14 +184,14 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int parseLscData(const YamlObject &yamlSets,
|
int parseLscData(const ValueNode &yamlSets,
|
||||||
LensShadingCorrection::ShadingDescriptorMap &lscData);
|
LensShadingCorrection::ShadingDescriptorMap &lscData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Size sensorSize_;
|
Size sensorSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
int LscPolynomialLoader::parseLscData(const YamlObject &yamlSets,
|
int LscPolynomialLoader::parseLscData(const ValueNode &yamlSets,
|
||||||
LensShadingCorrection::ShadingDescriptorMap &lscData)
|
LensShadingCorrection::ShadingDescriptorMap &lscData)
|
||||||
{
|
{
|
||||||
const auto &sets = yamlSets.asList();
|
const auto &sets = yamlSets.asList();
|
||||||
@@ -261,15 +261,15 @@ private:
|
|||||||
class LscTableLoader
|
class LscTableLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int parseLscData(const YamlObject &yamlSets,
|
int parseLscData(const ValueNode &yamlSets,
|
||||||
LensShadingCorrection::ShadingDescriptorMap &lscData);
|
LensShadingCorrection::ShadingDescriptorMap &lscData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<uint16_t> parseTable(const YamlObject &tuningData,
|
std::vector<uint16_t> parseTable(const ValueNode &tuningData,
|
||||||
const char *prop);
|
const char *prop);
|
||||||
};
|
};
|
||||||
|
|
||||||
int LscTableLoader::parseLscData(const YamlObject &yamlSets,
|
int LscTableLoader::parseLscData(const ValueNode &yamlSets,
|
||||||
LensShadingCorrection::ShadingDescriptorMap &lscData)
|
LensShadingCorrection::ShadingDescriptorMap &lscData)
|
||||||
{
|
{
|
||||||
const auto &sets = yamlSets.asList();
|
const auto &sets = yamlSets.asList();
|
||||||
@@ -310,7 +310,7 @@ int LscTableLoader::parseLscData(const YamlObject &yamlSets,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint16_t> LscTableLoader::parseTable(const YamlObject &tuningData,
|
std::vector<uint16_t> LscTableLoader::parseTable(const ValueNode &tuningData,
|
||||||
const char *prop)
|
const char *prop)
|
||||||
{
|
{
|
||||||
static constexpr unsigned int kLscNumSamples =
|
static constexpr unsigned int kLscNumSamples =
|
||||||
@@ -329,7 +329,7 @@ std::vector<uint16_t> LscTableLoader::parseTable(const YamlObject &tuningData,
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> parseSizes(const YamlObject &tuningData,
|
std::vector<double> parseSizes(const ValueNode &tuningData,
|
||||||
const char *prop)
|
const char *prop)
|
||||||
{
|
{
|
||||||
std::vector<double> sizes =
|
std::vector<double> sizes =
|
||||||
@@ -375,7 +375,7 @@ LensShadingCorrection::LensShadingCorrection()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
|
int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
|
||||||
const YamlObject &tuningData)
|
const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
xSize_ = parseSizes(tuningData, "x-size");
|
xSize_ = parseSizes(tuningData, "x-size");
|
||||||
ySize_ = parseSizes(tuningData, "y-size");
|
ySize_ = parseSizes(tuningData, "y-size");
|
||||||
@@ -384,7 +384,7 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Get all defined sets to apply. */
|
/* Get all defined sets to apply. */
|
||||||
const YamlObject &yamlSets = tuningData["sets"];
|
const ValueNode &yamlSets = tuningData["sets"];
|
||||||
if (!yamlSets.isList()) {
|
if (!yamlSets.isList()) {
|
||||||
LOG(RkISP1Lsc, Error)
|
LOG(RkISP1Lsc, Error)
|
||||||
<< "'sets' parameter not found in tuning file";
|
<< "'sets' parameter not found in tuning file";
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
LensShadingCorrection();
|
LensShadingCorrection();
|
||||||
~LensShadingCorrection() = default;
|
~LensShadingCorrection() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Lux::Lux()
|
|||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int Lux::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)
|
int Lux::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
return lux_.parseTuningData(tuningData);
|
return lux_.parseTuningData(tuningData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Lux : public Algorithm
|
|||||||
public:
|
public:
|
||||||
Lux();
|
Lux();
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
void prepare(IPAContext &context, const uint32_t frame,
|
void prepare(IPAContext &context, const uint32_t frame,
|
||||||
IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
RkISP1Params *params) override;
|
RkISP1Params *params) override;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include <libipa/agc_mean_luminance.h>
|
#include <libipa/agc_mean_luminance.h>
|
||||||
#include <libipa/histogram.h>
|
#include <libipa/histogram.h>
|
||||||
@@ -110,7 +110,7 @@ WideDynamicRange::WideDynamicRange()
|
|||||||
* \copydoc libcamera::ipa::Algorithm::init
|
* \copydoc libcamera::ipa::Algorithm::init
|
||||||
*/
|
*/
|
||||||
int WideDynamicRange::init([[maybe_unused]] IPAContext &context,
|
int WideDynamicRange::init([[maybe_unused]] IPAContext &context,
|
||||||
[[maybe_unused]] const YamlObject &tuningData)
|
[[maybe_unused]] const ValueNode &tuningData)
|
||||||
{
|
{
|
||||||
if (!(context.hw.supportedBlocks & 1 << RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR)) {
|
if (!(context.hw.supportedBlocks & 1 << RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR)) {
|
||||||
LOG(RkISP1Wdr, Error)
|
LOG(RkISP1Wdr, Error)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
WideDynamicRange();
|
WideDynamicRange();
|
||||||
~WideDynamicRange() = default;
|
~WideDynamicRange() = default;
|
||||||
|
|
||||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
int init(IPAContext &context, const ValueNode &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
||||||
|
|
||||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<libcamera::YamlObject> data = YamlParser::parse(file);
|
std::unique_ptr<ValueNode> data = YamlParser::parse(file);
|
||||||
if (!data)
|
if (!data)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
using namespace RPiController;
|
using namespace RPiController;
|
||||||
|
|
||||||
int Algorithm::read([[maybe_unused]] const libcamera::YamlObject ¶ms)
|
int Algorithm::read([[maybe_unused]] const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~Algorithm() = default;
|
virtual ~Algorithm() = default;
|
||||||
virtual char const *name() const = 0;
|
virtual char const *name() const = 0;
|
||||||
virtual int read(const libcamera::YamlObject ¶ms);
|
virtual int read(const libcamera::ValueNode ¶ms);
|
||||||
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);
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ int Controller::read(char const *filename)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<YamlObject> root = YamlParser::parse(file);
|
std::unique_ptr<ValueNode> root = YamlParser::parse(file);
|
||||||
if (!root)
|
if (!root)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ int Controller::read(char const *filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Controller::createAlgorithm(const std::string &name, const YamlObject ¶ms)
|
int Controller::createAlgorithm(const std::string &name, const ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
/* Any algorithm may be disabled by setting "enabled" to false. */
|
/* Any algorithm may be disabled by setting "enabled" to false. */
|
||||||
bool enabled = params["enabled"].get<bool>(true);
|
bool enabled = params["enabled"].get<bool>(true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
#include "libcamera/internal/yaml_object.h"
|
#include "libcamera/internal/value_node.h"
|
||||||
|
|
||||||
#include "camera_mode.h"
|
#include "camera_mode.h"
|
||||||
#include "device_status.h"
|
#include "device_status.h"
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
const HardwareConfig &getHardwareConfig() const;
|
const HardwareConfig &getHardwareConfig() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int createAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms);
|
int createAlgorithm(const std::string &name, const libcamera::ValueNode ¶ms);
|
||||||
|
|
||||||
Metadata globalMetadata_;
|
Metadata globalMetadata_;
|
||||||
std::vector<AlgorithmPtr> algorithms_;
|
std::vector<AlgorithmPtr> algorithms_;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Af::CfgParams::CfgParams()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void readNumber(T &dest, const libcamera::YamlObject ¶ms, char const *name)
|
static void readNumber(T &dest, const libcamera::ValueNode ¶ms, char const *name)
|
||||||
{
|
{
|
||||||
auto value = params[name].get<T>();
|
auto value = params[name].get<T>();
|
||||||
if (value)
|
if (value)
|
||||||
@@ -77,7 +77,7 @@ static void readNumber(T &dest, const libcamera::YamlObject ¶ms, char const
|
|||||||
LOG(RPiAf, Warning) << "Missing parameter \"" << name << "\"";
|
LOG(RPiAf, Warning) << "Missing parameter \"" << name << "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Af::RangeDependentParams::read(const libcamera::YamlObject ¶ms)
|
void Af::RangeDependentParams::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
|
|
||||||
readNumber<double>(focusMin, params, "min");
|
readNumber<double>(focusMin, params, "min");
|
||||||
@@ -85,7 +85,7 @@ void Af::RangeDependentParams::read(const libcamera::YamlObject ¶ms)
|
|||||||
readNumber<double>(focusDefault, params, "default");
|
readNumber<double>(focusDefault, params, "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Af::SpeedDependentParams::read(const libcamera::YamlObject ¶ms)
|
void Af::SpeedDependentParams::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
readNumber<double>(stepCoarse, params, "step_coarse");
|
readNumber<double>(stepCoarse, params, "step_coarse");
|
||||||
readNumber<double>(stepFine, params, "step_fine");
|
readNumber<double>(stepFine, params, "step_fine");
|
||||||
@@ -100,7 +100,7 @@ void Af::SpeedDependentParams::read(const libcamera::YamlObject ¶ms)
|
|||||||
readNumber<uint32_t>(stepFrames, params, "step_frames");
|
readNumber<uint32_t>(stepFrames, params, "step_frames");
|
||||||
}
|
}
|
||||||
|
|
||||||
int Af::CfgParams::read(const libcamera::YamlObject ¶ms)
|
int Af::CfgParams::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
if (params.contains("ranges")) {
|
if (params.contains("ranges")) {
|
||||||
auto &rr = params["ranges"];
|
auto &rr = params["ranges"];
|
||||||
@@ -226,7 +226,7 @@ char const *Af::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Af::read(const libcamera::YamlObject ¶ms)
|
int Af::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
return cfg_.read(params);
|
return cfg_.read(params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
Af(Controller *controller = NULL);
|
Af(Controller *controller = NULL);
|
||||||
~Af();
|
~Af();
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void initialise() override;
|
void initialise() override;
|
||||||
|
|
||||||
/* IPA calls */
|
/* IPA calls */
|
||||||
@@ -87,7 +87,7 @@ private:
|
|||||||
double focusDefault; /* default setting ("hyperfocal") */
|
double focusDefault; /* default setting ("hyperfocal") */
|
||||||
|
|
||||||
RangeDependentParams();
|
RangeDependentParams();
|
||||||
void read(const libcamera::YamlObject ¶ms);
|
void read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpeedDependentParams {
|
struct SpeedDependentParams {
|
||||||
@@ -104,7 +104,7 @@ private:
|
|||||||
uint32_t stepFrames; /* frames to skip in between steps of a scan */
|
uint32_t stepFrames; /* frames to skip in between steps of a scan */
|
||||||
|
|
||||||
SpeedDependentParams();
|
SpeedDependentParams();
|
||||||
void read(const libcamera::YamlObject ¶ms);
|
void read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CfgParams {
|
struct CfgParams {
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
libcamera::ipa::Pwl map; /* converts dioptres -> lens driver position */
|
libcamera::ipa::Pwl map; /* converts dioptres -> lens driver position */
|
||||||
|
|
||||||
CfgParams();
|
CfgParams();
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
void initialise();
|
void initialise();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ char const *Agc::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Agc::read(const libcamera::YamlObject ¶ms)
|
int Agc::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* When there is only a single channel we can read the old style syntax.
|
* When there is only a single channel we can read the old style syntax.
|
||||||
|
|||||||
@@ -27,7 +27,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
unsigned int getConvergenceFrames() const override;
|
unsigned int getConvergenceFrames() const override;
|
||||||
std::vector<double> const &getWeights() const override;
|
std::vector<double> const &getWeights() const override;
|
||||||
void setEv(unsigned int channel, double ev) override;
|
void setEv(unsigned int channel, double ev) override;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ using namespace std::literals::chrono_literals;
|
|||||||
|
|
||||||
LOG_DECLARE_CATEGORY(RPiAgc)
|
LOG_DECLARE_CATEGORY(RPiAgc)
|
||||||
|
|
||||||
int AgcMeteringMode::read(const libcamera::YamlObject ¶ms)
|
int AgcMeteringMode::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
const YamlObject &yamlWeights = params["weights"];
|
const ValueNode &yamlWeights = params["weights"];
|
||||||
|
|
||||||
for (const auto &p : yamlWeights.asList()) {
|
for (const auto &p : yamlWeights.asList()) {
|
||||||
auto value = p.get<double>();
|
auto value = p.get<double>();
|
||||||
@@ -45,7 +45,7 @@ int AgcMeteringMode::read(const libcamera::YamlObject ¶ms)
|
|||||||
|
|
||||||
static std::tuple<int, std::string>
|
static std::tuple<int, std::string>
|
||||||
readMeteringModes(std::map<std::string, AgcMeteringMode> &metering_modes,
|
readMeteringModes(std::map<std::string, AgcMeteringMode> &metering_modes,
|
||||||
const libcamera::YamlObject ¶ms)
|
const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
std::string first;
|
std::string first;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -64,7 +64,7 @@ readMeteringModes(std::map<std::string, AgcMeteringMode> &metering_modes,
|
|||||||
return { 0, first };
|
return { 0, first };
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcExposureMode::read(const libcamera::YamlObject ¶ms)
|
int AgcExposureMode::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto value = params["shutter"].get<std::vector<double>>();
|
auto value = params["shutter"].get<std::vector<double>>();
|
||||||
if (!value)
|
if (!value)
|
||||||
@@ -94,7 +94,7 @@ int AgcExposureMode::read(const libcamera::YamlObject ¶ms)
|
|||||||
|
|
||||||
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,
|
||||||
const libcamera::YamlObject ¶ms)
|
const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
std::string first;
|
std::string first;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -113,7 +113,7 @@ readExposureModes(std::map<std::string, AgcExposureMode> &exposureModes,
|
|||||||
return { 0, first };
|
return { 0, first };
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcConstraint::read(const libcamera::YamlObject ¶ms)
|
int AgcConstraint::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
std::string boundString = params["bound"].get<std::string>("");
|
std::string boundString = params["bound"].get<std::string>("");
|
||||||
transform(boundString.begin(), boundString.end(),
|
transform(boundString.begin(), boundString.end(),
|
||||||
@@ -139,7 +139,7 @@ int AgcConstraint::read(const libcamera::YamlObject ¶ms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::tuple<int, AgcConstraintMode>
|
static std::tuple<int, AgcConstraintMode>
|
||||||
readConstraintMode(const libcamera::YamlObject ¶ms)
|
readConstraintMode(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
AgcConstraintMode mode;
|
AgcConstraintMode mode;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -158,7 +158,7 @@ readConstraintMode(const libcamera::YamlObject ¶ms)
|
|||||||
|
|
||||||
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,
|
||||||
const libcamera::YamlObject ¶ms)
|
const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
std::string first;
|
std::string first;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -175,7 +175,7 @@ readConstraintModes(std::map<std::string, AgcConstraintMode> &constraintModes,
|
|||||||
return { 0, first };
|
return { 0, first };
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcChannelConstraint::read(const libcamera::YamlObject ¶ms)
|
int AgcChannelConstraint::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto channelValue = params["channel"].get<unsigned int>();
|
auto channelValue = params["channel"].get<unsigned int>();
|
||||||
if (!channelValue) {
|
if (!channelValue) {
|
||||||
@@ -204,7 +204,7 @@ int AgcChannelConstraint::read(const libcamera::YamlObject ¶ms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int readChannelConstraints(std::vector<AgcChannelConstraint> &channelConstraints,
|
static int readChannelConstraints(std::vector<AgcChannelConstraint> &channelConstraints,
|
||||||
const libcamera::YamlObject ¶ms)
|
const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
for (const auto &p : params.asList()) {
|
for (const auto &p : params.asList()) {
|
||||||
AgcChannelConstraint constraint;
|
AgcChannelConstraint constraint;
|
||||||
@@ -218,7 +218,7 @@ static int readChannelConstraints(std::vector<AgcChannelConstraint> &channelCons
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcConfig::read(const libcamera::YamlObject ¶ms)
|
int AgcConfig::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
LOG(RPiAgc, Debug) << "AgcConfig";
|
LOG(RPiAgc, Debug) << "AgcConfig";
|
||||||
int ret;
|
int ret;
|
||||||
@@ -290,7 +290,7 @@ AgcChannel::AgcChannel()
|
|||||||
status_.ev = ev_;
|
status_.ev = ev_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AgcChannel::read(const libcamera::YamlObject ¶ms,
|
int AgcChannel::read(const libcamera::ValueNode ¶ms,
|
||||||
const Controller::HardwareConfig &hardwareConfig)
|
const Controller::HardwareConfig &hardwareConfig)
|
||||||
{
|
{
|
||||||
int ret = config_.read(params);
|
int ret = config_.read(params);
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ using AgcChannelTotalExposures = std::vector<libcamera::utils::Duration>;
|
|||||||
|
|
||||||
struct AgcMeteringMode {
|
struct AgcMeteringMode {
|
||||||
std::vector<double> weights;
|
std::vector<double> weights;
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AgcExposureMode {
|
struct AgcExposureMode {
|
||||||
std::vector<libcamera::utils::Duration> exposureTime;
|
std::vector<libcamera::utils::Duration> exposureTime;
|
||||||
std::vector<double> gain;
|
std::vector<double> gain;
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AgcConstraint {
|
struct AgcConstraint {
|
||||||
@@ -42,7 +42,7 @@ struct AgcConstraint {
|
|||||||
double qLo;
|
double qLo;
|
||||||
double qHi;
|
double qHi;
|
||||||
libcamera::ipa::Pwl yTarget;
|
libcamera::ipa::Pwl yTarget;
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<AgcConstraint> AgcConstraintMode;
|
typedef std::vector<AgcConstraint> AgcConstraintMode;
|
||||||
@@ -53,11 +53,11 @@ struct AgcChannelConstraint {
|
|||||||
Bound bound;
|
Bound bound;
|
||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
double factor;
|
double factor;
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AgcConfig {
|
struct AgcConfig {
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
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;
|
||||||
@@ -85,7 +85,7 @@ class AgcChannel
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AgcChannel();
|
AgcChannel();
|
||||||
int read(const libcamera::YamlObject ¶ms,
|
int read(const libcamera::ValueNode ¶ms,
|
||||||
const Controller::HardwareConfig &hardwareConfig);
|
const Controller::HardwareConfig &hardwareConfig);
|
||||||
unsigned int getConvergenceFrames() const;
|
unsigned int getConvergenceFrames() const;
|
||||||
std::vector<double> const &getWeights() const;
|
std::vector<double> const &getWeights() const;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ char const *Alsc::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int generateLut(Array2D<double> &lut, const libcamera::YamlObject ¶ms)
|
static int generateLut(Array2D<double> &lut, const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
/* These must be signed ints for the co-ordinate calculations below. */
|
/* These must be signed ints for the co-ordinate calculations below. */
|
||||||
int X = lut.dimensions().width, Y = lut.dimensions().height;
|
int X = lut.dimensions().width, Y = lut.dimensions().height;
|
||||||
@@ -82,7 +82,7 @@ static int generateLut(Array2D<double> &lut, const libcamera::YamlObject ¶ms
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int readLut(Array2D<double> &lut, const libcamera::YamlObject ¶ms)
|
static int readLut(Array2D<double> &lut, const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
if (params.size() != lut.size()) {
|
if (params.size() != lut.size()) {
|
||||||
LOG(RPiAlsc, Error) << "Invalid number of entries in LSC table";
|
LOG(RPiAlsc, Error) << "Invalid number of entries in LSC table";
|
||||||
@@ -101,7 +101,7 @@ static int readLut(Array2D<double> &lut, const libcamera::YamlObject ¶ms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int readCalibrations(std::vector<AlscCalibration> &calibrations,
|
static int readCalibrations(std::vector<AlscCalibration> &calibrations,
|
||||||
const libcamera::YamlObject ¶ms,
|
const libcamera::ValueNode ¶ms,
|
||||||
std::string const &name, const Size &size)
|
std::string const &name, const Size &size)
|
||||||
{
|
{
|
||||||
if (params.contains(name)) {
|
if (params.contains(name)) {
|
||||||
@@ -119,7 +119,7 @@ static int readCalibrations(std::vector<AlscCalibration> &calibrations,
|
|||||||
AlscCalibration calibration;
|
AlscCalibration calibration;
|
||||||
calibration.ct = lastCt = ct;
|
calibration.ct = lastCt = ct;
|
||||||
|
|
||||||
const libcamera::YamlObject &table = p["table"];
|
const libcamera::ValueNode &table = p["table"];
|
||||||
if (table.size() != size.width * size.height) {
|
if (table.size() != size.width * size.height) {
|
||||||
LOG(RPiAlsc, Error)
|
LOG(RPiAlsc, Error)
|
||||||
<< "Incorrect number of values for ct "
|
<< "Incorrect number of values for ct "
|
||||||
@@ -144,7 +144,7 @@ static int readCalibrations(std::vector<AlscCalibration> &calibrations,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Alsc::read(const libcamera::YamlObject ¶ms)
|
int Alsc::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
config_.tableSize = getHardwareConfig().awbRegions;
|
config_.tableSize = getHardwareConfig().awbRegions;
|
||||||
config_.framePeriod = params["frame_period"].get<uint16_t>(12);
|
config_.framePeriod = params["frame_period"].get<uint16_t>(12);
|
||||||
|
|||||||
@@ -112,7 +112,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) 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;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ LOG_DEFINE_CATEGORY(RPiAwb)
|
|||||||
|
|
||||||
constexpr double kDefaultCT = 4500.0;
|
constexpr double kDefaultCT = 4500.0;
|
||||||
|
|
||||||
static int readCtCurve(ipa::Pwl &ctR, ipa::Pwl &ctB, const libcamera::YamlObject ¶ms)
|
static int readCtCurve(ipa::Pwl &ctR, ipa::Pwl &ctB, const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
if (params.size() % 3) {
|
if (params.size() % 3) {
|
||||||
LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry";
|
LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry";
|
||||||
@@ -53,7 +53,7 @@ static int readCtCurve(ipa::Pwl &ctR, ipa::Pwl &ctB, const libcamera::YamlObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AwbMode::read(const libcamera::YamlObject ¶ms)
|
int AwbMode::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto value = params["lo"].get<double>();
|
auto value = params["lo"].get<double>();
|
||||||
if (!value)
|
if (!value)
|
||||||
@@ -68,7 +68,7 @@ int AwbMode::read(const libcamera::YamlObject ¶ms)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AwbConfig::read(const libcamera::YamlObject ¶ms)
|
int AwbConfig::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
namespace RPiController {
|
namespace RPiController {
|
||||||
|
|
||||||
struct AwbMode {
|
struct AwbMode {
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
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 */
|
||||||
};
|
};
|
||||||
@@ -25,7 +25,7 @@ struct AwbMode {
|
|||||||
struct AwbConfig {
|
struct AwbConfig {
|
||||||
AwbConfig()
|
AwbConfig()
|
||||||
: defaultMode(nullptr) {}
|
: defaultMode(nullptr) {}
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
bool hasCtCurve() const;
|
bool hasCtCurve() const;
|
||||||
|
|
||||||
/* Only repeat the AWB calculation every "this many" frames */
|
/* Only repeat the AWB calculation every "this many" frames */
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ constexpr double kDefaultCT = 4500.0;
|
|||||||
namespace RPiController {
|
namespace RPiController {
|
||||||
|
|
||||||
struct AwbPrior {
|
struct AwbPrior {
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
double lux; /* lux level */
|
double lux; /* lux level */
|
||||||
libcamera::ipa::Pwl prior; /* maps CT to prior log likelihood for this lux level */
|
libcamera::ipa::Pwl prior; /* maps CT to prior log likelihood for this lux level */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AwbBayesConfig {
|
struct AwbBayesConfig {
|
||||||
AwbBayesConfig() {}
|
AwbBayesConfig() {}
|
||||||
int read(const libcamera::YamlObject ¶ms, AwbConfig &config);
|
int read(const libcamera::ValueNode ¶ms, AwbConfig &config);
|
||||||
/* table of illuminant priors at different lux levels */
|
/* table of illuminant priors at different lux levels */
|
||||||
std::vector<AwbPrior> priors;
|
std::vector<AwbPrior> priors;
|
||||||
/*
|
/*
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
AwbBayes(Controller *controller = NULL);
|
AwbBayes(Controller *controller = NULL);
|
||||||
~AwbBayes();
|
~AwbBayes();
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepareStats() override;
|
void prepareStats() override;
|
||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
std::vector<libcamera::ipa::Pwl::Point> points_;
|
std::vector<libcamera::ipa::Pwl::Point> points_;
|
||||||
};
|
};
|
||||||
|
|
||||||
int AwbPrior::read(const libcamera::YamlObject ¶ms)
|
int AwbPrior::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto value = params["lux"].get<double>();
|
auto value = params["lux"].get<double>();
|
||||||
if (!value)
|
if (!value)
|
||||||
@@ -107,7 +107,7 @@ int AwbPrior::read(const libcamera::YamlObject ¶ms)
|
|||||||
return prior.empty() ? -EINVAL : 0;
|
return prior.empty() ? -EINVAL : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AwbBayesConfig::read(const libcamera::YamlObject ¶ms, AwbConfig &config)
|
int AwbBayesConfig::read(const libcamera::ValueNode ¶ms, AwbConfig &config)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ char const *AwbBayes::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AwbBayes::read(const libcamera::YamlObject ¶ms)
|
int AwbBayes::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ char const *BlackLevel::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BlackLevel::read(const libcamera::YamlObject ¶ms)
|
int BlackLevel::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
/* 64 in 10 bits scaled to 16 bits */
|
/* 64 in 10 bits scaled to 16 bits */
|
||||||
uint16_t blackLevel = params["black_level"].get<uint16_t>(4096);
|
uint16_t blackLevel = params["black_level"].get<uint16_t>(4096);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class BlackLevel : public BlackLevelAlgorithm
|
|||||||
public:
|
public:
|
||||||
BlackLevel(Controller *controller);
|
BlackLevel(Controller *controller);
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG,
|
void initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG,
|
||||||
uint16_t &blackLevelB) override;
|
uint16_t &blackLevelB) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ char const *Cac::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool arrayToSet(const libcamera::YamlObject ¶ms, std::vector<double> &inputArray, const Size &size)
|
static bool arrayToSet(const libcamera::ValueNode ¶ms, std::vector<double> &inputArray, const Size &size)
|
||||||
{
|
{
|
||||||
int num = 0;
|
int num = 0;
|
||||||
int max_num = (size.width + 1) * (size.height + 1);
|
int max_num = (size.width + 1) * (size.height + 1);
|
||||||
@@ -51,7 +51,7 @@ static void setStrength(std::vector<double> &inputArray, std::vector<double> &ou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Cac::read(const libcamera::YamlObject ¶ms)
|
int Cac::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
config_.enabled = params.contains("lut_rx") && params.contains("lut_ry") &&
|
config_.enabled = params.contains("lut_rx") && params.contains("lut_ry") &&
|
||||||
params.contains("lut_bx") && params.contains("lut_by");
|
params.contains("lut_bx") && params.contains("lut_by");
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Cac : public Algorithm
|
|||||||
public:
|
public:
|
||||||
Cac(Controller *controller = NULL);
|
Cac(Controller *controller = NULL);
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ char const *Ccm::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ccm::read(const libcamera::YamlObject ¶ms)
|
int Ccm::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
if (params.contains("saturation")) {
|
if (params.contains("saturation")) {
|
||||||
config_.saturation = params["saturation"].get<ipa::Pwl>(ipa::Pwl{});
|
config_.saturation = params["saturation"].get<ipa::Pwl>(ipa::Pwl{});
|
||||||
|
|||||||
@@ -31,7 +31,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void enableAuto() override;
|
void enableAuto() override;
|
||||||
void setSaturation(double saturation) override;
|
void setSaturation(double saturation) override;
|
||||||
void setCcm(Matrix3x3 const &matrix) override;
|
void setCcm(Matrix3x3 const &matrix) override;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ char const *Contrast::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Contrast::read(const libcamera::YamlObject ¶ms)
|
int Contrast::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
// enable adaptive enhancement by default
|
// enable adaptive enhancement by default
|
||||||
config_.ceEnable = params["ce_enable"].get<int>(1);
|
config_.ceEnable = params["ce_enable"].get<int>(1);
|
||||||
|
|||||||
@@ -35,7 +35,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void setBrightness(double brightness) override;
|
void setBrightness(double brightness) override;
|
||||||
void setContrast(double contrast) override;
|
void setContrast(double contrast) override;
|
||||||
void enableCe(bool enable) override;
|
void enableCe(bool enable) override;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ char const *Decompand::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Decompand::read(const libcamera::YamlObject ¶ms)
|
int Decompand::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
config_.bitdepth = params["bitdepth"].get<uint32_t>(0);
|
config_.bitdepth = params["bitdepth"].get<uint32_t>(0);
|
||||||
config_.decompandCurve = params["decompand_curve"].get<ipa::Pwl>(ipa::Pwl{});
|
config_.decompandCurve = params["decompand_curve"].get<ipa::Pwl>(ipa::Pwl{});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Decompand : public DecompandAlgorithm
|
|||||||
public:
|
public:
|
||||||
Decompand(Controller *controller = nullptr);
|
Decompand(Controller *controller = nullptr);
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void initialise() override;
|
void initialise() override;
|
||||||
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
|
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
|
||||||
void initialValues(libcamera::ipa::Pwl &decompandCurve) override;
|
void initialValues(libcamera::ipa::Pwl &decompandCurve) override;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ LOG_DEFINE_CATEGORY(RPiDenoise)
|
|||||||
|
|
||||||
#define NAME "rpi.denoise"
|
#define NAME "rpi.denoise"
|
||||||
|
|
||||||
int DenoiseConfig::read(const libcamera::YamlObject ¶ms)
|
int DenoiseConfig::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
sdnEnable = params.contains("sdn");
|
sdnEnable = params.contains("sdn");
|
||||||
if (sdnEnable) {
|
if (sdnEnable) {
|
||||||
@@ -82,7 +82,7 @@ char const *Denoise::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Denoise::read(const libcamera::YamlObject ¶ms)
|
int Denoise::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
if (!params.contains("normal")) {
|
if (!params.contains("normal")) {
|
||||||
configs_["normal"].read(params);
|
configs_["normal"].read(params);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct DenoiseConfig {
|
|||||||
bool tdnEnable;
|
bool tdnEnable;
|
||||||
bool sdnEnable;
|
bool sdnEnable;
|
||||||
bool cdnEnable;
|
bool cdnEnable;
|
||||||
int read(const libcamera::YamlObject ¶ms);
|
int read(const libcamera::ValueNode ¶ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Denoise : public DenoiseAlgorithm
|
class Denoise : public DenoiseAlgorithm
|
||||||
@@ -39,7 +39,7 @@ class Denoise : public DenoiseAlgorithm
|
|||||||
public:
|
public:
|
||||||
Denoise(Controller *controller);
|
Denoise(Controller *controller);
|
||||||
char const *name() const override;
|
char const *name() const override;
|
||||||
int read(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void initialise() override;
|
void initialise() override;
|
||||||
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
|
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ char const *Dpc::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Dpc::read(const libcamera::YamlObject ¶ms)
|
int Dpc::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
config_.strength = params["strength"].get<int>(1);
|
config_.strength = params["strength"].get<int>(1);
|
||||||
if (config_.strength < 0 || config_.strength > 2) {
|
if (config_.strength < 0 || config_.strength > 2) {
|
||||||
|
|||||||
@@ -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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ char const *Geq::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Geq::read(const libcamera::YamlObject ¶ms)
|
int Geq::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
config_.offset = params["offset"].get<uint16_t>(0);
|
config_.offset = params["offset"].get<uint16_t>(0);
|
||||||
config_.slope = params["slope"].get<double>(0.0);
|
config_.slope = params["slope"].get<double>(0.0);
|
||||||
|
|||||||
@@ -26,7 +26,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ LOG_DEFINE_CATEGORY(RPiHdr)
|
|||||||
|
|
||||||
#define NAME "rpi.hdr"
|
#define NAME "rpi.hdr"
|
||||||
|
|
||||||
void HdrConfig::read(const libcamera::YamlObject ¶ms, const std::string &modeName)
|
void HdrConfig::read(const libcamera::ValueNode ¶ms, const std::string &modeName)
|
||||||
{
|
{
|
||||||
name = modeName;
|
name = modeName;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ char const *Hdr::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Hdr::read(const libcamera::YamlObject ¶ms)
|
int Hdr::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
/* Make an "HDR off" mode by default so that tuning files don't have to. */
|
/* Make an "HDR off" mode by default so that tuning files don't have to. */
|
||||||
HdrConfig &offMode = config_["Off"];
|
HdrConfig &offMode = config_["Off"];
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ struct HdrConfig {
|
|||||||
uint8_t diffPower;
|
uint8_t diffPower;
|
||||||
double motionThreshold;
|
double motionThreshold;
|
||||||
|
|
||||||
void read(const libcamera::YamlObject ¶ms, const std::string &name);
|
void read(const libcamera::ValueNode ¶ms, const std::string &name);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Hdr : public HdrAlgorithm
|
class Hdr : public HdrAlgorithm
|
||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
Hdr(Controller *controller);
|
Hdr(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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) 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;
|
||||||
int setMode(std::string const &mode) override;
|
int setMode(std::string const &mode) override;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ char const *Lux::name() const
|
|||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lux::read(const libcamera::YamlObject ¶ms)
|
int Lux::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto value = params["reference_shutter_speed"].get<double>();
|
auto value = params["reference_shutter_speed"].get<double>();
|
||||||
if (!value)
|
if (!value)
|
||||||
|
|||||||
@@ -23,7 +23,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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
|
void switchMode(CameraMode const &cameraMode, Metadata *metadata) 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;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void Noise::switchMode(CameraMode const &cameraMode,
|
|||||||
modeFactor_ = std::max(1.0, cameraMode.noiseFactor);
|
modeFactor_ = std::max(1.0, cameraMode.noiseFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Noise::read(const libcamera::YamlObject ¶ms)
|
int Noise::read(const libcamera::ValueNode ¶ms)
|
||||||
{
|
{
|
||||||
auto value = params["reference_constant"].get<double>();
|
auto value = params["reference_constant"].get<double>();
|
||||||
if (!value)
|
if (!value)
|
||||||
|
|||||||
@@ -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(const libcamera::YamlObject ¶ms) override;
|
int read(const libcamera::ValueNode ¶ms) override;
|
||||||
void prepare(Metadata *imageMetadata) override;
|
void prepare(Metadata *imageMetadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user