After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794401 - glvideomixer: possible rotation bug
glvideomixer: possible rotation bug
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.13.91
Other Linux
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-16 13:44 UTC by Daniel Klamt
Modified: 2018-08-21 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Script that produces the "bug" (446 bytes, text/plain)
2018-03-16 13:44 UTC, Daniel Klamt
  Details
Moved the pad offset and aspect ratio to a matrix so it will be added in view space and not in world space (2.94 KB, patch)
2018-04-25 14:40 UTC, Daniel Klamt
none 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 (2.94 KB, patch)
2018-04-25 14:40 UTC, Daniel Klamt
none 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 (1.41 KB, patch)
2018-04-25 14:41 UTC, Daniel Klamt
committed 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 (3.20 KB, patch)
2018-05-09 11:01 UTC, Daniel Klamt
committed Details | Review

Description Daniel Klamt 2018-03-16 13:44:37 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
Comment 1 Matthew Waters (ystreet00) 2018-03-18 00:40:57 UTC
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.
Comment 2 Daniel Klamt 2018-04-25 14:40:46 UTC
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
Comment 3 Daniel Klamt 2018-04-25 14:40:57 UTC
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
Comment 4 Daniel Klamt 2018-04-25 14:41:42 UTC
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
Comment 5 Matthew Waters (ystreet00) 2018-05-05 12:04:55 UTC
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.
Comment 6 Daniel Klamt 2018-05-09 11:01:21 UTC
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
Comment 7 Matthew Waters (ystreet00) 2018-07-10 11:42:46 UTC
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
Comment 8 Daniel Klamt 2018-07-11 13:21:45 UTC
Patch from attachment 371378 [details] [review] is not applied in the repository
Comment 9 Matthew Waters (ystreet00) 2018-07-12 02:50:20 UTC
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 10 Matthew Waters (ystreet00) 2018-07-12 02:51:03 UTC
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
Comment 11 Daniel Klamt 2018-08-21 14:10:02 UTC
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
Comment 12 Tim-Philipp Müller 2018-08-21 14:24:44 UTC
Did you really mean 1.4 or rather 1.14?
Comment 13 Daniel Klamt 2018-08-21 14:29:06 UTC
*1.14 Thanks
Comment 14 Matthew Waters (ystreet00) 2018-08-21 15:20:47 UTC
Backporting to 1.14 is non-trivial with the extra additions in the matrix layouts on master.