mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.72k stars 2.93k forks source link

video/out/gpu/video: fix chroma offset rotation matrix calculation #15293

Closed na-na-hi closed 2 weeks ago

na-na-hi commented 2 weeks ago

https://github.com/mpv-player/mpv/commit/82231fd74d173fb47845dd086d360bceb3e5fc17 mentioned that for the "rot" transform flip=true must be set, which "makes no sense at all".

The reason this is happening is that the rotation matrix calculation is only valid for the 2D coordinate system where y axis is 90 degrees counterclockwise from x axis, but the coordinate system of chroma offset has its origin at top-left so it is the opposite, which results in the rotation going to the opposite way. Setting flip=true fixes the rotation direction, but results in a flipped y coordinate.

Fix this by reversing the rotation angle for chroma offset rotation matrix calculation. This also allows removing some duplicated code.

Fixes: https://github.com/mpv-player/mpv/issues/15288

kasper93 commented 2 weeks ago

Thanks @na-na-hi, I didn't have time to commit the change today. But indeed it was not correct in this part of code.

github-actions[bot] commented 2 weeks ago

Download the artifacts for this pull request:

Windows * [mpv-i686-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/2168626369.zip) * [mpv-x86_64-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/2168628404.zip) * [mpv-x86_64-windows-msvc](https://nightly.link/mpv-player/mpv/actions/artifacts/2168639012.zip)
macOS * [mpv-macos-13-intel](https://nightly.link/mpv-player/mpv/actions/artifacts/2168629162.zip) * [mpv-macos-14-arm](https://nightly.link/mpv-player/mpv/actions/artifacts/2168624238.zip) * [mpv-macos-15-arm](https://nightly.link/mpv-player/mpv/actions/artifacts/2168626184.zip)