mirror of https://github.com/mpv-player/mpv
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:
parent
cb5adf4d72
commit
df4d15be7b
|
@ -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, "
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -155,6 +155,7 @@ struct vo_extra {
|
|||
struct frame_timing {
|
||||
int64_t pts;
|
||||
int64_t next_vsync;
|
||||
int64_t prev_vsync;
|
||||
};
|
||||
|
||||
struct vo_driver {
|
||||
|
|
Loading…
Reference in New Issue