mirror of
https://github.com/mpv-player/mpv
synced 2025-05-02 08:09:50 +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,12 +158,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
|||||||
delta = 1001.0/60000.0; // delta = field time distance
|
delta = 1001.0/60000.0; // delta = field time distance
|
||||||
else
|
else
|
||||||
delta = (pts - vf->priv->lastpts) / 2;
|
delta = (pts - vf->priv->lastpts) / 2;
|
||||||
if (delta <= 0.0 || delta >= 0.5) {
|
if (delta <= 0.0 || delta >= 0.5)
|
||||||
pullup_submit_field(c, b, p, pts);
|
delta = 0.0;
|
||||||
pullup_submit_field(c, b, p^1, pts);
|
|
||||||
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
|
|
||||||
pullup_submit_field(c, b, p, pts);
|
|
||||||
} else {
|
|
||||||
vf->priv->lastpts = pts;
|
vf->priv->lastpts = pts;
|
||||||
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) {
|
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) {
|
||||||
pullup_submit_field(c, b, p, pts - delta);
|
pullup_submit_field(c, b, p, pts - delta);
|
||||||
@ -174,7 +170,6 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
|||||||
pullup_submit_field(c, b, p^1, pts + delta * 0.5);
|
pullup_submit_field(c, b, p^1, pts + delta * 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pullup_release_buffer(b, 2);
|
pullup_release_buffer(b, 2);
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ struct vf_priv_s {
|
|||||||
int buffered_i;
|
int buffered_i;
|
||||||
int buffered_tff;
|
int buffered_tff;
|
||||||
double buffered_pts;
|
double buffered_pts;
|
||||||
|
double buffered_pts_delta;
|
||||||
mp_image_t *buffered_mpi;
|
mp_image_t *buffered_mpi;
|
||||||
int stride[3];
|
int stride[3];
|
||||||
uint8_t *ref[4][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);
|
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_mpi = mpi;
|
||||||
vf->priv->buffered_tff = tff;
|
vf->priv->buffered_tff = tff;
|
||||||
vf->priv->buffered_i = 0;
|
vf->priv->buffered_i = 0;
|
||||||
@ -420,7 +432,7 @@ static int continue_buffered_image(struct vf_instance *vf)
|
|||||||
int ret=0;
|
int ret=0;
|
||||||
mp_image_t *dmpi;
|
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++){
|
for(i = vf->priv->buffered_i; i<=(vf->priv->mode&1); i++){
|
||||||
dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
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);
|
filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
|
||||||
if (i < (vf->priv->mode & 1))
|
if (i < (vf->priv->mode & 1))
|
||||||
vf_queue_frame(vf, continue_buffered_image);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
vf->priv->buffered_i = 1;
|
vf->priv->buffered_i = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user