[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.23,1.24

Nick Kurshev nick at mplayer.dev.hu
Mon Nov 5 18:46:27 CET 2001


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

Modified Files:
	rgb2rgb.c 
Log Message:
Fixed rgb32(24)to16 stuff, rgb32(24)to15 is still broken

Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- rgb2rgb.c	5 Nov 2001 17:35:14 -0000	1.23
+++ rgb2rgb.c	5 Nov 2001 17:46:20 -0000	1.24
@@ -216,53 +216,57 @@
 
 void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
 {
-	unsigned i,num_pixels=src_size/4;
-	for(i=0; i<num_pixels; i+=4)
+	unsigned j,i,num_pixels=src_size/4;
+	uint16_t *d = (uint16_t *)dst;
+	for(i=0,j=0; j<num_pixels; i+=4,j++)
 	{
 		const int b= src[i+0];
 		const int g= src[i+1];
 		const int r= src[i+2];
 
-		((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+		d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
 	}
 }
 
 void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
 {
-	unsigned i,num_pixels=src_size/4;
-	for(i=0; i<num_pixels; i+=4)
+	unsigned j,i,num_pixels=src_size/4;
+	uint16_t *d = (uint16_t *)dst;
+	for(i=0,j=0; j<num_pixels; i+=4,j++)
 	{
 		const int b= src[i+0];
 		const int g= src[i+1];
 		const int r= src[i+2];
 
-		((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
+		d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
 	}
 }
 
 void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
 {
-	unsigned i,num_pixels=src_size/3;
-	for(i=0; i<num_pixels; i+=3)
+	unsigned j,i,num_pixels=src_size/3;
+	uint16_t *d = (uint16_t *)dst;
+	for(i=0,j=0; j<num_pixels; i+=3,j++)
 	{
 		const int b= src[i+0];
 		const int g= src[i+1];
 		const int r= src[i+2];
 
-		((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+		d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
 	}
 }
 
 void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
 {
-	unsigned i,num_pixels=src_size/3;
-	for(i=0; i<num_pixels; i+=3)
+	unsigned j,i,num_pixels=src_size/3;
+	uint16_t *d = (uint16_t *)dst;
+	for(i=0,j=0; j<num_pixels; i+=3,j++)
 	{
 		const int b= src[i+0];
 		const int g= src[i+1];
 		const int r= src[i+2];
 
-		((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
+		d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
 	}
 }
 




More information about the MPlayer-cvslog mailing list