# HG changeset patch # User iive # Date 1144510209 0 # Node ID d1c6b9abbc73b08165a92eaeb469f16e434e8100 # Parent a75d8f4b356380bb88890db5e488663be71f8ea7 New mode for tinterlace filter patch by Walter Belhaven diff -r a75d8f4b3563 -r d1c6b9abbc73 libmpcodecs/vf_tinterlace.c --- a/libmpcodecs/vf_tinterlace.c Sat Apr 08 13:53:02 2006 +0000 +++ b/libmpcodecs/vf_tinterlace.c Sat Apr 08 15:30:09 2006 +0000 @@ -35,6 +35,22 @@ mp_image_t *dmpi; }; +// Copied verbatim from vf_telecine.c: +static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) +{ + int i; + void *retval=dst; + + for(i=0; ipriv->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 = 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 = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + } + break; } vf->priv->frame++; @@ -145,6 +212,7 @@ return vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt); case 1: /* odd frames */ case 2: /* even frames */ + case 4: /* alternate frame (height-preserving) interlacing */ return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } return 0;