summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_yadif.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_yadif.c')
-rw-r--r--video/filter/vf_yadif.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c
index 1158cffbbf..4e53ef168c 100644
--- a/video/filter/vf_yadif.c
+++ b/video/filter/vf_yadif.c
@@ -394,11 +394,11 @@ static int config(struct vf_instance *vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int continue_buffered_image(struct vf_instance *vf);
+static int continue_buffered_image(struct vf_instance *vf, struct mp_image *mpi);
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
+static int filter_image(struct vf_instance *vf, struct mp_image *mpi)
+{
int tff;
-
if(vf->priv->parity < 0) {
if (mpi->fields & MP_IMGFIELD_ORDERED)
tff = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST);
@@ -414,47 +414,47 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
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;
+ delta = (mpi->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;
- vf->priv->buffered_pts = pts;
-
- if(vf->priv->do_deinterlace == 0)
- return vf_next_put_image(vf, mpi, pts);
- else if(vf->priv->do_deinterlace == 1){
- vf->priv->do_deinterlace= 2;
- return 0;
- }else
- return continue_buffered_image(vf);
+ vf->priv->buffered_pts = mpi->pts;
+
+ if (vf->priv->do_deinterlace == 0) {
+ vf_add_output_frame(vf, mpi);
+ mpi = NULL;
+ } else if (vf->priv->do_deinterlace == 1) {
+ vf->priv->do_deinterlace = 2;
+ } else {
+ while (continue_buffered_image(vf, mpi)) {
+ }
+ }
+
+ talloc_free(mpi);
+
+ return 0;
}
-static int continue_buffered_image(struct vf_instance *vf)
+static int continue_buffered_image(struct vf_instance *vf, struct mp_image *mpi)
{
- mp_image_t *mpi = vf->priv->buffered_mpi;
int tff = vf->priv->buffered_tff;
double pts = vf->priv->buffered_pts;
int i;
int ret=0;
- mp_image_t *dmpi;
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,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
+ struct mp_image *dmpi = vf_alloc_out_image(vf);
+ mp_image_copy_attributes(dmpi, mpi);
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);
+ ret = 1; // more images to come
+ vf_add_output_frame(vf, dmpi);
break;
}
vf->priv->buffered_i = 1;
@@ -502,7 +502,7 @@ static int control(struct vf_instance *vf, int request, void* data){
static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
- vf->put_image=put_image;
+ vf->filter_ext=filter_image;
vf->query_format=query_format;
vf->uninit=uninit;
vf->priv=malloc(sizeof(struct vf_priv_s));