[vlc-devel] [PATCH 00/18] Use quaternions in the core
Alexandre Janniaux
ajanni at videolabs.io
Wed Mar 31 09:25:32 UTC 2021
Change the viewpoint structure to use quaternions in the core,
while still using Euler angles in the current clients.
Euler angles have singularity issues, which in the convention
we chosed happens at the north and south poles. It didn't matter
when using usual yaw/pitch controllers since there are not a lot
of way to do this, but it definitively matters when the orientation
is already described by a quaternion. In particular, phone devices
or HMD headset with gyroscopes can easily reach the north and south
poles while having a different roll-like rotation, so can trigger
those bugs.
Using quaternions from the start won't trigger those issues in
cases where the control is not done through the euler-angle-like
paradigm, while still allowing clients to use it as long as they
handle the problem themselves.
Since hotkeys and input were not handling the problem themselves
and were supplying relative transformation, such relative rotations
are clipped to avoid the poles.
This patchset also adds a serie of tests which are a bit «dumb»
before the last patchset but allows checking that the result of
the viewpoint conversions are the same between before this
patchset and after. Since d3d9/11/opengl clients are now using
the same set of function from a viewpoint, it effectively ensure
that the behaviour is not changed as long as the tests are passing.
Alexandre Janniaux (18):
viewpoint: add euler conversion operations
vlccore: export vlc_viewpoint_from/to_euler
lib/media: use vlc_viewpoint_to_euler
lib/video: use vlc_viewpoint_to_euler
spatialaudio: use vlc_viewpoint_to_euler
matroska_segment_parse: use vlc_viewpoint_from_euler
essetup: use vlc_viewpoint_from_euler
win32/sensors: use vlc_viewpoint_from_euler
input: use vlc_viewpoint_to/from_euler
jpeg: use vlc_viewpoint_from_euler
input: use vlc_viewpoint_from/to_euler
display: call set_viewpoint on vout_SetDisplayViewpoint
es_out: use vlc_viewpoint_to_euler
hotkeys: use vlc_viewpoint_from_euler
viewpoint: negate angles earlier
viewpoint: add test for euler/viewpoint/euler conversions
viewpoint: add test for conversion to 4x4 matrix
viewpoint: use quaternion instead of euler angles
include/vlc_viewpoint.h | 26 +-
lib/media_track.c | 7 +-
lib/video.c | 11 +-
.../channel_mixer/spatialaudio.cpp | 9 +-
modules/codec/jpeg.c | 29 +--
modules/control/hotkeys.c | 18 +-
modules/demux/mkv/matroska_segment_parse.cpp | 19 +-
modules/demux/mp4/essetup.c | 7 +-
modules/video_output/win32/sensors.cpp | 21 +-
src/input/es_out.c | 9 +-
src/input/input.c | 43 ++-
src/libvlccore.sym | 2 +
src/misc/viewpoint.c | 244 +++++++++++++++---
src/video_output/display.c | 21 +-
test/Makefile.am | 3 +
test/src/misc/viewpoint.c | 206 +++++++++++++++
16 files changed, 545 insertions(+), 130 deletions(-)
create mode 100644 test/src/misc/viewpoint.c
--
2.31.0
More information about the vlc-devel
mailing list