コード例 #1
0
ファイル: vf_tinterlace.c プロジェクト: 1c0n/xbmc
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
    int ret = 0;
    mp_image_t *dmpi;

    switch (vf->priv->mode) {
    case 0:
        dmpi = vf->priv->dmpi;
        if (dmpi == NULL) {
            dmpi = ff_vf_get_image(vf->next, mpi->imgfmt,
                        MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
                        MP_IMGFLAG_PRESERVE,
                        mpi->width, mpi->height*2);

            vf->priv->dmpi = dmpi;

            memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
                   dmpi->stride[0]*2, mpi->stride[0]);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                memcpy_pic(dmpi->planes[1], mpi->planes[1],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[1]*2, mpi->stride[1]);
                memcpy_pic(dmpi->planes[2], mpi->planes[2],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[2]*2, mpi->stride[2]);
            }
        } else {
            vf->priv->dmpi = NULL;

            memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h,
                   dmpi->stride[0]*2, mpi->stride[0]);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[1]*2, mpi->stride[1]);
                memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[2]*2, mpi->stride[2]);
            }
            ret = ff_vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
        }
        break;
    case 1:
        if (vf->priv->frame & 1)
            ret = ff_vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
        break;
    case 2:
        if ((vf->priv->frame & 1) == 0)
            ret = ff_vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
        break;
    case 3:
        dmpi = ff_vf_get_image(vf->next, mpi->imgfmt,
                    MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
                    mpi->width, mpi->height*2);
        /* fixme, just clear alternate lines */
        ff_vf_mpi_clear(dmpi, 0, 0, dmpi->w, dmpi->h);
        if ((vf->priv->frame & 1) == 0) {
            memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
                   dmpi->stride[0]*2, mpi->stride[0]);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                memcpy_pic(dmpi->planes[1], mpi->planes[1],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[1]*2, mpi->stride[1]);
                memcpy_pic(dmpi->planes[2], mpi->planes[2],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[2]*2, mpi->stride[2]);
            }
        } else {
            memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h,
                   dmpi->stride[0]*2, mpi->stride[0]);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[1]*2, mpi->stride[1]);
                memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2],
                       mpi->chroma_width, mpi->chroma_height,
                       dmpi->stride[2]*2, mpi->stride[2]);
            }
        }
        ret = ff_vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
        break;
    case 4:
        // Interleave even lines (only) from Frame 'i' with odd
        // lines (only) from Frame 'i+1', halving the Frame
        // rate and preserving image height.

        dmpi = vf->priv->dmpi;

        // @@ Need help:  Should I set dmpi->fields to indicate
        // that the (new) frame will be interlaced!?  E.g. ...
        // dmpi->fields |= MP_IMGFIELD_INTERLACED;
        // dmpi->fields |= MP_IMGFIELD_TOP_FIRST;
        // etc.

        if (dmpi == NULL) {
            dmpi = ff_vf_get_image(vf->next, mpi->imgfmt,
                        MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
                        MP_IMGFLAG_PRESERVE,
                        mpi->width, mpi->height);

            vf->priv->dmpi = dmpi;

            my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
                my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
            }
        } else {
            vf->priv->dmpi = NULL;

            my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
                      mpi->planes[0]+mpi->stride[0],
                      mpi->w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
                          mpi->planes[1]+mpi->stride[1],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
                my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
                          mpi->planes[2]+mpi->stride[2],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
            }
            ret = ff_vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
        }
        break;
    }

    vf->priv->frame++;

    return ret;
}
コード例 #2
0
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
	struct pullup_context *c = vf->priv->ctx;
	struct pullup_buffer *b;
	struct pullup_frame *f;
	mp_image_t *dmpi;
	int ret;
	int p;
	int i;

	if (!vf->priv->init) init_pullup(vf, mpi);

	if (mpi->flags & MP_IMGFLAG_DIRECT) {
		b = mpi->priv;
		mpi->priv = 0;
	} else {
		b = pullup_get_buffer(c, 2);
		if (!b) {
			mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n");
			f = pullup_get_frame(c);
			pullup_release_frame(f);
			return 0;
		}
		memcpy_pic(b->planes[0], mpi->planes[0], mpi->w, mpi->h,
			c->stride[0], mpi->stride[0]);
		if (mpi->flags & MP_IMGFLAG_PLANAR) {
			memcpy_pic(b->planes[1], mpi->planes[1],
				mpi->chroma_width, mpi->chroma_height,
				c->stride[1], mpi->stride[1]);
			memcpy_pic(b->planes[2], mpi->planes[2],
				mpi->chroma_width, mpi->chroma_height,
				c->stride[2], mpi->stride[2]);
		}
	}
	if (mpi->qscale) {
		fast_memcpy(b->planes[3], mpi->qscale, c->w[3]);
		fast_memcpy(b->planes[3]+c->w[3], mpi->qscale, c->w[3]);
	}

	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);

	pullup_release_buffer(b, 2);

	f = pullup_get_frame(c);

	/* Fake yes for first few frames (buffer depth) to keep from
	 * breaking A/V sync with G1's bad architecture... */
	if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0;

	if (f->length < 2) {
		pullup_release_frame(f);
		f = pullup_get_frame(c);
		if (!f) return 0;
		if (f->length < 2) {
			pullup_release_frame(f);
			if (!(mpi->fields & MP_IMGFIELD_REPEAT_FIRST))
				return 0;
			f = pullup_get_frame(c);
			if (!f) return 0;
			if (f->length < 2) {
				pullup_release_frame(f);
				return 0;
			}
		}
	}

