[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.58,1.59 rgb2rgb_template.c,1.65,1.66 swscale.c,1.130,1.131

Alex Beregszaszi alex at mplayerhq.hu
Fri Oct 10 00:25:57 CEST 2003


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

Modified Files:
	rgb2rgb.c rgb2rgb_template.c swscale.c 
Log Message:
uyvy output support in swscaler

Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- rgb2rgb.c	25 Apr 2003 17:16:55 -0000	1.58
+++ rgb2rgb.c	9 Oct 2003 22:25:53 -0000	1.59
@@ -41,6 +41,9 @@
 void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
 	unsigned int width, unsigned int height,
 	int lumStride, int chromStride, int dstStride);
+void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+	unsigned int width, unsigned int height,
+	int lumStride, int chromStride, int dstStride);
 void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
 	unsigned int width, unsigned int height,
 	int lumStride, int chromStride, int dstStride);
@@ -213,6 +216,7 @@
 		rgb32tobgr16= rgb32tobgr16_MMX2;
 		rgb32tobgr15= rgb32tobgr15_MMX2;
 		yv12toyuy2= yv12toyuy2_MMX2;
+		yv12touyvy= yv12touyvy_MMX2;
 		yuv422ptoyuy2= yuv422ptoyuy2_MMX2;
 		yuy2toyv12= yuy2toyv12_MMX2;
 		uyvytoyv12= uyvytoyv12_MMX2;
@@ -242,6 +246,7 @@
 		rgb32tobgr16= rgb32tobgr16_3DNOW;
 		rgb32tobgr15= rgb32tobgr15_3DNOW;
 		yv12toyuy2= yv12toyuy2_3DNOW;
+		yv12touyvy= yv12touyvy_3DNOW;
 		yuv422ptoyuy2= yuv422ptoyuy2_3DNOW;
 		yuy2toyv12= yuy2toyv12_3DNOW;
 		uyvytoyv12= uyvytoyv12_3DNOW;
@@ -271,6 +276,7 @@
 		rgb32tobgr16= rgb32tobgr16_MMX;
 		rgb32tobgr15= rgb32tobgr15_MMX;
 		yv12toyuy2= yv12toyuy2_MMX;
+		yv12touyvy= yv12touyvy_MMX;
 		yuv422ptoyuy2= yuv422ptoyuy2_MMX;
 		yuy2toyv12= yuy2toyv12_MMX;
 		uyvytoyv12= uyvytoyv12_MMX;
@@ -302,6 +308,7 @@
 		rgb32tobgr16= rgb32tobgr16_C;
 		rgb32tobgr15= rgb32tobgr15_C;
 		yv12toyuy2= yv12toyuy2_C;
+		yv12touyvy= yv12touyvy_C;
 		yuv422ptoyuy2= yuv422ptoyuy2_C;
 		yuy2toyv12= yuy2toyv12_C;
 //		uyvytoyv12= uyvytoyv12_C;

Index: rgb2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb_template.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- rgb2rgb_template.c	25 Apr 2003 17:22:11 -0000	1.65
+++ rgb2rgb_template.c	9 Oct 2003 22:25:53 -0000	1.66
@@ -1568,6 +1568,64 @@
 	RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
 }
 
+static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+	unsigned int width, unsigned int height,
+	int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
+{
+	unsigned y;
+	const unsigned chromWidth= width>>1;
+	for(y=0; y<height; y++)
+	{
+#if __WORDSIZE >= 64
+		int i;
+		uint64_t *ldst = (uint64_t *) dst;
+		const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+		for(i = 0; i < chromWidth; i += 2){
+			uint64_t k, l;
+			k = uc[0] + (yc[0] << 8) +
+			    (vc[0] << 16) + (yc[1] << 24);
+			l = uc[1] + (yc[2] << 8) +
+			    (vc[1] << 16) + (yc[3] << 24);
+			*ldst++ = k + (l << 32);
+			yc += 4;
+			uc += 2;
+			vc += 2;
+		}
+
+#else
+		int i, *idst = (int32_t *) dst;
+		const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+		for(i = 0; i < chromWidth; i++){
+			*idst++ = uc[0] + (yc[0] << 8) +
+			    (vc[0] << 16) + (yc[1] << 24);
+			yc += 2;
+			uc++;
+			vc++;
+		}
+#endif
+		if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
+		{
+			usrc += chromStride;
+			vsrc += chromStride;
+		}
+		ysrc += lumStride;
+		dst += dstStride;
+	}
+}
+
+/**
+ *
+ * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
+ * problem for anyone then tell me, and ill fix it)
+ */
+static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+	unsigned int width, unsigned int height,
+	int lumStride, int chromStride, int dstStride)
+{
+	//FIXME interpolate chroma
+	RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
+}
+
 /**
  *
  * width should be a multiple of 16

Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -r1.130 -r1.131
--- swscale.c	4 Oct 2003 17:29:06 -0000	1.130
+++ swscale.c	9 Oct 2003 22:25:53 -0000	1.131
@@ -18,7 +18,7 @@
 
 /*
   supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09
-  supported output formats: YV12, I420/IYUV, YUY2, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
+  supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
   {BGR,RGB}{1,4,8,15,16} support dithering
   
   unscaled special converters (YV12=I420=IYUV, Y800=Y8)
@@ -107,7 +107,7 @@
 			|| (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\
 			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9\
 			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
-#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2\
+#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2 || (x)==IMGFMT_UYVY\
 			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
 			|| isRGB(x) || isBGR(x)\
 			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
@@ -503,6 +503,14 @@
 			((uint8_t*)dest)[2*i2+3]= V;\
 		}		\
 		break;\
+	case IMGFMT_UYVY:\
+		func2\
+			((uint8_t*)dest)[2*i2+0]= U;\
+			((uint8_t*)dest)[2*i2+1]= Y1;\
+			((uint8_t*)dest)[2*i2+2]= V;\
+			((uint8_t*)dest)[2*i2+3]= Y2;\
+		}		\
+		break;\
 	}\
 
 
@@ -647,6 +655,14 @@
 			((uint8_t*)dest)[2*i2+3]= V;
 		}
                 break;
+	case IMGFMT_UYVY:
+		YSCALE_YUV_2_PACKEDX_C(void)
+			((uint8_t*)dest)[2*i2+0]= U;
+			((uint8_t*)dest)[2*i2+1]= Y1;
+			((uint8_t*)dest)[2*i2+2]= V;
+			((uint8_t*)dest)[2*i2+3]= Y2;
+		}
+                break;
 	}
 }
 
@@ -1336,6 +1352,15 @@
 	return srcSliceH;
 }
 
+static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+             int srcSliceH, uint8_t* dstParam[], int dstStride[]){
+	uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
+
+	yv12touyvy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
+
+	return srcSliceH;
+}
+
 /* {RGB,BGR}{15,16,24,32} -> {RGB,BGR}{15,16,24,32} */
 static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
 			   int srcSliceH, uint8_t* dst[], int dstStride[]){
@@ -1821,9 +1846,13 @@
 				c->swScale= rgb2rgbWrapper;
 
 			/* yv12_to_yuy2 */
-			if(srcFormat == IMGFMT_YV12 && dstFormat == IMGFMT_YUY2)
+			if(srcFormat == IMGFMT_YV12 && 
+			    (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY))
 			{
-				c->swScale= PlanarToYuy2Wrapper;
+				if (dstFormat == IMGFMT_YUY2)
+				    c->swScale= PlanarToYuy2Wrapper;
+				else
+				    c->swScale= PlanarToUyvyWrapper;
 			}
 		}
 



More information about the MPlayer-cvslog mailing list