summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-02 13:08:18 +0200
committerwm4 <wm4@nowhere>2015-09-02 13:17:23 +0200
commit79beb60c54be6944e766cdb91da4b7688ef0f61f (patch)
treeff927f83828e03c903bb4f182a55cae0e72238c6
parentebf80c07e317486bdeb89a845f388bd397282094 (diff)
downloadmpv-79beb60c54be6944e766cdb91da4b7688ef0f61f.tar.bz2
mpv-79beb60c54be6944e766cdb91da4b7688ef0f61f.tar.xz
vo_opengl: slightly simplify plane size determination
Setup a dummy image for the given image params, and get the plane sizes from that. Admittedly not much of a simplification, but conceptually it's simpler and less error-prone, as the image layout is guaranteed to be the same, rather than essentially duplicating the way it is determined.
-rw-r--r--video/out/gl_video.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index d61d2157b1..ec6b966374 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -710,13 +710,16 @@ static void init_video(struct gl_video *p)
struct video_image *vimg = &p->image;
+ struct mp_image layout = {0};
+ mp_image_set_params(&layout, &p->image_params);
+
for (int n = 0; n < p->plane_count; n++) {
struct texplane *plane = &vimg->planes[n];
plane->gl_target = p->gl_target;
- plane->w = mp_chroma_div_up(p->image_w, p->image_desc.xs[n]);
- plane->h = mp_chroma_div_up(p->image_h, p->image_desc.ys[n]);
+ plane->w = mp_image_plane_w(&layout, n);
+ plane->h = mp_image_plane_h(&layout, n);
if (!p->hwdec_active) {
gl->ActiveTexture(GL_TEXTURE0 + n);