diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-07-01 01:25:30 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-07-01 22:38:06 +0200 |
commit | 80430632752d547432a9972815435155ed905780 (patch) | |
tree | 5d2c7663180a55575e8a10fc6de934792c05fb9f /video/out | |
parent | 0739cfc20934ac7772ab71dbae7ecba4ba10fda4 (diff) | |
download | mpv-80430632752d547432a9972815435155ed905780.tar.bz2 mpv-80430632752d547432a9972815435155ed905780.tar.xz |
vo_opengl: fix framestepping/pausing + interpolation
This is not the most theoretically perfect solution, ideally we could
check to see if the frame in question has already been rendered
somewhere in the queue and then avoid re-rendering it, at the cost of a
few extra lines of code. But I don't think the performance trade-off is
dramatic enough here.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/gl_video.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 3d867512f3..2133d26357 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -2070,6 +2070,12 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t, int vp_w = p->dst_rect.x1 - p->dst_rect.x0, vp_h = p->dst_rect.y1 - p->dst_rect.y0; + // Reset the queue completely if this is a still image, to avoid any + // interpolation artifacts from surrounding frames when unpausing or + // framestepping + if (t->still) + gl_video_reset_surfaces(p); + // First of all, figure out if we have a frame availble at all, and draw // it manually + reset the queue if not if (p->surfaces[p->surface_now].pts == MP_NOPTS_VALUE) { @@ -2158,7 +2164,7 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t, p->osd_pts = p->surfaces[surface_now].pts; // Finally, draw the right mix of frames to the screen. - if (!valid) { + if (!valid || t->still) { // surface_now is guaranteed to be valid, so we can safely use it. pass_load_fbotex(p, &p->surfaces[surface_now].fbotex, 0, vp_w, vp_h); GLSL(vec4 color = texture(texture0, texcoord0);) @@ -2223,7 +2229,7 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame, int fbo) if (has_frame) { gl_sc_set_vao(p->sc, &p->vao); - if (p->opts.interpolation && !frame->still) { + if (p->opts.interpolation) { gl_video_interpolate_frame(p, frame, fbo); } else { // Skip interpolation if there's nothing to be done |