[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.16,1.17 rgb2rgb.h,1.5,1.6

Michael Niedermayer michael at mplayer.dev.hu
Sun Nov 4 20:50:32 CET 2001


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

Modified Files:
	rgb2rgb.c rgb2rgb.h 
Log Message:
palette to bgr24


Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- rgb2rgb.c	4 Nov 2001 19:36:24 -0000	1.16
+++ rgb2rgb.c	4 Nov 2001 19:50:29 -0000	1.17
@@ -181,6 +181,27 @@
 		((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
 }
 
+/**
+ * Pallete is assumed to contain bgr32
+ */
+void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
+{
+	int i;
+/*
+	writes 1 byte o much and might cause alignment issues on some architectures?
+	for(i=0; i<src_size; i++)
+		((uint32_t *)(&dst[i*3])) = ((uint32_t *)palette)[ src[i] ];
+*/
+	for(i=0; i<src_size; 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;
+	}
+}
+
 void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
 {
 	int i;
@@ -226,4 +247,4 @@
 	int i;
 	for(i=0; i<src_size; i++)
 		((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
-}
\ No newline at end of file
+}

Index: rgb2rgb.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- rgb2rgb.h	4 Nov 2001 19:36:24 -0000	1.5
+++ rgb2rgb.h	4 Nov 2001 19:50:29 -0000	1.6
@@ -16,6 +16,6 @@
 void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
 void palette8torgb16(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
 void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
-
+void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
 
 #endif




More information about the MPlayer-cvslog mailing list