GNOME Bugzilla – Bug 794401
glvideomixer: possible rotation bug
Last modified: 2018-08-21 15:20:47 UTC
Created attachment 369785 [details] Script that produces the "bug" i have encountered a strange output when linking gstgltransformation with gstglvideomixer using the following pipeline. gst-launch-1.0 -v glvideomixerelement name=m sink_1::xpos=300 sink_2::ypos=400 sink_3::xpos=300 sink_3::ypos=400 ! glimagesink \ gltestsrc ! glupload ! gltransformation rotation-y=45 ! m. \ gltestsrc ! glupload ! gltransformation rotation-y=45 ! m. \ gltestsrc ! glupload ! gltransformation rotation-y=45 ! gldownload ! videocrop ! glupload ! m. \ gltestsrc ! glupload ! gltransformation rotation-y=45 ! gldownload ! videocrop ! glupload ! m. Connecting gltransformation directly to the videomixer element results in a different rotation than when i download an upload it in between. Do you have any idea what may be the source of this difference and where i can look into fixing it
Ah, the problem is the rotation in the transformation (rotation, etc) combined with the translation from the pad properties (xpos, ypos) will rotate around a different point than expected. Moving the xpos/ypos vertex modification into a transformation matrix itself and then multiplying with the upstream matrix should fix this issue.
Created attachment 371376 [details] [review] Moved the pad offset and aspect ratio to a matrix so it will be added in view space and not in world space
Created attachment 371377 [details] [review] Moved the pad offset and aspect ratio to a matrix so it will be added in view space and not in world space
Created attachment 371378 [details] [review] Moves the objects to zero on z axis so the rotation from the af_meta matrix works as expectet from gltransforamtion and same as glimagesink and gltransformation
Review of attachment 371377 [details] [review]: Almost. ::: ext/gl/gstglvideomixer.c @@ +1554,3 @@ gst_buffer_get_video_affine_transformation_meta (vagg_pad->buffer); gst_gl_get_affine_transformation_meta_as_ndc_ext (af_meta, matrix); + gst_gl_multiply_matrix4(matrix, pad->m_matrix, matrix); In-place multiplication most likely doesn't work correctly for all cases. Keep the result in a temporary.
Created attachment 371835 [details] [review] Moved the pad offset and aspect ratio to a matrix so it will be added in view space and not in world space
commit 969089f7a8dc348fcdc2bf368bbc375938ea8c5f Author: Daniel Klamt <d.klamt@pengutronix.de> Date: Wed Apr 25 16:39:34 2018 +0200 Moved the pad offset and aspect ratio to a matrix so it will be added in view space and not in world space https://bugzilla.gnome.org/show_bug.cgi?id=794401
Patch from attachment 371378 [details] [review] is not applied in the repository
commit e47cf9abe1bb3695a304ec51dda10b6f57dbd684 Author: Matthew Waters <matthew@centricular.com> Date: Thu Jul 12 12:48:39 2018 +1000 glvideomixer: fix default placement when different sized output i.e. when expanding from 320x240 to 800x600, the resulting frame should appear in the top left corner, not the middle. https://bugzilla.gnome.org/show_bug.cgi?id=794401 commit b8442dd6ab0ec52dc0fad81450749531a7783cd2 Author: Daniel Klamt <d.klamt@pengutronix.de> Date: Wed Apr 25 16:36:21 2018 +0200 glvideomixer: Moves the objects to zero on z axis Matches the output from a similar glimagesink pipeline when rotating from an upstream gltransformation passed through the affine transformation meta with xpos/ypos being set. https://bugzilla.gnome.org/show_bug.cgi?id=794401
Comment on attachment 371378 [details] [review] Moves the objects to zero on z axis so the rotation from the af_meta matrix works as expectet from gltransforamtion and same as glimagesink and gltransformation Reworked the commit message but this has been commited
For the master branch you are right i was looking on the 1.4 branch Since it is a bug fix it would be nice if someone could add it to the 1.4 branch
Did you really mean 1.4 or rather 1.14?
*1.14 Thanks
Backporting to 1.14 is non-trivial with the extra additions in the matrix layouts on master.