mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 09:02:38 +00:00
vf_pullup, vf_yadif: pts handling fixes
vf_pullup: continue to calculate pts after detecting a seek vf_yadif: add pts calculation for the one-frame-becomes-two mode (-vf yadif=1)
This commit is contained in:
parent
84d86719fc
commit
fbf6885395
@ -158,21 +158,16 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
||||
delta = 1001.0/60000.0; // delta = field time distance
|
||||
else
|
||||
delta = (pts - vf->priv->lastpts) / 2;
|
||||
if (delta <= 0.0 || delta >= 0.5) {
|
||||
pullup_submit_field(c, b, p, pts);
|
||||
if (delta <= 0.0 || delta >= 0.5)
|
||||
delta = 0.0;
|
||||
vf->priv->lastpts = pts;
|
||||
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) {
|
||||
pullup_submit_field(c, b, p, pts - delta);
|
||||
pullup_submit_field(c, b, p^1, pts);
|
||||
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
|
||||
pullup_submit_field(c, b, p, pts);
|
||||
pullup_submit_field(c, b, p, pts + delta);
|
||||
} else {
|
||||
vf->priv->lastpts = pts;
|
||||
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) {
|
||||
pullup_submit_field(c, b, p, pts - delta);
|
||||
pullup_submit_field(c, b, p^1, pts);
|
||||
pullup_submit_field(c, b, p, pts + delta);
|
||||
} else {
|
||||
pullup_submit_field(c, b, p, pts - delta * 0.5);
|
||||
pullup_submit_field(c, b, p^1, pts + delta * 0.5);
|
||||
}
|
||||
pullup_submit_field(c, b, p, pts - delta * 0.5);
|
||||
pullup_submit_field(c, b, p^1, pts + delta * 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ struct vf_priv_s {
|
||||
int buffered_i;
|
||||
int buffered_tff;
|
||||
double buffered_pts;
|
||||
double buffered_pts_delta;
|
||||
mp_image_t *buffered_mpi;
|
||||
int stride[3];
|
||||
uint8_t *ref[4][3];
|
||||
@ -397,6 +398,17 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
|
||||
|
||||
store_ref(vf->priv, mpi->planes, mpi->stride, mpi->w, mpi->h);
|
||||
|
||||
{
|
||||
double delta;
|
||||
if (vf->priv->buffered_pts == MP_NOPTS_VALUE)
|
||||
delta = 1001.0/60000.0; // delta = field time distance
|
||||
else
|
||||
delta = (pts - vf->priv->buffered_pts) / 2;
|
||||
if (delta <= 0.0 || delta >= 0.5)
|
||||
delta = 0.0;
|
||||
vf->priv->buffered_pts_delta = delta;
|
||||
}
|
||||
|
||||
vf->priv->buffered_mpi = mpi;
|
||||
vf->priv->buffered_tff = tff;
|
||||
vf->priv->buffered_i = 0;
|
||||
@ -420,7 +432,7 @@ static int continue_buffered_image(struct vf_instance *vf)
|
||||
int ret=0;
|
||||
mp_image_t *dmpi;
|
||||
|
||||
pts += vf->priv->buffered_i * .02; // XXX not right
|
||||
pts += (vf->priv->buffered_i - 0.5 * (vf->priv->mode&1)) * vf->priv->buffered_pts_delta;
|
||||
|
||||
for(i = vf->priv->buffered_i; i<=(vf->priv->mode&1); i++){
|
||||
dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
@ -431,7 +443,7 @@ static int continue_buffered_image(struct vf_instance *vf)
|
||||
filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
|
||||
if (i < (vf->priv->mode & 1))
|
||||
vf_queue_frame(vf, continue_buffered_image);
|
||||
ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/);
|
||||
ret |= vf_next_put_image(vf, dmpi, pts);
|
||||
break;
|
||||
}
|
||||
vf->priv->buffered_i = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user