[v2,3/9] libcamera: internal: Move Matrix class into libcamera namespace
diff mbox series

Message ID 20241119103740.1919807-4-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • ove Matrix class from libipa to libcamera
Related show

Commit Message

Stefan Klug Nov. 19, 2024, 10:37 a.m. UTC
The Matrix class no longer lives inside lipipa. Move it into the
libcamera namespace to account for that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 include/libcamera/internal/matrix.h | 14 +++++---------
 src/libcamera/matrix.cpp            |  6 +-----
 2 files changed, 6 insertions(+), 14 deletions(-)

Comments

Laurent Pinchart Nov. 19, 2024, 11:07 a.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Tue, Nov 19, 2024 at 11:37:30AM +0100, Stefan Klug wrote:
> The Matrix class no longer lives inside lipipa. Move it into the
> libcamera namespace to account for that.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/libcamera/internal/matrix.h | 14 +++++---------
>  src/libcamera/matrix.cpp            |  6 +-----
>  2 files changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h
> index 5471e6975b74..3701d0ee980b 100644
> --- a/include/libcamera/internal/matrix.h
> +++ b/include/libcamera/internal/matrix.h
> @@ -19,8 +19,6 @@ namespace libcamera {
>  
>  LOG_DECLARE_CATEGORY(Matrix)
>  
> -namespace ipa {
> -
>  #ifndef __DOXYGEN__
>  template<typename T, unsigned int Rows, unsigned int Cols,
>  	 std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
> @@ -166,24 +164,22 @@ Matrix<T, Rows, Cols> operator+(const Matrix<T, Rows, Cols> &m1, const Matrix<T,
>  bool matrixValidateYaml(const YamlObject &obj, unsigned int size);
>  #endif /* __DOXYGEN__ */
>  
> -} /* namespace ipa */
> -
>  #ifndef __DOXYGEN__
>  template<typename T, unsigned int Rows, unsigned int Cols>
> -std::ostream &operator<<(std::ostream &out, const ipa::Matrix<T, Rows, Cols> &m)
> +std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m)
>  {
>  	out << m.toString();
>  	return out;
>  }
>  
>  template<typename T, unsigned int Rows, unsigned int Cols>
> -struct YamlObject::Getter<ipa::Matrix<T, Rows, Cols>> {
> -	std::optional<ipa::Matrix<T, Rows, Cols>> get(const YamlObject &obj) const
> +struct YamlObject::Getter<Matrix<T, Rows, Cols>> {
> +	std::optional<Matrix<T, Rows, Cols>> get(const YamlObject &obj) const
>  	{
> -		if (!ipa::matrixValidateYaml(obj, Rows * Cols))
> +		if (!matrixValidateYaml(obj, Rows * Cols))
>  			return std::nullopt;
>  
> -		ipa::Matrix<T, Rows, Cols> matrix;
> +		Matrix<T, Rows, Cols> matrix;
>  		T *data = &matrix[0][0];
>  
>  		unsigned int i = 0;
> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp
> index 8346f0d34160..55359aa206ee 100644
> --- a/src/libcamera/matrix.cpp
> +++ b/src/libcamera/matrix.cpp
> @@ -5,7 +5,7 @@
>   * Matrix and related operations
>   */
>  
> -#include "matrix.h"
> +#include "libcamera/internal/matrix.h"
>  
>  #include <libcamera/base/log.h>
>  
> @@ -18,8 +18,6 @@ namespace libcamera {
>  
>  LOG_DEFINE_CATEGORY(Matrix)
>  
> -namespace ipa {
> -
>  /**
>   * \class Matrix
>   * \brief Matrix class
> @@ -144,6 +142,4 @@ bool matrixValidateYaml(const YamlObject &obj, unsigned int size)
>  }
>  #endif /* __DOXYGEN__ */
>  
> -} /* namespace ipa */
> -
>  } /* namespace libcamera */

Patch
diff mbox series

diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h
index 5471e6975b74..3701d0ee980b 100644
--- a/include/libcamera/internal/matrix.h
+++ b/include/libcamera/internal/matrix.h
@@ -19,8 +19,6 @@  namespace libcamera {
 
 LOG_DECLARE_CATEGORY(Matrix)
 
-namespace ipa {
-
 #ifndef __DOXYGEN__
 template<typename T, unsigned int Rows, unsigned int Cols,
 	 std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
@@ -166,24 +164,22 @@  Matrix<T, Rows, Cols> operator+(const Matrix<T, Rows, Cols> &m1, const Matrix<T,
 bool matrixValidateYaml(const YamlObject &obj, unsigned int size);
 #endif /* __DOXYGEN__ */
 
-} /* namespace ipa */
-
 #ifndef __DOXYGEN__
 template<typename T, unsigned int Rows, unsigned int Cols>
-std::ostream &operator<<(std::ostream &out, const ipa::Matrix<T, Rows, Cols> &m)
+std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m)
 {
 	out << m.toString();
 	return out;
 }
 
 template<typename T, unsigned int Rows, unsigned int Cols>
-struct YamlObject::Getter<ipa::Matrix<T, Rows, Cols>> {
-	std::optional<ipa::Matrix<T, Rows, Cols>> get(const YamlObject &obj) const
+struct YamlObject::Getter<Matrix<T, Rows, Cols>> {
+	std::optional<Matrix<T, Rows, Cols>> get(const YamlObject &obj) const
 	{
-		if (!ipa::matrixValidateYaml(obj, Rows * Cols))
+		if (!matrixValidateYaml(obj, Rows * Cols))
 			return std::nullopt;
 
-		ipa::Matrix<T, Rows, Cols> matrix;
+		Matrix<T, Rows, Cols> matrix;
 		T *data = &matrix[0][0];
 
 		unsigned int i = 0;
diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp
index 8346f0d34160..55359aa206ee 100644
--- a/src/libcamera/matrix.cpp
+++ b/src/libcamera/matrix.cpp
@@ -5,7 +5,7 @@ 
  * Matrix and related operations
  */
 
-#include "matrix.h"
+#include "libcamera/internal/matrix.h"
 
 #include <libcamera/base/log.h>
 
@@ -18,8 +18,6 @@  namespace libcamera {
 
 LOG_DEFINE_CATEGORY(Matrix)
 
-namespace ipa {
-
 /**
  * \class Matrix
  * \brief Matrix class
@@ -144,6 +142,4 @@  bool matrixValidateYaml(const YamlObject &obj, unsigned int size)
 }
 #endif /* __DOXYGEN__ */
 
-} /* namespace ipa */
-
 } /* namespace libcamera */