summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_pullup.c
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-01 02:54:06 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-01 02:54:06 +0000
commit0c079bc2df5a0f9ce18c999e7a0aca6c37388596 (patch)
tree785191f9b2d8a7645c8e3b690905b610100ce949 /libmpcodecs/vf_pullup.c
parent1e2d6e685d8b9927b43ab5528e11d7cb349367a9 (diff)
downloadmpv-0c079bc2df5a0f9ce18c999e7a0aca6c37388596.tar.bz2
mpv-0c079bc2df5a0f9ce18c999e7a0aca6c37388596.tar.xz
direct render frames whose fields are not in a common buffer, rather
than repacking them together and exporting. slight performance boost. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10774 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_pullup.c')
-rw-r--r--libmpcodecs/vf_pullup.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c
index 6e5919f115..4c5adcb692 100644
--- a/libmpcodecs/vf_pullup.c
+++ b/libmpcodecs/vf_pullup.c
@@ -93,8 +93,6 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
mpi->flags |= MP_IMGFLAG_DIRECT;
mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
-
- //mpi->width = mpi->stride[0];
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
@@ -133,7 +131,6 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 :
(mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0);
- //printf("p=%d\n", p);
pullup_submit_field(c, b, p);
pullup_submit_field(c, b, p^1);
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
@@ -158,16 +155,40 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
}
/* If the frame isn't already exportable... */
- if (!f->buffer) {
- /* FIXME: DR disabled for now */
- if (0) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height);
- /* FIXME: draw into DR buffer */
- return vf_next_put_image(vf, dmpi);
+ 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 */
+ p = f->parity;
+ my_memcpy_pic(dmpi->planes[0], f->fields[p]->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->fields[p^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->fields[p]->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->fields[p^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->fields[p]->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->fields[p^1]->planes[2] + c->stride[2],
+ mpi->chroma_width, mpi->chroma_height/2,
+ dmpi->stride[2]*2, c->stride[2]*2);
}
- pullup_pack_frame(c, f);
+ pullup_release_frame(f);
+ return vf_next_put_image(vf, dmpi);
}
dmpi = vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,