summaryrefslogtreecommitdiff
path: root/src/ipa/libipa
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-06-13 04:12:29 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-06-16 03:28:25 +0300
commit31c9998bf042963f11e0c4f3687ee8ba0b7318cc (patch)
treefbb1980026f52c7ba45250044769f2f4bf7fb927 /src/ipa/libipa
parent0706c67711839c88accaf577ac27f7473137febe (diff)
ipa: libipa: pwl: Add a constructor that moves a Point vector
The Pwl::Pwl(const std::vector<Point> &) constructor is inefficient as it makes a copy of the given points vector. Add a second constructor that takes an rvalue reference to a points vector to provide move semantics. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa')
-rw-r--r--src/ipa/libipa/pwl.cpp11
-rw-r--r--src/ipa/libipa/pwl.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp
index 8b437dd1..cf864fbb 100644
--- a/src/ipa/libipa/pwl.cpp
+++ b/src/ipa/libipa/pwl.cpp
@@ -115,6 +115,17 @@ Pwl::Pwl(const std::vector<Point> &points)
}
/**
+ * \copydoc Pwl::Pwl(const std::vector<Point> &points)
+ *
+ * The contents of the \a points vector is moved to the newly constructed Pwl
+ * instance.
+ */
+Pwl::Pwl(std::vector<Point> &&points)
+ : points_(std::move(points))
+{
+}
+
+/**
* \brief Populate the piecewise linear function from yaml data
* \param[in] params Yaml data to populate the piecewise linear function with
*
diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h
index 02834231..8edb4d33 100644
--- a/src/ipa/libipa/pwl.h
+++ b/src/ipa/libipa/pwl.h
@@ -47,6 +47,8 @@ public:
Pwl();
Pwl(const std::vector<Point> &points);
+ Pwl(std::vector<Point> &&points);
+
int readYaml(const libcamera::YamlObject &params);
void append(double x, double y, double eps = 1e-6);