[Mplayer-cvslog] CVS: main/libmpcodecs vf_crop.c,1.6,1.7

Arpi of Ize arpi at mplayerhq.hu
Sun Jan 5 16:39:55 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv20850

Modified Files:
	vf_crop.c 
Log Message:
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
- 10l in planar formats, use chroma_?_shift insteda or hardcoded >>1


Index: vf_crop.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_crop.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vf_crop.c	10 Sep 2002 22:18:32 -0000	1.6
+++ vf_crop.c	5 Jan 2003 15:39:52 -0000	1.7
@@ -26,6 +26,27 @@
     if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
     if(vf->priv->crop_x<0) vf->priv->crop_x=(width-vf->priv->crop_w)/2;
     if(vf->priv->crop_y<0) vf->priv->crop_y=(height-vf->priv->crop_h)/2;
+    // rounding:
+    if(!IMGFMT_IS_RGB(outfmt) && !IMGFMT_IS_BGR(outfmt)){
+	switch(outfmt){
+	case IMGFMT_444P:
+	case IMGFMT_Y800:
+	case IMGFMT_Y8:
+	    break;
+	case IMGFMT_YVU9:
+	case IMGFMT_IF09:
+	    vf->priv->crop_y&=~3;
+	case IMGFMT_411P:
+	    vf->priv->crop_x&=~3;
+	    break;
+	case IMGFMT_YV12:
+	case IMGFMT_I420:
+	case IMGFMT_IYUV:
+	    vf->priv->crop_y&=~1;
+	default:
+	    vf->priv->crop_x&=~1;
+	}
+    }
     // check:
     if(vf->priv->crop_w+vf->priv->crop_x>width ||
        vf->priv->crop_h+vf->priv->crop_y>height){
@@ -47,9 +68,9 @@
 	dmpi->planes[0]=mpi->planes[0]+
 	    vf->priv->crop_y*mpi->stride[0]+vf->priv->crop_x;
 	dmpi->planes[1]=mpi->planes[1]+
-	    (vf->priv->crop_y>>1)*mpi->stride[1]+(vf->priv->crop_x>>1);
+	    (vf->priv->crop_y>>mpi->chroma_y_shift)*mpi->stride[1]+(vf->priv->crop_x>>mpi->chroma_x_shift);
 	dmpi->planes[2]=mpi->planes[2]+
-	    (vf->priv->crop_y>>1)*mpi->stride[2]+(vf->priv->crop_x>>1);
+	    (vf->priv->crop_y>>mpi->chroma_y_shift)*mpi->stride[2]+(vf->priv->crop_x>>mpi->chroma_x_shift);
 	dmpi->stride[1]=mpi->stride[1];
 	dmpi->stride[2]=mpi->stride[2];
     } else {



More information about the MPlayer-cvslog mailing list