#if 0
	/* Average qscale tables from both frames. */
	if (mpi->qscale) {
		for (i=0; i<c->w[3]; i++) {
			vf->priv->qbuf[i] = (f->ofields[0]->planes[3][i]
				+ f->ofields[1]->planes[3][i+c->w[3]])>>1;
		}
	}
#else
	/* Take worst of qscale tables from both frames. */
	if (mpi->qscale) {
		for (i=0; i<c->w[3]; i++) {
			vf->priv->qbuf[i] = MAX(f->ofields[0]->planes[3][i], f->ofields[1]->planes[3][i+c->w[3]]);
		}
	}
#endif

	/* If the frame isn't already exportable... */
	while (!f->buffer) {
		dmpi = vf_get_image(vf->next, mpi->imgfmt,
			MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
			mpi->width, mpi->height);
		/* FIXME: Is it ok to discard dmpi if it's not direct? */
		if (!(dmpi->flags & MP_IMGFLAG_DIRECT)) {
			pullup_pack_frame(c, f);
			break;
		}
		/* Direct render fields into output buffer */
		my_memcpy_pic(dmpi->planes[0], f->ofields[0]->planes[0],
			mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2);
		my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0],
			f->ofields[1]->planes[0] + c->stride[0],
			mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2);
		if (mpi->flags & MP_IMGFLAG_PLANAR) {
			my_memcpy_pic(dmpi->planes[1], f->ofields[0]->planes[1],
				mpi->chroma_width, mpi->chroma_height/2,
				dmpi->stride[1]*2, c->stride[1]*2);
			my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1],
				f->ofields[1]->planes[1] + c->stride[1],
				mpi->chroma_width, mpi->chroma_height/2,
				dmpi->stride[1]*2, c->stride[1]*2);
			my_memcpy_pic(dmpi->planes[2], f->ofields[0]->planes[2],
				mpi->chroma_width, mpi->chroma_height/2,
				dmpi->stride[2]*2, c->stride[2]*2);
			my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2],
				f->ofields[1]->planes[2] + c->stride[2],
				mpi->chroma_width, mpi->chroma_height/2,
				dmpi->stride[2]*2, c->stride[2]*2);
		}
		pullup_release_frame(f);
		if (mpi->qscale) {
			dmpi->qscale = vf->priv->qbuf;
			dmpi->qstride = mpi->qstride;
			dmpi->qscale_type = mpi->qscale_type;
		}
		return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
	}
	dmpi = vf_get_image(vf->next, mpi->imgfmt,
		MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
		mpi->width, mpi->height);

	dmpi->planes[0] = f->buffer->planes[0];
	dmpi->planes[1] = f->buffer->planes[1];
	dmpi->planes[2] = f->buffer->planes[2];

	dmpi->stride[0] = c->stride[0];
	dmpi->stride[1] = c->stride[1];
	dmpi->stride[2] = c->stride[2];

	if (mpi->qscale) {
		dmpi->qscale = vf->priv->qbuf;
		dmpi->qstride = mpi->qstride;
		dmpi->qscale_type = mpi->qscale_type;
	}
	ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
	pullup_release_frame(f);
	return ret;
}
コード例 #3
0
ファイル: vf_softpulldown.c プロジェクト: Gamer125/wiibrowser
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
    mp_image_t *dmpi;
    int ret = 0;
    int flags = mpi->fields;
    int state = vf->priv->state;

    dmpi = vf_get_image(vf->next, mpi->imgfmt,
                        MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
                        MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);

    vf->priv->in++;

    if ((state == 0 &&
            !(flags & MP_IMGFIELD_TOP_FIRST)) ||
            (state == 1 &&
             flags & MP_IMGFIELD_TOP_FIRST)) {
        mp_msg(MSGT_VFILTER, MSGL_WARN,
               "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n",
               state,
               (flags & MP_IMGFIELD_TOP_FIRST) != 0,
               (flags & MP_IMGFIELD_REPEAT_FIRST) != 0);
        state ^= 1;
    }

    if (state == 0) {
        ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
        vf->priv->out++;
        if (flags & MP_IMGFIELD_REPEAT_FIRST) {
            my_memcpy_pic(dmpi->planes[0],
                          mpi->planes[0], mpi->w, mpi->h/2,
                          dmpi->stride[0]*2, mpi->stride[0]*2);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                my_memcpy_pic(dmpi->planes[1],
                              mpi->planes[1],
                              mpi->chroma_width,
                              mpi->chroma_height/2,
                              dmpi->stride[1]*2,
                              mpi->stride[1]*2);
                my_memcpy_pic(dmpi->planes[2],
                              mpi->planes[2],
                              mpi->chroma_width,
                              mpi->chroma_height/2,
                              dmpi->stride[2]*2,
                              mpi->stride[2]*2);
            }
            state=1;
        }
    } else {
        my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
                      mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
        if (mpi->flags & MP_IMGFLAG_PLANAR) {
            my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
                          mpi->planes[1]+mpi->stride[1],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
            my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
                          mpi->planes[2]+mpi->stride[2],
                          mpi->chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
        }
        ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
        vf->priv->out++;
        if (flags & MP_IMGFIELD_REPEAT_FIRST) {
            ret |= vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
            vf->priv->out++;
            state=0;
        } else {
            my_memcpy_pic(dmpi->planes[0],
                          mpi->planes[0], mpi->w, mpi->h/2,
                          dmpi->stride[0]*2, mpi->stride[0]*2);
            if (mpi->flags & MP_IMGFLAG_PLANAR) {
                my_memcpy_pic(dmpi->planes[1],
                              mpi->planes[1],
                              mpi->chroma_width,
                              mpi->chroma_height/2,
                              dmpi->stride[1]*2,
                              mpi->stride[1]*2);
                my_memcpy_pic(dmpi->planes[2],
                              mpi->planes[2],
                              mpi->chroma_width,
                              mpi->chroma_height/2,
                              dmpi->stride[2]*2,
                              mpi->stride[2]*2);
            }
        }
    }

    vf->priv->state = state;

    return ret;
}
コード例 #4
0
ファイル: vf_telecine.c プロジェクト: Larhard/mplayer
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
    mp_image_t *dmpi;
    int ret;
    int w            = (IMGFMT_IS_YUVP16(mpi->imgfmt) ? 2 : 1) * mpi->w;
    int chroma_width = (IMGFMT_IS_YUVP16(mpi->imgfmt) ? 2 : 1) * mpi->chroma_width;

    vf->priv->frame = (vf->priv->frame+1)%4;

    dmpi = vf_get_image(vf->next, mpi->imgfmt,
                        MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
                        MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);

    ret = 0;
    //    0/0  1/1  2/2  2/3  3/0
    switch (vf->priv->frame) {
    case 0:
        my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
                      mpi->planes[0]+mpi->stride[0], w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
        if (mpi->flags & MP_IMGFLAG_PLANAR) {
            my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
                          mpi->planes[1]+mpi->stride[1],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
            my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
                          mpi->planes[2]+mpi->stride[2],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
        }
        ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
    /* Fallthrough */
    case 1:
    case 2:
        memcpy_pic(dmpi->planes[0], mpi->planes[0], w, mpi->h,
                   dmpi->stride[0], mpi->stride[0]);
        if (mpi->flags & MP_IMGFLAG_PLANAR) {
            memcpy_pic(dmpi->planes[1], mpi->planes[1],
                       chroma_width, mpi->chroma_height,
                       dmpi->stride[1], mpi->stride[1]);
            memcpy_pic(dmpi->planes[2], mpi->planes[2],
                       chroma_width, mpi->chroma_height,
                       dmpi->stride[2], mpi->stride[2]);
        }
        return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) || ret;
    case 3:
        my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
                      mpi->planes[0]+mpi->stride[0], w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
        if (mpi->flags & MP_IMGFLAG_PLANAR) {
            my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
                          mpi->planes[1]+mpi->stride[1],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
            my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
                          mpi->planes[2]+mpi->stride[2],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
        }
        ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
        my_memcpy_pic(dmpi->planes[0], mpi->planes[0], w, mpi->h/2,
                      dmpi->stride[0]*2, mpi->stride[0]*2);
        if (mpi->flags & MP_IMGFLAG_PLANAR) {
            my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[1]*2, mpi->stride[1]*2);
            my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
                          chroma_width, mpi->chroma_height/2,
                          dmpi->stride[2]*2, mpi->stride[2]*2);
        }
        return ret;
    }
    return 0;
}
コード例 #5
0
ファイル: vf_softpulldown.c プロジェクト: kax4/mpv
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
	mp_image_t *dmpi;
	int ret = 0;
	int flags = mpi->fields;
	int state = vf->priv->state;

	dmpi = vf_get_image(vf->next, mpi->imgfmt,
	                    MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
	                    MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);

	vf->priv->in++;

	if ((state == 0 &&
	     !(flags & MP_IMGFIELD_TOP_FIRST)) ||
	    (state == 1 &&
	     flags & MP_IMGFIELD_TOP_FIRST)) {
		mp_msg(MSGT_VFILTER, MSGL_WARN,
		       "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n",
		       state,
		       (flags & MP_IMGFIELD_TOP_FIRST) != 0,
		       (flags & MP_IMGFIELD_REPEAT_FIRST) != 0);
		state ^= 1;
	}

	if (state == 0) {
		ret = vf_next_put_image(vf, mpi, vf_softpulldown_adjust_pts(&vf->priv->ptsbuf, pts, 0, 0, vf->priv->last_frame_duration));
		vf->priv->out++;
		if (flags & MP_IMGFIELD_REPEAT_FIRST) {
			my_memcpy_pic(dmpi->planes[0],
			           mpi->planes[0], mpi->w, mpi->h/2,
			           dmpi->stride[0]*2, mpi->stride[0]*2);
			if (mpi->flags & MP_IMGFLAG_PLANAR) {
				my_memcpy_pic(dmpi->planes[1],
				              mpi->planes[1],
				              mpi->chroma_width,
				              mpi->chroma_height/2,
				              dmpi->stride[1]*2,
				              mpi->stride[1]*2);
				my_memcpy_pic(dmpi->planes[2],
				              mpi->planes[2],
				              mpi->chroma_width,
				              mpi->chroma_height/2,
				              dmpi->stride[2]*2,
				              mpi->stride[2]*2);
			}
			state=1;
		}
	} else {
		my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
		              mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
		              dmpi->stride[0]*2, mpi->stride[0]*2);
		if (mpi->flags & MP_IMGFLAG_PLANAR) {
			my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
			              mpi->planes[1]+mpi->stride[1],
			              mpi->chroma_width, mpi->chroma_height/2,
			              dmpi->stride[1]*2, mpi->stride[1]*2);
			my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
			              mpi->planes[2]+mpi->stride[2],
			              mpi->chroma_width, mpi->chroma_height/2,
			              dmpi->stride[2]*2, mpi->stride[2]*2);
		}
		ret = vf_next_put_image(vf, dmpi, vf_softpulldown_adjust_pts(&vf->priv->ptsbuf, pts, 0, 0, vf->priv->last_frame_duration));
		vf->priv->out++;
		if (flags & MP_IMGFIELD_REPEAT_FIRST) {
			vf->priv->buffered_mpi = mpi;
			vf->priv->buffered_pts = pts;
			vf->priv->buffered_last_frame_duration = vf->priv->last_frame_duration;
			vf_queue_frame(vf, continue_buffered_image);
		} else {
			my_memcpy_pic(dmpi->planes[0],
			              mpi->planes[0], mpi->w, mpi->h/2,
			              dmpi->stride[0]*2, mpi->stride[0]*2);
			if (mpi->flags & MP_IMGFLAG_PLANAR) {
				my_memcpy_pic(dmpi->planes[1],
				              mpi->planes[1],
				              mpi->chroma_width,
				              mpi->chroma_height/2,
				              dmpi->stride[1]*2,
				              mpi->stride[1]*2);
				my_memcpy_pic(dmpi->planes[2],
				              mpi->planes[2],
				              mpi->chroma_width,
				              mpi->chroma_height/2,
				              dmpi->stride[2]*2,
				              mpi->stride[2]*2);
			}
		}
	}

	vf->priv->state = state;
	if (flags & MP_IMGFIELD_REPEAT_FIRST)
		vf->priv->last_frame_duration = 3;
	else
		vf->priv->last_frame_duration = 2;

	return ret;
}