[Mplayer-cvslog] CVS: main/libmpcodecs/native cyuv.c,1.3,1.4

Arpi of Ize arpi at mplayerhq.hu
Sat Sep 28 00:29:57 CEST 2002


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

Modified Files:
	cyuv.c 
Log Message:
some cleanup


Index: cyuv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/native/cyuv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cyuv.c	22 Sep 2002 00:10:31 -0000	1.3
+++ cyuv.c	27 Sep 2002 22:29:43 -0000	1.4
@@ -35,101 +35,50 @@
  */
 void decode_cyuv(unsigned char *buf, int size, unsigned char *frame, int width, int height, int format)
 {
-int i, xpos, ypos, cur_Y = 0, cur_U = 0, cur_V = 0;
-char *delta_y_tbl, *delta_c_tbl, *ptr;
+unsigned int i, xpos, ypos;
+unsigned char *delta_y_tbl, *delta_c_tbl, *ptr;
 
 	delta_y_tbl = buf + 16;
 	delta_c_tbl = buf + 32;
 	ptr = buf + (16 * 3);
 
 	for(ypos = 0; ypos < height; ypos++)
-		for(xpos = 0; xpos < width; xpos += 4)
-			{
-			if(xpos == 0)		/* first pixels in scanline */
-				{
+		for(xpos = 0; xpos < width; xpos += 2){
+			unsigned char cur_Y1,cur_Y2,cur_U,cur_V;
+			if(xpos&2){
+			    i = *(ptr++);
+			    cur_Y1 = (cur_Y2 + delta_y_tbl[i & 0x0f])/* & 0xff*/;
+			    cur_Y2 = (cur_Y1 + delta_y_tbl[i >> 4])/* & 0xff*/;
+			} else {
+			    if(xpos == 0) {		/* first pixels in scanline */
 				cur_U = *(ptr++);
-				cur_Y = (cur_U & 0x0f) << 4;
+				cur_Y1= (cur_U & 0x0f) << 4;
 				cur_U = cur_U & 0xf0;
-				if (format == IMGFMT_YUY2)
-					{
-					*frame++ = cur_Y;
-					*frame++ = cur_U;
-					}
-				else
-					{
-					*frame++ = cur_U;
-					*frame++ = cur_Y;
-					}
-
 				cur_V = *(ptr++);
-				cur_Y = (cur_Y + delta_y_tbl[cur_V & 0x0f]) & 0xff;
+				cur_Y2= (cur_Y1 + delta_y_tbl[cur_V & 0x0f])/* & 0xff*/;
 				cur_V = cur_V & 0xf0;
-				if (format == IMGFMT_YUY2)
-					{
-					*frame++ = cur_Y;
-					*frame++ = cur_V;
-					}
-				else
-					{
-					*frame++ = cur_V;
-					*frame++ = cur_Y;
-					}
-				}
-			else			/* subsequent pixels in scanline */
-				{
+			    } else {	/* subsequent pixels in scanline */
 				i = *(ptr++);
-				cur_U = (cur_U + delta_c_tbl[i >> 4]) & 0xff;
-				cur_Y = (cur_Y + delta_y_tbl[i & 0x0f]) & 0xff;
-				if (format == IMGFMT_YUY2)
-					{
-					*frame++ = cur_Y;
-					*frame++ = cur_U;
-					}
-				else
-					{
-					*frame++ = cur_U;
-					*frame++ = cur_Y;
-					}
-
+				cur_U = (cur_U + delta_c_tbl[i >> 4])/* & 0xff*/;
+				cur_Y1= (cur_Y2 + delta_y_tbl[i & 0x0f])/* & 0xff*/;
 				i = *(ptr++);
-				cur_V = (cur_V + delta_c_tbl[i >> 4]) & 0xff;
-				cur_Y = (cur_Y + delta_y_tbl[i & 0x0f]) & 0xff;
-				if (format == IMGFMT_YUY2)
-					{
-					*frame++ = cur_Y;
-					*frame++ = cur_V;
-					}
-				else
-					{
-					*frame++ = cur_V;
-					*frame++ = cur_Y;
-					}
-				}
+				cur_V = (cur_V + delta_c_tbl[i >> 4])/* & 0xff*/;
+				cur_Y2= (cur_Y1 + delta_y_tbl[i & 0x0f])/* & 0xff*/;
+			    }
+			}
 
-			i = *(ptr++);
-			cur_Y = (cur_Y + delta_y_tbl[i & 0x0f]) & 0xff;
-			if (format == IMGFMT_YUY2)
-				{
-				*frame++ = cur_Y;
-				*frame++ = cur_U;
-				}
-			else
-				{
+			if (format == IMGFMT_YUY2) {
+				*frame++ = cur_Y1;
 				*frame++ = cur_U;
-				*frame++ = cur_Y;
-				}
-
-			cur_Y = (cur_Y + delta_y_tbl[i >> 4]) & 0xff;
-			if (format == IMGFMT_YUY2)
-				{
-				*frame++ = cur_Y;
+				*frame++ = cur_Y2;
 				*frame++ = cur_V;
-				}
-			else
-				{
+			} else {
+				*frame++ = cur_U;
+				*frame++ = cur_Y1;
 				*frame++ = cur_V;
-				*frame++ = cur_Y;
-				}
+				*frame++ = cur_Y2;
 			}
+		}
+
 }
 




More information about the MPlayer-cvslog mailing list