libcamera: Adapt Vector class to new location
Change the namespace of the Vector class from libipa to libcamera and add it to the build. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
e506b45822
commit
cfd94e5f85
6 changed files with 11 additions and 16 deletions
|
@ -43,6 +43,7 @@ libcamera_internal_headers = files([
|
||||||
'v4l2_pixelformat.h',
|
'v4l2_pixelformat.h',
|
||||||
'v4l2_subdevice.h',
|
'v4l2_subdevice.h',
|
||||||
'v4l2_videodevice.h',
|
'v4l2_videodevice.h',
|
||||||
|
'vector.h',
|
||||||
'yaml_parser.h',
|
'yaml_parser.h',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,6 @@ namespace libcamera {
|
||||||
|
|
||||||
LOG_DECLARE_CATEGORY(Vector)
|
LOG_DECLARE_CATEGORY(Vector)
|
||||||
|
|
||||||
namespace ipa {
|
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
template<typename T, unsigned int Rows,
|
template<typename T, unsigned int Rows,
|
||||||
std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
|
std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
|
||||||
|
@ -329,11 +327,9 @@ bool operator!=(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)
|
||||||
bool vectorValidateYaml(const YamlObject &obj, unsigned int size);
|
bool vectorValidateYaml(const YamlObject &obj, unsigned int size);
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
} /* namespace ipa */
|
|
||||||
|
|
||||||
#ifndef __DOXYGEN__
|
#ifndef __DOXYGEN__
|
||||||
template<typename T, unsigned int Rows>
|
template<typename T, unsigned int Rows>
|
||||||
std::ostream &operator<<(std::ostream &out, const ipa::Vector<T, Rows> &v)
|
std::ostream &operator<<(std::ostream &out, const Vector<T, Rows> &v)
|
||||||
{
|
{
|
||||||
out << "Vector { ";
|
out << "Vector { ";
|
||||||
for (unsigned int i = 0; i < Rows; i++) {
|
for (unsigned int i = 0; i < Rows; i++) {
|
||||||
|
@ -346,13 +342,13 @@ std::ostream &operator<<(std::ostream &out, const ipa::Vector<T, Rows> &v)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, unsigned int Rows>
|
template<typename T, unsigned int Rows>
|
||||||
struct YamlObject::Getter<ipa::Vector<T, Rows>> {
|
struct YamlObject::Getter<Vector<T, Rows>> {
|
||||||
std::optional<ipa::Vector<T, Rows>> get(const YamlObject &obj) const
|
std::optional<Vector<T, Rows>> get(const YamlObject &obj) const
|
||||||
{
|
{
|
||||||
if (!ipa::vectorValidateYaml(obj, Rows))
|
if (!vectorValidateYaml(obj, Rows))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
ipa::Vector<T, Rows> vector;
|
Vector<T, Rows> vector;
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (const YamlObject &entry : obj.asList()) {
|
for (const YamlObject &entry : obj.asList()) {
|
||||||
|
|
|
@ -53,6 +53,7 @@ libcamera_internal_sources = files([
|
||||||
'v4l2_pixelformat.cpp',
|
'v4l2_pixelformat.cpp',
|
||||||
'v4l2_subdevice.cpp',
|
'v4l2_subdevice.cpp',
|
||||||
'v4l2_videodevice.cpp',
|
'v4l2_videodevice.cpp',
|
||||||
|
'vector.cpp',
|
||||||
'yaml_parser.cpp',
|
'yaml_parser.cpp',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* Vector and related operations
|
* Vector and related operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vector.h"
|
#include "libcamera/internal/vector.h"
|
||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@ namespace libcamera {
|
||||||
|
|
||||||
LOG_DEFINE_CATEGORY(Vector)
|
LOG_DEFINE_CATEGORY(Vector)
|
||||||
|
|
||||||
namespace ipa {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Vector
|
* \class Vector
|
||||||
* \brief Vector class
|
* \brief Vector class
|
||||||
|
@ -346,6 +344,4 @@ bool vectorValidateYaml(const YamlObject &obj, unsigned int size)
|
||||||
}
|
}
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
} /* namespace ipa */
|
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
|
|
|
@ -73,6 +73,7 @@ internal_tests = [
|
||||||
{'name': 'timer-thread', 'sources': ['timer-thread.cpp']},
|
{'name': 'timer-thread', 'sources': ['timer-thread.cpp']},
|
||||||
{'name': 'unique-fd', 'sources': ['unique-fd.cpp']},
|
{'name': 'unique-fd', 'sources': ['unique-fd.cpp']},
|
||||||
{'name': 'utils', 'sources': ['utils.cpp']},
|
{'name': 'utils', 'sources': ['utils.cpp']},
|
||||||
|
{'name': 'vector', 'sources': ['vector.cpp']},
|
||||||
{'name': 'yaml-parser', 'sources': ['yaml-parser.cpp']},
|
{'name': 'yaml-parser', 'sources': ['yaml-parser.cpp']},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
* Vector tests
|
* Vector tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../src/ipa/libipa/vector.h"
|
#include "libcamera/internal/vector.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace libcamera::ipa;
|
using namespace libcamera;
|
||||||
|
|
||||||
#define ASSERT_EQ(a, b) \
|
#define ASSERT_EQ(a, b) \
|
||||||
if ((a) != (b)) { \
|
if ((a) != (b)) { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue