summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_yadif.c
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@mplayer2.org>2011-06-01 06:42:24 +0000
committerUoti Urpala <uau@mplayer2.org>2011-06-24 22:31:44 +0300
commitfbf688539540fa840631d2570befb3f2eae106f8 (patch)
tree1d778239e0e06838beba2307379699c5dfec86a4 /libmpcodecs/vf_yadif.c
parent84d86719fc923b3df2ad101a12bbbff931dd0578 (diff)
downloadmpv-fbf688539540fa840631d2570befb3f2eae106f8.tar.bz2
mpv-fbf688539540fa840631d2570befb3f2eae106f8.tar.xz
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)
Diffstat (limited to 'libmpcodecs/vf_yadif.c')
-rw-r--r--libmpcodecs/vf_yadif.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index a5bd542ab5..4bd082cbe7 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -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;