summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2016-12-28 02:46:55 +0100
committerwm4 <wm4@nowhere>2016-12-28 15:10:48 +0100
commit22a22322cb612e9cff6ae642668f86dd15314598 (patch)
treea3c026b1417600b57ca85cfd5618a379f3e91f5f /video/out/opengl/video.c
parenta283b355565a1ef9a7a444351fb4929c458d59b9 (diff)
downloadmpv-22a22322cb612e9cff6ae642668f86dd15314598.tar.bz2
mpv-22a22322cb612e9cff6ae642668f86dd15314598.tar.xz
vo_opengl: partially fix rotation for 4:2:2 content
The chroma alignment renormalization code forgot to account for the fact that the chroma subsampling ratio has to be rotated. Unfortunately, doing it this way seems to have somewhat broken the chroma offset rotation logic for odd-sized subsampled image files. While this is a bug, it's much, much less noticeable, so it's not nearly as important as the bug this change fixes. Either way, a future patch needs to still revise this logic, ideally by redesigning the entire rotation mechanism.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 3bd67c29fe..ca76865240 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1775,6 +1775,8 @@ static void pass_read_video(struct gl_video *p)
{0.0, (ref.y1 - ref.y0) / (rect.y1 - rect.y0)}},
.t = {ref.x0, ref.y0},
};
+ MP_DBG(p, "-> fix[%d] = {%f %f} + off {%f %f}\n", n,
+ fix.m[0][0], fix.m[1][1], fix.t[0], fix.t[1]);
// Since the scale in texture space is different from the scale in
// absolute terms, we have to scale the coefficients down to be
@@ -1784,8 +1786,11 @@ static void pass_read_video(struct gl_video *p)
{0.0, (float)tex[n].h / p->texture_h}},
.t = {-rect.x0, -rect.y0},
};
+ if (p->image_params.rotate % 180 == 90)
+ MPSWAP(double, scale.m[0][0], scale.m[1][1]);
+
gl_transform_trans(scale, &fix);
- MP_DBG(p, "-> fix[%d] = {%f %f} + off {%f %f}\n", n,
+ MP_DBG(p, "-> scaled[%d] = {%f %f} + off {%f %f}\n", n,
fix.m[0][0], fix.m[1][1], fix.t[0], fix.t[1]);
// Since the texture transform is a function of the texture coordinates