summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_pullup.c
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@alientrap.org>2011-04-23 18:56:47 +0200
committerUoti Urpala <uau@mplayer2.org>2011-04-24 03:55:47 +0300
commit994b21a80a2f37b0d672526739cb742b87f33ad9 (patch)
tree222e014be69723c4772d5045fee35eb98ffc8a63 /libmpcodecs/vf_pullup.c
parent28b3cc0efe7a575cb8004d1b109ce5ca2f2953bb (diff)
downloadmpv-994b21a80a2f37b0d672526739cb742b87f33ad9.tar.bz2
mpv-994b21a80a2f37b0d672526739cb742b87f33ad9.tar.xz
vf_*: fix pts values passed to the next filter
Many video filters failed to calculate or even just pass through pts values for their output frames. Fix this, and also make the two remaining filters that called vf_next_put_image() twice for the same input frame (vf_softpulldown, vf_telecine) use vf_queue_frame() so that e.g. framestepping properly sees both frames. Changed filters: vf_bmovl, vf_detc, vf_divtc, vf_filmdint, vf_ivtc, vf_lavc, vf_phase, vf_pullup, vf_softpulldown, vf_telecine, vf_tile, vf_tinterlace.
Diffstat (limited to 'libmpcodecs/vf_pullup.c')
-rw-r--r--libmpcodecs/vf_pullup.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c
index 2dafe20b31..356774b060 100644
--- a/libmpcodecs/vf_pullup.c
+++ b/libmpcodecs/vf_pullup.c
@@ -40,6 +40,7 @@ struct vf_priv_s {
int init;
int fakecount;
char *qbuf;
+ double lastpts;
};
static void init_pullup(struct vf_instance *vf, mp_image_t *mpi)
@@ -145,10 +146,35 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 :
(mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0);
- pullup_submit_field(c, b, p);
- pullup_submit_field(c, b, p^1);
- if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
- pullup_submit_field(c, b, p);
+
+ if (pts == MP_NOPTS_VALUE) {
+ pullup_submit_field(c, b, p, MP_NOPTS_VALUE);
+ pullup_submit_field(c, b, p^1, MP_NOPTS_VALUE);
+ if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
+ pullup_submit_field(c, b, p, MP_NOPTS_VALUE);
+ } else {
+ double delta;
+ if (vf->priv->lastpts == MP_NOPTS_VALUE)
+ 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);
+ 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;
+ 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_release_buffer(b, 2);
@@ -230,7 +256,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
dmpi->qstride = mpi->qstride;
dmpi->qscale_type = mpi->qscale_type;
}
- return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
+ return vf_next_put_image(vf, dmpi, f->pts);
}
dmpi = vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
@@ -249,7 +275,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
dmpi->qstride = mpi->qstride;
dmpi->qscale_type = mpi->qscale_type;
}
- ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
+ ret = vf_next_put_image(vf, dmpi, f->pts);
pullup_release_frame(f);
return ret;
}