[vlc-commits] [Git][videolan/vlc][master] opengl: fix 2x3 matrix multiplication

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Oct 18 11:22:52 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
0da4aa9d by Romain Vimont at 2021-10-18T10:46:37+00:00
opengl: fix 2x3 matrix multiplication

To multiply two 2x3 matrices, the right matrix must be expanded to 3x3,
by adding a row [0 0 1], so that the dimensions match (2x3 x 3x3 = 2x3).

The matrix multiplication was erroneous: it behaved as if the matrix was
expanded by an implicit row [1 1 1] instead.

The error has been introduced by
31c20009a02f8b8a30fd4c4f0821ceabba30e30d.

- - - - -


1 changed file:

- modules/video_output/opengl/sampler.c


Changes:

=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -1181,8 +1181,11 @@ MatrixMultiply(float out[static 3*2],
     for (unsigned i = 0; i < 3; ++i)
         for (unsigned j = 0; j < 2; ++j)
             out[i*2+j] = a[0*2+j] * b[i*2+0]
-                       + a[1*2+j] * b[i*2+1]
-                       + a[2*2+j];
+                       + a[1*2+j] * b[i*2+1];
+
+    /* Multiply the last implicit row [0 0 1] of b, expanded to 3x3 */
+    out[2*2+0] += a[2*2+0];
+    out[2*2+1] += a[2*2+1];
 }
 
 static void



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0da4aa9de0d5f16b77d7627081ae926456f9d8e3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0da4aa9de0d5f16b77d7627081ae926456f9d8e3
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list