1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

vo_opengl: fix smoothmotion coefficient calculation

Using prev_pts as the start of the scale was plain wrong. Change it to
prev_vsync.
This commit is contained in:
Stefano Pigozzi 2015-02-13 15:22:53 +01:00
parent 9e14042e57
commit 3931544ef3
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->BindTexture(p->gl_target, p->surfaces[p->surface_idx].fbotex.texture);
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) {
double N = t->next_vsync - prev_pts;
double P = t->pts - prev_pts;
double prev_pts_component = N / P;
double N = t->next_vsync - t->prev_vsync;
double P = t->pts - t->prev_vsync;
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 > 1.0 - ts ? 1.0 : inter_coeff;
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) {
.pts = pts,
.next_vsync = next_vsync,
.prev_vsync = prev_vsync,
};
vo->driver->draw_image_timed(vo, img, &t);
} else {

View File

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