From 2e2faf4a17e32660788129088dc2e47f989ffb61 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 31 Oct 2002 22:47:51 +0000 Subject: (de)intrleave luma & chroma idependantly git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8007 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/vop.txt | 3 +-- libmpcodecs/vf_il.c | 64 ++++++++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/DOCS/tech/vop.txt b/DOCS/tech/vop.txt index f11a52a375..701e133e97 100644 --- a/DOCS/tech/vop.txt +++ b/DOCS/tech/vop.txt @@ -189,10 +189,9 @@ Current plugins: swap U & V plane MPI: EXPORT --vop il=[d|i][s][c] +-vop il=[d|i][s][:[d|i][s]] (de)interleaves lines d deinterleave i interleave - c chroma too (otherwise only luma is modified if the format is planar YUV) s swap fields (exchange even & odd lines) MPI: TEMP, accepts stride diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c index 7d12e2e395..e5e8ec7cc9 100644 --- a/libmpcodecs/vf_il.c +++ b/libmpcodecs/vf_il.c @@ -37,11 +37,14 @@ //===========================================================================// - -struct vf_priv_s { +typedef struct FilterParam{ int interleave; - int chroma; int swap; +}FilterParam; + +struct vf_priv_s { + FilterParam lumaParam; + FilterParam chromaParam; }; @@ -85,6 +88,8 @@ static int interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, i static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ int w; + FilterParam *luma = &vf->priv->lumaParam; + FilterParam *chroma= &vf->priv->chromaParam; mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, @@ -96,25 +101,16 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ w= mpi->w * mpi->bpp/8; interleave(dmpi->planes[0], mpi->planes[0], - w, mpi->h, dmpi->stride[0], mpi->stride[0], vf->priv->interleave, vf->priv->swap); + w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap); if(mpi->flags&MP_IMGFLAG_PLANAR){ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - - if(vf->priv->chroma){ - interleave(dmpi->planes[1], mpi->planes[1], cw,ch, - dmpi->stride[1], mpi->stride[1], vf->priv->interleave, vf->priv->swap); - interleave(dmpi->planes[2], mpi->planes[2], cw,ch, - dmpi->stride[2], mpi->stride[2], vf->priv->interleave, vf->priv->swap); - }else{ - int y; - for(y=0; y < ch; y++) - memcpy(dmpi->planes[1] + dmpi->stride[1]*y, mpi->planes[1] + mpi->stride[1]*y, cw); - for(y=0; y < ch; y++) - memcpy(dmpi->planes[2] + dmpi->stride[2]*y, mpi->planes[2] + mpi->stride[2]*y, cw); - } + interleave(dmpi->planes[1], mpi->planes[1], cw,ch, + dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); + interleave(dmpi->planes[2], mpi->planes[2], cw,ch, + dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); } return vf_next_put_image(vf,dmpi); @@ -127,6 +123,20 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){ return vf_next_query_format(vf, fmt); } +static void parse(FilterParam *fp, char* args){ + char *pos; + char *max= strchr(args, ':'); + + if(!max) max= args + strlen(args); + + pos= strchr(args, 's'); + if(pos && posswap=1; + pos= strchr(args, 'i'); + if(pos && posinterleave=1; + pos= strchr(args, 'd'); + if(pos && posinterleave=-1; +} + static int open(vf_instance_t *vf, char* args){ char *pos, *max; @@ -136,19 +146,13 @@ static int open(vf_instance_t *vf, char* args){ vf->query_format=query_format; vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - - if(args==NULL) return 0; - - max= args + strlen(args); - - pos= strchr(args, 's'); - if(pos && pospriv->swap=1; - pos= strchr(args, 'c'); - if(pos && pospriv->chroma=1; - pos= strchr(args, 'i'); - if(pos && pospriv->interleave=1; - pos= strchr(args, 'd'); - if(pos && pospriv->interleave=-1; + + if(args) + { + char *arg2= strchr(args,':'); + if(arg2) parse(&vf->priv->chromaParam, arg2+1); + parse(&vf->priv->lumaParam, args); + } return 1; } -- cgit v1.2.3