[MPlayer-cvslog] CVS: main/postproc swscale.c, 1.154, 1.155 swscale_internal.h, 1.12, 1.13

Jindrich Makovicka CVS syncmail at mplayerhq.hu
Sun Apr 24 09:47:43 CEST 2005


CVS change done by Jindrich Makovicka CVS

Update of /cvsroot/mplayer/main/postproc
In directory mail:/var2/tmp/cvs-serv2054

Modified Files:
	swscale.c swscale_internal.h 
Log Message:
support for both orderings of the slices (top->down / bottom->up)

Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- swscale.c	23 Feb 2005 14:07:18 -0000	1.154
+++ swscale.c	24 Apr 2005 07:47:41 -0000	1.155
@@ -2275,10 +2275,34 @@
  */
 int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
                            int srcSliceH, uint8_t* dst[], int dstStride[]){
-	//copy strides, so they can safely be modified
-	int srcStride2[3]= {srcStride[0], srcStride[1], srcStride[2]};
-	int dstStride2[3]= {dstStride[0], dstStride[1], dstStride[2]};
-	return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2);
+	if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
+	    MSG_ERR("swScaler: slices start in the middle!\n");
+	    return 0;
+	}
+	if (c->sliceDir == 0) {
+	    if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
+	}
+
+	// copy strides, so they can safely be modified
+	if (c->sliceDir == 1) {
+	    // slices go from top to bottom
+	    int srcStride2[3]= {srcStride[0], srcStride[1], srcStride[2]};
+	    int dstStride2[3]= {dstStride[0], dstStride[1], dstStride[2]};
+	    return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2);
+	} else {
+	    // slices go from bottom to top => we flip the image internally
+	    uint8_t* src2[3]= {src[0] + (srcSliceH-1)*srcStride[0],
+			       src[1] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1],
+			       src[2] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2]
+	    };
+	    uint8_t* dst2[3]= {dst[0] + (c->dstH-1)*dstStride[0],
+			       dst[1] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1],
+			       dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2]};
+	    int srcStride2[3]= {-srcStride[0], -srcStride[1], -srcStride[2]};
+	    int dstStride2[3]= {-dstStride[0], -dstStride[1], -dstStride[2]};
+	    
+	    return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2);
+	}
 }
 
 /**

Index: swscale_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_internal.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- swscale_internal.h	31 Jan 2005 15:57:27 -0000	1.12
+++ swscale_internal.h	24 Apr 2005 07:47:41 -0000	1.13
@@ -60,6 +60,7 @@
 	int chrIntHSubSample, chrIntVSubSample;
 	int chrDstHSubSample, chrDstVSubSample;
 	int vChrDrop;
+        int sliceDir;
 	double param[2];
 
 	int16_t **lumPixBuf;




More information about the MPlayer-cvslog mailing list