[vlc-devel] [PATCH 1/3] opengl: fix orientation matrices

Romain Vimont rom1v at videolabs.io
Mon Jun 15 19:24:24 CEST 2020


The orientation matrices were incorrect.

This commit is just here to show the differences, but the next commit
will rewrite their initialization to make them more readable.
---
 modules/video_output/opengl/sampler.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/modules/video_output/opengl/sampler.c b/modules/video_output/opengl/sampler.c
index fade9fd48ac6..c4482d88d02b 100644
--- a/modules/video_output/opengl/sampler.c
+++ b/modules/video_output/opengl/sampler.c
@@ -559,25 +559,25 @@ InitOrientationMatrix(GLfloat matrix[static 4*4],
 
         case ORIENT_ROTATED_90:
             matrix[0 * 4 + 0] = k_cos_pi_2;
-            matrix[0 * 4 + 1] = -k_sin_pi_2;
-            matrix[1 * 4 + 0] = k_sin_pi_2;
+            matrix[0 * 4 + 1] = k_sin_pi_2;
+            matrix[1 * 4 + 0] = -k_sin_pi_2;
             matrix[1 * 4 + 1] = k_cos_pi_2;
-            matrix[3 * 4 + 1] = 1;
+            matrix[3 * 4 + 0] = 1;
             break;
         case ORIENT_ROTATED_180:
             matrix[0 * 4 + 0] = k_cos_pi;
-            matrix[0 * 4 + 1] = -k_sin_pi;
-            matrix[1 * 4 + 0] = k_sin_pi;
+            matrix[0 * 4 + 1] = k_sin_pi;
+            matrix[1 * 4 + 0] = -k_sin_pi;
             matrix[1 * 4 + 1] = k_cos_pi;
             matrix[3 * 4 + 0] = 1;
             matrix[3 * 4 + 1] = 1;
             break;
         case ORIENT_ROTATED_270:
             matrix[0 * 4 + 0] = k_cos_n_pi_2;
-            matrix[0 * 4 + 1] = -k_sin_n_pi_2;
-            matrix[1 * 4 + 0] = k_sin_n_pi_2;
+            matrix[0 * 4 + 1] = k_sin_n_pi_2;
+            matrix[1 * 4 + 0] = -k_sin_n_pi_2;
             matrix[1 * 4 + 1] = k_cos_n_pi_2;
-            matrix[3 * 4 + 0] = 1;
+            matrix[3 * 4 + 1] = 1;
             break;
         case ORIENT_HFLIPPED:
             matrix[0 * 4 + 0] = -1;
@@ -590,18 +590,16 @@ InitOrientationMatrix(GLfloat matrix[static 4*4],
         case ORIENT_TRANSPOSED:
             matrix[0 * 4 + 0] = 0;
             matrix[1 * 4 + 1] = 0;
-            matrix[2 * 4 + 2] = -1;
-            matrix[0 * 4 + 1] = 1;
-            matrix[1 * 4 + 0] = 1;
+            matrix[0 * 4 + 1] = -1;
+            matrix[1 * 4 + 0] = -1;
+            matrix[3 * 4 + 0] = 1;
+            matrix[3 * 4 + 1] = 1;
             break;
         case ORIENT_ANTI_TRANSPOSED:
             matrix[0 * 4 + 0] = 0;
             matrix[1 * 4 + 1] = 0;
-            matrix[2 * 4 + 2] = -1;
             matrix[0 * 4 + 1] = -1;
             matrix[1 * 4 + 0] = -1;
-            matrix[3 * 4 + 0] = 1;
-            matrix[3 * 4 + 1] = 1;
             break;
         default:
             break;
-- 
2.27.0



More information about the vlc-devel mailing list