changeset 2697:1eaf3f89e49f

palette to bgr24
author michael
date Sun, 04 Nov 2001 19:50:29 +0000
parents d0f26c572633
children 22652c028692
files postproc/rgb2rgb.c postproc/rgb2rgb.h postproc/rgb2rgb_template.c
diffstat 3 files changed, 45 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/postproc/rgb2rgb.c	Sun Nov 04 19:47:19 2001 +0000
+++ b/postproc/rgb2rgb.c	Sun Nov 04 19:50:29 2001 +0000
@@ -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
+}
--- a/postproc/rgb2rgb.h	Sun Nov 04 19:47:19 2001 +0000
+++ b/postproc/rgb2rgb.h	Sun Nov 04 19:50:29 2001 +0000
@@ -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
--- a/postproc/rgb2rgb_template.c	Sun Nov 04 19:47:19 2001 +0000
+++ b/postproc/rgb2rgb_template.c	Sun Nov 04 19:50:29 2001 +0000
@@ -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
+}