[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.53,1.54

Alex Beregszaszi alex at mplayerhq.hu
Mon Sep 9 18:18:50 CEST 2002


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

Modified Files:
	rgb2rgb.c 
Log Message:
fixed palette8to{rgb24,bgr24,rgb32,bgr32}

Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- rgb2rgb.c	30 Aug 2002 11:17:15 -0000	1.53
+++ rgb2rgb.c	9 Sep 2002 16:18:47 -0000	1.54
@@ -265,32 +265,36 @@
 void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
 {
 	unsigned i;
+
+/*
 	for(i=0; i<num_pixels; i++)
 		((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ];
-}
+*/
 
-#if 0
-void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
-{
-	unsigned i;
 	for(i=0; i<num_pixels; i++)
 	{
 		//FIXME slow?
-		dst[0]= palette[ src[i]*4+3 ];
-		dst[1]= palette[ src[i]*4+2 ];
-		dst[2]= palette[ src[i]*4+1 ];
-		dst[3]= palette[ src[i]*4+0 ];
+		dst[0]= palette[ src[i]*4+2 ];
+		dst[1]= palette[ src[i]*4+1 ];
+		dst[2]= palette[ src[i]*4+0 ];
+//		dst[3]= 0; /* do we need this cleansing? */
 		dst+= 4;
 	}
 }
-#else
+
 void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
 {
 	unsigned i;
 	for(i=0; i<num_pixels; i++)
-		((unsigned *)dst)[i] = bswap_32(((unsigned *)palette)[ src[i] ]);
+	{
+		//FIXME slow?
+		dst[0]= palette[ src[i]*4+0 ];
+		dst[1]= palette[ src[i]*4+1 ];
+		dst[2]= palette[ src[i]*4+2 ];
+//		dst[3]= 0; /* do we need this cleansing? */
+		dst+= 4;
+	}
 }
-#endif
 
 /**
  * Pallete is assumed to contain bgr32
@@ -306,9 +310,9 @@
 	for(i=0; i<num_pixels; i++)
 	{
 		//FIXME slow?
-		dst[0]= palette[ src[i]*4+0 ];
+		dst[0]= palette[ src[i]*4+2 ];
 		dst[1]= palette[ src[i]*4+1 ];
-		dst[2]= palette[ src[i]*4+2 ];
+		dst[2]= palette[ src[i]*4+0 ];
 		dst+= 3;
 	}
 }
@@ -324,9 +328,9 @@
 	for(i=0; i<num_pixels; i++)
 	{
 		//FIXME slow?
-		dst[0]= palette[ src[i]*4+3 ];
-		dst[1]= palette[ src[i]*4+2 ];
-		dst[2]= palette[ src[i]*4+1 ];
+		dst[0]= palette[ src[i]*4+0 ];
+		dst[1]= palette[ src[i]*4+1 ];
+		dst[2]= palette[ src[i]*4+2 ];
 		dst+= 3;
 	}
 }




More information about the MPlayer-cvslog mailing list