[Mplayer-cvslog] CVS: main/libmpcodecs vf_crop.c,1.15,1.16

Richard Felker CVS rfelker at mplayerhq.hu
Wed Apr 30 20:24:30 CEST 2003


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

Modified Files:
	vf_crop.c 
Log Message:
100l in my 100l fix! :(
it's finally right now (i hope!)


Index: vf_crop.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_crop.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- vf_crop.c	28 Apr 2003 02:23:57 -0000	1.15
+++ vf_crop.c	30 Apr 2003 18:24:04 -0000	1.16
@@ -107,20 +107,30 @@
 static void draw_slice(struct vf_instance_s* vf,
         unsigned char** src, int* stride, int w,int h, int x, int y){
     unsigned char *src2[3];
-    src2[0] = src[0] + vf->priv->crop_y*stride[0] + vf->priv->crop_x;
+    src2[0] = src[0];
     if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
-	src2[1] = src[1] + (vf->priv->crop_y>>vf->priv->dmpi->chroma_y_shift)*stride[1]
-		+ (vf->priv->crop_x>>vf->priv->dmpi->chroma_x_shift);
-	src2[2] = src[2] + (vf->priv->crop_y>>vf->priv->dmpi->chroma_y_shift)*stride[2]
-		+ (vf->priv->crop_x>>vf->priv->dmpi->chroma_x_shift);
+	    src2[1] = src[1];
+	    src2[2] = src[2];
     }
     //mp_msg(MSGT_VFILTER, MSGL_V, "crop slice %d %d %d %d ->", w,h,x,y);
     if ((x -= vf->priv->crop_x) < 0) {
-	w += x;
+	x = -x;
+	src2[0] += x;
+	if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
+		src2[1] += x>>vf->priv->dmpi->chroma_x_shift;
+		src2[2] += x>>vf->priv->dmpi->chroma_x_shift;
+	}
+	w -= x;
 	x = 0;
     }
     if ((y -= vf->priv->crop_y) < 0) {
-	h += y;
+	y = -y;
+	src2[0] += y*stride[0];
+	if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
+		src2[1] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[1];
+		src2[2] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[2];
+	}
+	h -= y;
 	y = 0;
     }
     if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x;



More information about the MPlayer-cvslog mailing list