[11/11] ipa: libipa: pwl: Drop readYaml() function
diff mbox series

Message ID 20240613013944.23344-12-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • ipa: libipa: Vector and Pwl improvements
Related show

Commit Message

Laurent Pinchart June 13, 2024, 1:39 a.m. UTC
All users of the Pwl::readYaml() function have been removed. The
function is not used, and is deprecated in favour of YamlObject::get().
Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/ipa/libipa/pwl.cpp | 38 --------------------------------------
 src/ipa/libipa/pwl.h   |  2 --
 2 files changed, 40 deletions(-)

Comments

Paul Elder June 13, 2024, 8:11 a.m. UTC | #1
On Thu, Jun 13, 2024 at 04:39:44AM +0300, Laurent Pinchart wrote:
> All users of the Pwl::readYaml() function have been removed. The
> function is not used, and is deprecated in favour of YamlObject::get().
> Drop it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/ipa/libipa/pwl.cpp | 38 --------------------------------------
>  src/ipa/libipa/pwl.h   |  2 --
>  2 files changed, 40 deletions(-)
> 
> diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp
> index 3c639645fa3d..9b213754ec7d 100644
> --- a/src/ipa/libipa/pwl.cpp
> +++ b/src/ipa/libipa/pwl.cpp
> @@ -125,44 +125,6 @@ Pwl::Pwl(std::vector<Point> &&points)
>  {
>  }
>  
> -/**
> - * \brief Populate the piecewise linear function from yaml data
> - * \param[in] params Yaml data to populate the piecewise linear function with
> - *
> - * Any existing points in the piecewise linear function *will* be overwritten.
> - *
> - * The yaml data is expected to be a list with an even number of numerical
> - * elements. These will be parsed in pairs into x and y points in the piecewise
> - * linear function, and added in order. x must be monotonically increasing.
> - *
> - * \return 0 on success, negative error code otherwise
> - */
> -int Pwl::readYaml(const libcamera::YamlObject &params)
> -{
> -	if (!params.size() || params.size() % 2)
> -		return -EINVAL;
> -
> -	const auto &list = params.asList();
> -
> -	points_.clear();
> -
> -	for (auto it = list.begin(); it != list.end(); it++) {
> -		auto x = it->get<double>();
> -		if (!x)
> -			return -EINVAL;
> -		if (it != list.begin() && *x <= points_.back().x())
> -			return -EINVAL;
> -
> -		auto y = (++it)->get<double>();
> -		if (!y)
> -			return -EINVAL;
> -
> -		points_.push_back(Point({ *x, *y }));
> -	}
> -
> -	return 0;
> -}
> -
>  /**
>   * \brief Append a point to the end of the piecewise linear function
>   * \param[in] x x-coordinate of the point to add to the piecewise linear function
> diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h
> index 8edb4d33dc71..b6f93494d807 100644
> --- a/src/ipa/libipa/pwl.h
> +++ b/src/ipa/libipa/pwl.h
> @@ -49,8 +49,6 @@ public:
>  	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);
>  
>  	bool empty() const { return points_.empty(); }
Kieran Bingham June 13, 2024, 11:38 a.m. UTC | #2
Quoting Laurent Pinchart (2024-06-13 02:39:44)
> All users of the Pwl::readYaml() function have been removed. The
> function is not used, and is deprecated in favour of YamlObject::get().
> Drop it.


This one will be dependant upon an Ack from RPi for the preceeding patch
... but given that:

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/ipa/libipa/pwl.cpp | 38 --------------------------------------
>  src/ipa/libipa/pwl.h   |  2 --
>  2 files changed, 40 deletions(-)
> 
> diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp
> index 3c639645fa3d..9b213754ec7d 100644
> --- a/src/ipa/libipa/pwl.cpp
> +++ b/src/ipa/libipa/pwl.cpp
> @@ -125,44 +125,6 @@ Pwl::Pwl(std::vector<Point> &&points)
>  {
>  }
>  
> -/**
> - * \brief Populate the piecewise linear function from yaml data
> - * \param[in] params Yaml data to populate the piecewise linear function with
> - *
> - * Any existing points in the piecewise linear function *will* be overwritten.
> - *
> - * The yaml data is expected to be a list with an even number of numerical
> - * elements. These will be parsed in pairs into x and y points in the piecewise
> - * linear function, and added in order. x must be monotonically increasing.
> - *
> - * \return 0 on success, negative error code otherwise
> - */
> -int Pwl::readYaml(const libcamera::YamlObject &params)
> -{
> -       if (!params.size() || params.size() % 2)
> -               return -EINVAL;
> -
> -       const auto &list = params.asList();
> -
> -       points_.clear();
> -
> -       for (auto it = list.begin(); it != list.end(); it++) {
> -               auto x = it->get<double>();
> -               if (!x)
> -                       return -EINVAL;
> -               if (it != list.begin() && *x <= points_.back().x())
> -                       return -EINVAL;
> -
> -               auto y = (++it)->get<double>();
> -               if (!y)
> -                       return -EINVAL;
> -
> -               points_.push_back(Point({ *x, *y }));
> -       }
> -
> -       return 0;
> -}
> -
>  /**
>   * \brief Append a point to the end of the piecewise linear function
>   * \param[in] x x-coordinate of the point to add to the piecewise linear function
> diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h
> index 8edb4d33dc71..b6f93494d807 100644
> --- a/src/ipa/libipa/pwl.h
> +++ b/src/ipa/libipa/pwl.h
> @@ -49,8 +49,6 @@ public:
>         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);
>  
>         bool empty() const { return points_.empty(); }
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp
index 3c639645fa3d..9b213754ec7d 100644
--- a/src/ipa/libipa/pwl.cpp
+++ b/src/ipa/libipa/pwl.cpp
@@ -125,44 +125,6 @@  Pwl::Pwl(std::vector<Point> &&points)
 {
 }
 
-/**
- * \brief Populate the piecewise linear function from yaml data
- * \param[in] params Yaml data to populate the piecewise linear function with
- *
- * Any existing points in the piecewise linear function *will* be overwritten.
- *
- * The yaml data is expected to be a list with an even number of numerical
- * elements. These will be parsed in pairs into x and y points in the piecewise
- * linear function, and added in order. x must be monotonically increasing.
- *
- * \return 0 on success, negative error code otherwise
- */
-int Pwl::readYaml(const libcamera::YamlObject &params)
-{
-	if (!params.size() || params.size() % 2)
-		return -EINVAL;
-
-	const auto &list = params.asList();
-
-	points_.clear();
-
-	for (auto it = list.begin(); it != list.end(); it++) {
-		auto x = it->get<double>();
-		if (!x)
-			return -EINVAL;
-		if (it != list.begin() && *x <= points_.back().x())
-			return -EINVAL;
-
-		auto y = (++it)->get<double>();
-		if (!y)
-			return -EINVAL;
-
-		points_.push_back(Point({ *x, *y }));
-	}
-
-	return 0;
-}
-
 /**
  * \brief Append a point to the end of the piecewise linear function
  * \param[in] x x-coordinate of the point to add to the piecewise linear function
diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h
index 8edb4d33dc71..b6f93494d807 100644
--- a/src/ipa/libipa/pwl.h
+++ b/src/ipa/libipa/pwl.h
@@ -49,8 +49,6 @@  public:
 	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);
 
 	bool empty() const { return points_.empty(); }