[v3,2/2] libcamera: software_isp: debayer_egl: Use Matrix::transpose()
diff mbox series

Message ID 20260914123833.2724712-3-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • libcamera: Add and use Matrix::transpose()
Related show

Commit Message

Laurent Pinchart Sept. 14, 2026, 12:38 p.m. UTC
Replace the manual matrix transposition code with a call to
Matrix::transpose().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/software_isp/debayer_egl.cpp | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

Comments

Barnabás Pőcze Sept. 14, 2026, 1:02 p.m. UTC | #1
2026. 09. 14. 14:38 keltezéssel, Laurent Pinchart írta:
> Replace the manual matrix transposition code with a call to
> Matrix::transpose().
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   src/libcamera/software_isp/debayer_egl.cpp | 19 ++++---------------
>   1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
> index 3536b5c51ffa..4477c928342f 100644
> --- a/src/libcamera/software_isp/debayer_egl.cpp
> +++ b/src/libcamera/software_isp/debayer_egl.cpp
> @@ -460,21 +460,10 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara
>   			    << " textureUniformStep_.y " << Step[1]
>   			    << " textureUniformStrideFactor_ " << Stride
>   			    << " textureUniformProjMatrix_ " << textureUniformProjMatrix_;
> -	/*
> -	 * Pre-transpose matrix for GLES 2.0
> -	 */
> -	GLfloat ccm[9] = {
> -		params.combinedMatrix[0][0],
> -		params.combinedMatrix[1][0],
> -		params.combinedMatrix[2][0],
> -		params.combinedMatrix[0][1],
> -		params.combinedMatrix[1][1],
> -		params.combinedMatrix[2][1],
> -		params.combinedMatrix[0][2],
> -		params.combinedMatrix[1][2],
> -		params.combinedMatrix[2][2],
> -	};
> -	glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm);
> +
> +	/* Pre-transpose matrix for GLES 2.0. */
> +	Matrix<float, 3, 3> ccm = params.combinedMatrix.transpose();
> +	glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm.data().data());
>   	LOG(Debayer, Debug) << " ccmUniformDataIn_ " << ccmUniformDataIn_ << " data " << params.combinedMatrix;
>   
>   	/*

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
index 3536b5c51ffa..4477c928342f 100644
--- a/src/libcamera/software_isp/debayer_egl.cpp
+++ b/src/libcamera/software_isp/debayer_egl.cpp
@@ -460,21 +460,10 @@  void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara
 			    << " textureUniformStep_.y " << Step[1]
 			    << " textureUniformStrideFactor_ " << Stride
 			    << " textureUniformProjMatrix_ " << textureUniformProjMatrix_;
-	/*
-	 * Pre-transpose matrix for GLES 2.0
-	 */
-	GLfloat ccm[9] = {
-		params.combinedMatrix[0][0],
-		params.combinedMatrix[1][0],
-		params.combinedMatrix[2][0],
-		params.combinedMatrix[0][1],
-		params.combinedMatrix[1][1],
-		params.combinedMatrix[2][1],
-		params.combinedMatrix[0][2],
-		params.combinedMatrix[1][2],
-		params.combinedMatrix[2][2],
-	};
-	glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm);
+
+	/* Pre-transpose matrix for GLES 2.0. */
+	Matrix<float, 3, 3> ccm = params.combinedMatrix.transpose();
+	glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm.data().data());
 	LOG(Debayer, Debug) << " ccmUniformDataIn_ " << ccmUniformDataIn_ << " data " << params.combinedMatrix;
 
 	/*