[Mplayer-cvslog] CVS: main/postproc swscale.c,1.131,1.132 swscale_internal.h,1.5,1.6 swscale_template.c,1.103,1.104

Michael Niedermayer CVS michael at mplayerhq.hu
Wed Oct 15 13:22:34 CEST 2003


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

Modified Files:
	swscale.c swscale_internal.h swscale_template.c 
Log Message:
rounding fixes


Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- swscale.c	9 Oct 2003 22:25:53 -0000	1.131
+++ swscale.c	15 Oct 2003 11:21:54 -0000	1.132
@@ -222,7 +222,7 @@
 	int i;
 	for(i=0; i<dstW; i++)
 	{
-		int val=0;
+		int val=1<<18;
 		int j;
 		for(j=0; j<lumFilterSize; j++)
 			val += lumSrc[j][i] * lumFilter[j];
@@ -233,8 +233,8 @@
 	if(uDest != NULL)
 		for(i=0; i<chrDstW; i++)
 		{
-			int u=0;
-			int v=0;
+			int u=1<<18;
+			int v=1<<18;
 			int j;
 			for(j=0; j<chrFilterSize; j++)
 			{
@@ -251,10 +251,10 @@
 #define YSCALE_YUV_2_PACKEDX_C(type) \
 		for(i=0; i<(dstW>>1); i++){\
 			int j;\
-			int Y1=0;\
-			int Y2=0;\
-			int U=0;\
-			int V=0;\
+			int Y1=1<<18;\
+			int Y2=1<<18;\
+			int U=1<<18;\
+			int V=1<<18;\
 			type *r, *b, *g;\
 			const int i2= 2*i;\
 			\
@@ -621,8 +621,8 @@
 			int acc=0;
 			for(i=0; i<dstW-1; i+=2){
 				int j;
-				int Y1=0;
-				int Y2=0;
+				int Y1=1<<18;
+				int Y2=1<<18;
 
 				for(j=0; j<lumFilterSize; j++)
 				{
@@ -1093,7 +1093,7 @@
 		scale/= sum;
 		for(j=0; j<*outFilterSize; j++)
 		{
-			(*outFilter)[i*(*outFilterSize) + j]= (int)(filter[i*filterSize + j]*scale);
+			(*outFilter)[i*(*outFilterSize) + j]= (int)(filter[i*filterSize + j]*scale + 0.5);
 		}
 	}
 	
@@ -1772,6 +1772,7 @@
 	c->srcFormat= srcFormat;
 	c->origDstFormat= origDstFormat;
 	c->origSrcFormat= origSrcFormat;
+        c->vRounder= 4* 0x0001000100010001ULL;
 
 	usesFilter=0;
 	if(dstFilter->lumV!=NULL && dstFilter->lumV->length>1) usesFilter=1;

Index: swscale_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_internal.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- swscale_internal.h	1 May 2003 19:14:27 -0000	1.5
+++ swscale_internal.h	15 Oct 2003 11:21:54 -0000	1.6
@@ -109,10 +109,11 @@
 #define Y_OFFSET     "8*8"
 #define U_OFFSET     "9*8"
 #define V_OFFSET     "10*8"
-#define LUM_MMX_FILTER_OFFSET "11*8"
-#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
-#define DSTW_OFFSET  "11*8+4*4*256*2"
-#define ESP_OFFSET  "11*8+4*4*256*2+4"
+#define VROUNDER_OFFSET "11*8"  
+#define LUM_MMX_FILTER_OFFSET "12*8"
+#define CHR_MMX_FILTER_OFFSET "12*8+4*4*256"
+#define DSTW_OFFSET  "12*8+4*4*256*2"
+#define ESP_OFFSET  "12*8+4*4*256*2+4"
                   
 	uint64_t redDither   __attribute__((aligned(8)));
 	uint64_t greenDither __attribute__((aligned(8)));
@@ -126,6 +127,7 @@
 	uint64_t yOffset     __attribute__((aligned(8)));
 	uint64_t uOffset     __attribute__((aligned(8)));
 	uint64_t vOffset     __attribute__((aligned(8)));
+	uint64_t vRounder     __attribute__((aligned(8)));
 	int32_t  lumMmxFilter[4*MAX_FILTER_SIZE];
 	int32_t  chrMmxFilter[4*MAX_FILTER_SIZE];
 	int dstW;

Index: swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- swscale_template.c	4 Oct 2003 17:29:06 -0000	1.103
+++ swscale_template.c	15 Oct 2003 11:21:54 -0000	1.104
@@ -61,8 +61,8 @@
 
 #define YSCALEYUV2YV12X(x, offset) \
 			"xorl %%eax, %%eax		\n\t"\
-			"pxor %%mm3, %%mm3		\n\t"\
-			"pxor %%mm4, %%mm4		\n\t"\
+			"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
+			"movq %%mm3, %%mm4		\n\t"\
 			"leal " offset "(%0), %%edx	\n\t"\
 			"movl (%%edx), %%esi		\n\t"\
 			".balign 16			\n\t" /* FIXME Unroll? */\
@@ -84,8 +84,8 @@
 			MOVNTQ(%%mm3, (%1, %%eax))\
 			"addl $8, %%eax			\n\t"\
 			"cmpl %2, %%eax			\n\t"\
-			"pxor %%mm3, %%mm3		\n\t"\
-			"pxor %%mm4, %%mm4		\n\t"\
+			"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
+			"movq %%mm3, %%mm4		\n\t"\
 			"leal " offset "(%0), %%edx	\n\t"\
 			"movl (%%edx), %%esi		\n\t"\
 			"jb 1b				\n\t"
@@ -117,8 +117,8 @@
 		"1:				\n\t"\
 		"leal "CHR_MMX_FILTER_OFFSET"(%0), %%edx	\n\t"\
 		"movl (%%edx), %%esi		\n\t"\
-		"pxor %%mm3, %%mm3		\n\t"\
-		"pxor %%mm4, %%mm4		\n\t"\
+		"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
+		"movq %%mm3, %%mm4		\n\t"\
 		".balign 16			\n\t"\
 		"2:				\n\t"\
 		"movq 8(%%edx), %%mm0		\n\t" /* filterCoeff */\
@@ -135,8 +135,8 @@
 \
 		"leal "LUM_MMX_FILTER_OFFSET"(%0), %%edx	\n\t"\
 		"movl (%%edx), %%esi		\n\t"\
-		"pxor %%mm1, %%mm1		\n\t"\
-		"pxor %%mm7, %%mm7		\n\t"\
+		"movq "VROUNDER_OFFSET"(%0), %%mm1\n\t"\
+		"movq %%mm1, %%mm7		\n\t"\
 		".balign 16			\n\t"\
 		"2:				\n\t"\
 		"movq 8(%%edx), %%mm0		\n\t" /* filterCoeff */\
@@ -2611,6 +2611,8 @@
 		const int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input
 		const int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input
 
+//printf("dstY:%d dstH:%d firstLumSrcY:%d lastInLumBuf:%d vLumBufSize: %d vChrBufSize: %d slice: %d %d vLumFilterSize: %d firstChrSrcY: %d vChrFilterSize: %d c->chrSrcVSubSample: %d\n",
+// dstY, dstH, firstLumSrcY, lastInLumBuf, vLumBufSize, vChrBufSize, srcSliceY, srcSliceH, vLumFilterSize, firstChrSrcY, vChrFilterSize,  c->chrSrcVSubSample);
 		//handle holes (FAST_BILINEAR & weird filters)
 		if(firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
 		if(firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;



More information about the MPlayer-cvslog mailing list