[Mplayer-cvslog] CVS: main/postproc swscale.c,1.105,1.106 swscale_template.c,1.88,1.89

Michael Niedermayer michael at mplayerhq.hu
Sun Oct 13 02:27:27 CEST 2002


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

Modified Files:
	swscale.c swscale_template.c 
Log Message:
yuy2 output support


Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- swscale.c	1 Aug 2002 12:39:08 -0000	1.105
+++ swscale.c	13 Oct 2002 00:27:12 -0000	1.106
@@ -18,7 +18,7 @@
 
 /*
   supported Input formats: YV12, I420/IYUV, YUY2, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09
-  supported output formats: YV12, I420/IYUV, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
+  supported output formats: YV12, I420/IYUV, YUY2, {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)
@@ -114,7 +114,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_I420 \
+#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YUY2\
 			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
 			|| isRGB(x) || isBGR(x)\
 			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
@@ -420,7 +420,8 @@
 		}
 }
 
-#define YSCALE_YUV_2_RGBX_C(type) \
+
+#define YSCALE_YUV_2_X_C(type) \
 		for(i=0; i<(dstW>>1); i++){\
 			int j;\
 			int Y1=0;\
@@ -454,48 +455,60 @@
 				else if(U<0) U=0;\
 				if(V>255)    V=255;\
 				else if(V<0) V=0;\
-			}\
+			}
+                        
+#define YSCALE_YUV_2_RGBX_C(type) \
+			YSCALE_YUV_2_X_C(type)\
 			r = c->table_rV[V];\
 			g = c->table_gU[U] + c->table_gV[V];\
 			b = c->table_bU[U];\
 
-#define YSCALE_YUV_2_RGB2_C(type) \
+#define YSCALE_YUV_2_2_C \
 		for(i=0; i<(dstW>>1); i++){\
 			const int i2= 2*i;\
 			int Y1= (buf0[i2  ]*yalpha1+buf1[i2  ]*yalpha)>>19;\
 			int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19;\
 			int U= (uvbuf0[i     ]*uvalpha1+uvbuf1[i     ]*uvalpha)>>19;\
 			int V= (uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19;\
+
+#define YSCALE_YUV_2_RGB2_C(type) \
+			YSCALE_YUV_2_2_C\
 			type *r, *b, *g;\
 			r = c->table_rV[V];\
 			g = c->table_gU[U] + c->table_gV[V];\
 			b = c->table_bU[U];\
 
-#define YSCALE_YUV_2_RGB1_C(type) \
+#define YSCALE_YUV_2_1_C \
 		for(i=0; i<(dstW>>1); i++){\
 			const int i2= 2*i;\
 			int Y1= buf0[i2  ]>>7;\
 			int Y2= buf0[i2+1]>>7;\
 			int U= (uvbuf1[i     ])>>7;\
 			int V= (uvbuf1[i+2048])>>7;\
+
+#define YSCALE_YUV_2_RGB1_C(type) \
+			YSCALE_YUV_2_1_C\
 			type *r, *b, *g;\
 			r = c->table_rV[V];\
 			g = c->table_gU[U] + c->table_gV[V];\
 			b = c->table_bU[U];\
 
-#define YSCALE_YUV_2_RGB1B_C(type) \
+#define YSCALE_YUV_2_1B_C \
 		for(i=0; i<(dstW>>1); i++){\
 			const int i2= 2*i;\
 			int Y1= buf0[i2  ]>>7;\
 			int Y2= buf0[i2+1]>>7;\
 			int U= (uvbuf0[i     ] + uvbuf1[i     ])>>8;\
 			int V= (uvbuf0[i+2048] + uvbuf1[i+2048])>>8;\
+
+#define YSCALE_YUV_2_RGB1B_C(type) \
+			YSCALE_YUV_2_1B_C\
 			type *r, *b, *g;\
 			r = c->table_rV[V];\
 			g = c->table_gU[U] + c->table_gV[V];\
 			b = c->table_bU[U];\
 
-#define YSCALE_YUV_2_ANYRGB_C(func)\
+#define YSCALE_YUV_2_ANYRGB_C(func, func2)\
 	switch(c->dstFormat)\
 	{\
 	case IMGFMT_BGR32:\
@@ -644,6 +657,14 @@
 */\
 		}\
 		break;\
+	case IMGFMT_YUY2:\
+		func2\
+			((uint8_t*)dest)[2*i2+0]= Y1;\
+			((uint8_t*)dest)[2*i2+1]= U;\
+			((uint8_t*)dest)[2*i2+2]= Y2;\
+			((uint8_t*)dest)[2*i2+3]= V;\
+		}		\
+		break;\
 	}\
 
 
@@ -769,6 +790,14 @@
 			}
 		}
 		break;
+	case IMGFMT_YUY2:
+		YSCALE_YUV_2_X_C(void)
+			((uint8_t*)dest)[2*i2+0]= Y1;
+			((uint8_t*)dest)[2*i2+1]= U;
+			((uint8_t*)dest)[2*i2+2]= Y2;
+			((uint8_t*)dest)[2*i2+3]= V;
+		}
+                break;
 	}
 }
 

Index: swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- swscale_template.c	9 Sep 2002 22:48:39 -0000	1.88
+++ swscale_template.c	13 Oct 2002 00:27:12 -0000	1.89
@@ -1127,7 +1127,7 @@
 	default: break;
 	}
 #endif //HAVE_MMX
-YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C)
+YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_2_C)
 }
 
 /**
@@ -1265,9 +1265,9 @@
 #endif
 	if( uvalpha < 2048 )
 	{
-		YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C)
+		YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_1_C)
 	}else{
-		YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C)
+		YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_1B_C)
 	}
 }
 




More information about the MPlayer-cvslog mailing list