From 79beb60c54be6944e766cdb91da4b7688ef0f61f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 2 Sep 2015 13:08:18 +0200 Subject: 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. --- video/out/gl_video.c | 7 +++++-- 1 file 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); -- cgit v1.2.3