vo_opengl: fix smoothmotion coefficient calculation

Using prev_pts as the start of the scale was plain wrong. Change it to
prev_vsync.

(cherry picked from commit 3931544ef3)
This commit is contained in:
Stefano Pigozzi 2015-02-13 15:22:53 +01:00 committed by Diogo Franco (Kovensky)
parent cb5adf4d72
commit df4d15be7b
3 changed files with 5 additions and 7 deletions

View File

@ -1749,15 +1749,11 @@ static void gl_video_interpolate_frame(struct gl_video *p,
gl->ActiveTexture(GL_TEXTURE0 + 1); gl->ActiveTexture(GL_TEXTURE0 + 1);
gl->BindTexture(p->gl_target, p->surfaces[p->surface_idx].fbotex.texture); gl->BindTexture(p->gl_target, p->surfaces[p->surface_idx].fbotex.texture);
gl->ActiveTexture(GL_TEXTURE0); gl->ActiveTexture(GL_TEXTURE0);
MP_DBG(p, "frame ppts: %lld, pts: %lld, vsync: %lld, DIFF: %lld\n",
(long long)prev_pts, (long long)t->pts,
(long long)t->next_vsync, (long long)t->next_vsync - t->pts);
if (prev_pts < t->next_vsync && t->pts > t->next_vsync) { if (prev_pts < t->next_vsync && t->pts > t->next_vsync) {
double N = t->next_vsync - prev_pts; double N = t->next_vsync - t->prev_vsync;
double P = t->pts - prev_pts; double P = t->pts - t->prev_vsync;
double prev_pts_component = N / P;
float ts = p->opts.smoothmotion_threshold; float ts = p->opts.smoothmotion_threshold;
inter_coeff = 1 - prev_pts_component; inter_coeff = 1 - (N / P);
inter_coeff = inter_coeff < 0.0 + ts ? 0.0 : inter_coeff; inter_coeff = inter_coeff < 0.0 + ts ? 0.0 : inter_coeff;
inter_coeff = inter_coeff > 1.0 - ts ? 1.0 : inter_coeff; inter_coeff = inter_coeff > 1.0 - ts ? 1.0 : inter_coeff;
MP_DBG(p, "inter frame ppts: %lld, pts: %lld, " MP_DBG(p, "inter frame ppts: %lld, pts: %lld, "

View File

@ -617,6 +617,7 @@ static bool render_frame(struct vo *vo)
struct frame_timing t = (struct frame_timing) { struct frame_timing t = (struct frame_timing) {
.pts = pts, .pts = pts,
.next_vsync = next_vsync, .next_vsync = next_vsync,
.prev_vsync = prev_vsync,
}; };
vo->driver->draw_image_timed(vo, img, &t); vo->driver->draw_image_timed(vo, img, &t);
} else { } else {

View File

@ -155,6 +155,7 @@ struct vo_extra {
struct frame_timing { struct frame_timing {
int64_t pts; int64_t pts;
int64_t next_vsync; int64_t next_vsync;
int64_t prev_vsync;
}; };
struct vo_driver { struct vo_driver {