[MPlayer-dev-eng] [PATCH] use int_fast32_t in postproc/*

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Sep 29 19:18:32 CEST 2005


Hi,
the attached patch replaces the current int/unsigned/long mess in the
postproc files by int_fast32_t.
This may be overkill, but to me it makes much more sense like this,
removes quite a few typecasts and it also allows to easily replace 
the types use for the variables used in the assembler.
The main reason for this patch, though, is that rgb2rgb uses unsigned in
quite a few places - and then uses e.g. "g" ((long)-width). This is
incorrect, as e.g. when width is 1, the result of that cast on 64 bit
systems will be 0xffffffff instead of -1, thus causing a crash.
Do you think this is acceptable?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: postproc/rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.63
diff -u -r1.63 rgb2rgb.c
--- postproc/rgb2rgb.c	27 Apr 2005 18:17:53 -0000	1.63
+++ postproc/rgb2rgb.c	27 Sep 2005 15:50:08 -0000
@@ -18,56 +18,57 @@
 
 #define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit
 
-void (*rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb24to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb24to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb32to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb32to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb15to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb15to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb15to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb16to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb16to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-void (*rgb16to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-//void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-//void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
+void (*rgb24to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb24to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb24to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb32to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb32to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb32to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb15to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb15to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb15to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb16to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb16to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+void (*rgb16to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+//void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+//void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
 
 void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride);
 void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride);
-void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride);
+void (*planar2x)(const uint8_t *src, uint8_t *dst, int_fast32_t width, int_fast32_t height,
+	int_fast32_t srcStride, int_fast32_t dstStride);
 void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
-			    unsigned width, unsigned height, int src1Stride,
-			    int src2Stride, int dstStride);
+			    int_fast32_t width, int_fast32_t height, int_fast32_t src1Stride,
+			    int_fast32_t src2Stride, int_fast32_t dstStride);
 void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
 			uint8_t *dst1, uint8_t *dst2,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int dstStride1, int dstStride2);
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t dstStride1, int_fast32_t dstStride2);
 void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
 			uint8_t *dst,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int srcStride3, int dstStride);
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t srcStride3, int_fast32_t dstStride);
 
 #if defined(ARCH_X86) || defined(ARCH_X86_64)
 static const uint64_t mmx_null  __attribute__((aligned(8))) = 0x0000000000000000ULL;
@@ -321,9 +322,9 @@
 /**
  * Pallete is assumed to contain bgr32
  */
-void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8torgb32(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 
 /*
 	for(i=0; i<num_pixels; i++)
@@ -347,9 +348,9 @@
 	}
 }
 
-void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; i<num_pixels; i++)
 	{
 		#ifdef WORDS_BIGENDIAN
@@ -371,9 +372,9 @@
 /**
  * Pallete is assumed to contain bgr32
  */
-void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8torgb24(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 /*
 	writes 1 byte o much and might cause alignment issues on some architectures?
 	for(i=0; i<num_pixels; i++)
@@ -389,9 +390,9 @@
 	}
 }
 
-void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 /*
 	writes 1 byte o much and might cause alignment issues on some architectures?
 	for(i=0; i<num_pixels; i++)
@@ -410,15 +411,15 @@
 /**
  * Palette is assumed to contain bgr16, see rgb32to16 to convert the palette
  */
-void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8torgb16(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; i<num_pixels; i++)
 		((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
 }
-void palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; i<num_pixels; i++)
 		((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[ src[i] ]);
 }
@@ -426,23 +427,23 @@
 /**
  * Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette
  */
-void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8torgb15(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; i<num_pixels; i++)
 		((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
 }
-void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+void palette8tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; i<num_pixels; i++)
 		((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[ src[i] ]);
 }
 
-void rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb32tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size >> 2;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size >> 2;
 	for(i=0; i<num_pixels; i++)
 	{
 		dst[3*i + 0] = src[4*i + 2];
@@ -451,9 +452,9 @@
 	}
 }
 
-void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb24tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
+	int_fast32_t i;
 	for(i=0; 3*i<src_size; i++)
 	{
 		dst[4*i + 0] = src[3*i + 2];
@@ -463,7 +464,7 @@
 	}
 }
 
-void rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 	uint8_t *d = (uint8_t *)dst;
@@ -480,7 +481,7 @@
 	}
 }
 
-void rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb16tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 	uint8_t *d = (uint8_t *)dst;
@@ -496,10 +497,10 @@
 	}
 }
 
-void rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size >> 1;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size >> 1;
 	
 	for(i=0; i<num_pixels; i++)
 	{
@@ -513,10 +514,10 @@
 	}
 }
 
-void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size >> 1;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size >> 1;
 	
 	for(i=0; i<num_pixels; i++)
 	{
@@ -530,7 +531,7 @@
 	}
 }
 
-void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 	uint8_t *d = (uint8_t *)dst;
@@ -547,7 +548,7 @@
 	}
 }
 
-void rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb15tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 	uint8_t *d = (uint8_t *)dst;
@@ -563,10 +564,10 @@
 	}
 }
 
-void rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size >> 1;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size >> 1;
 	
 	for(i=0; i<num_pixels; i++)
 	{
@@ -580,10 +581,10 @@
 	}
 }
 
-void rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size >> 1;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size >> 1;
 	
 	for(i=0; i<num_pixels; i++)
 	{
@@ -597,10 +598,10 @@
 	}
 }
 
-void rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+void rgb8tobgr8(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
-	unsigned i;
-	unsigned num_pixels = src_size;
+	int_fast32_t i;
+	int_fast32_t num_pixels = src_size;
 	for(i=0; i<num_pixels; i++)
 	{
 	    unsigned b,g,r;
Index: postproc/rgb2rgb.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.h,v
retrieving revision 1.31
diff -u -r1.31 rgb2rgb.h
--- postproc/rgb2rgb.h	9 Oct 2003 23:45:04 -0000	1.31
+++ postproc/rgb2rgb.h	27 Sep 2005 15:50:09 -0000
@@ -12,46 +12,46 @@
 // Note: do not fix the dependence on stdio.h
 
 /* A full collection of rgb to rgb(bgr) convertors */
-extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
-extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
-
-extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size);
-extern void rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned src_size);
-
-
-extern void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
-extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
+extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size);
+extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+
+extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+extern void rgb8tobgr8(const uint8_t *src, uint8_t *dst, int_fast32_t src_size);
+
+
+extern void palette8torgb32(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8torgb24(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8torgb16(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8torgb15(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
+extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, int_fast32_t num_pixels, const uint8_t *palette);
 
 /**
  *
@@ -67,16 +67,16 @@
  * problem for anyone then tell me, and ill fix it)
  */
 extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 
 /**
  *
  * width should be a multiple of 16
  */
 extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 
 /**
  *
@@ -84,8 +84,8 @@
  * problem for anyone then tell me, and ill fix it)
  */
 extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride);
 
 /**
  *
@@ -93,8 +93,8 @@
  * problem for anyone then tell me, and ill fix it)
  */
 extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride);
 
 /**
  *
@@ -103,25 +103,26 @@
  * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
  */
 extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride);
-extern void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride);
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride);
+extern void (*planar2x)(const uint8_t *src, uint8_t *dst, int_fast32_t width, int_fast32_t height,
+	int_fast32_t srcStride, int_fast32_t dstStride);
 
 extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
-			    unsigned width, unsigned height, int src1Stride,
-			    int src2Stride, int dstStride);
+			    int_fast32_t width, int_fast32_t height, int_fast32_t src1Stride,
+			    int_fast32_t src2Stride, int_fast32_t dstStride);
 
 extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
 			uint8_t *dst1, uint8_t *dst2,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int dstStride1, int dstStride2);
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t dstStride1, int_fast32_t dstStride2);
 
 extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
 			uint8_t *dst,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int srcStride3, int dstStride);
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t srcStride3, int_fast32_t dstStride);
 	
 
 #define MODE_RGB  0x1
Index: postproc/rgb2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb_template.c,v
retrieving revision 1.73
diff -u -r1.73 rgb2rgb_template.c
--- postproc/rgb2rgb_template.c	22 Mar 2005 10:11:42 -0000	1.73
+++ postproc/rgb2rgb_template.c	27 Sep 2005 15:50:13 -0000
@@ -59,7 +59,7 @@
 #define SFENCE "/nop"
 #endif
 
-static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size)
+static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size)
 {
   uint8_t *dest = dst;
   const uint8_t *s = src;
@@ -117,7 +117,7 @@
   }
 }
 
-static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size)
+static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size)
 {
   uint8_t *dest = dst;
   const uint8_t *s = src;
@@ -207,7 +207,7 @@
  MMX2, 3DNOW optimization by Nick Kurshev
  32bit c version, and and&add trick by Michael Niedermayer
 */
-static inline void RENAME(rgb15to16)(const uint8_t *src,uint8_t *dst,unsigned src_size)
+static inline void RENAME(rgb15to16)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size)
 {
   register const uint8_t* s=src;
   register uint8_t* d=dst;
@@ -256,7 +256,7 @@
     }
 }
 
-static inline void RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,unsigned src_size)
+static inline void RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,int_fast32_t src_size)
 {
   register const uint8_t* s=src;
   register uint8_t* d=dst;
@@ -312,7 +312,7 @@
     }
 }
 
-static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -408,7 +408,7 @@
 	}
 }
 
-static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -470,7 +470,7 @@
 	}
 }
 
-static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -567,7 +567,7 @@
 	}
 }
 
-static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -629,7 +629,7 @@
 	}
 }
 
-static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -692,7 +692,7 @@
 	}
 }
 
-static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -755,7 +755,7 @@
 	}
 }
 
-static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -818,7 +818,7 @@
 	}
 }
 
-static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint8_t *s = src;
 	const uint8_t *end;
@@ -904,7 +904,7 @@
        |
    Original Bits
 */
-static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 #ifdef HAVE_MMX
@@ -1046,7 +1046,7 @@
 	}
 }
 
-static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 #ifdef HAVE_MMX
@@ -1187,7 +1187,7 @@
 	}
 }
 
-static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 #ifdef HAVE_MMX
@@ -1266,7 +1266,7 @@
 	}
 }
 
-static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, unsigned src_size)
+static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	const uint16_t *end;
 #ifdef HAVE_MMX
@@ -1338,7 +1338,7 @@
 	}
 }
 
-static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 #ifdef HAVE_MMX
 /* TODO: unroll this loop */
@@ -1361,7 +1361,7 @@
 		"add $8, %%"REG_a"		\n\t"
 		"cmp %2, %%"REG_a"		\n\t"
 		" jb 1b				\n\t"
-		:: "r" (src), "r"(dst), "r" ((long)src_size-7)
+		:: "r" (src), "r"(dst), "r" (src_size-7)
 		: "%"REG_a
 	);
 
@@ -1385,11 +1385,11 @@
 #endif
 }
 
-static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, unsigned int src_size)
+static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int_fast32_t src_size)
 {
 	unsigned i;
 #ifdef HAVE_MMX
-	long mmx_size= 23 - src_size;
+	int_fast32_t mmx_size= 23 - src_size;
 	asm volatile (
 		"movq "MANGLE(mask24r)", %%mm5	\n\t"
 		"movq "MANGLE(mask24g)", %%mm6	\n\t"
@@ -1453,11 +1453,11 @@
 }
 
 static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride, int_fast32_t vertLumPerChroma)
 {
-	unsigned y;
-	const unsigned chromWidth= width>>1;
+	int_fast32_t y;
+	const int_fast32_t chromWidth= width>>1;
 	for(y=0; y<height; y++)
 	{
 #ifdef HAVE_MMX
@@ -1492,7 +1492,7 @@
 			"add $8, %%"REG_a"		\n\t"
 			"cmp %4, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
-			::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" ((long)chromWidth)
+			::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
 			: "%"REG_a
 		);
 #else
@@ -1598,19 +1598,19 @@
  * problem for anyone then tell me, and ill fix it)
  */
 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride)
 {
 	//FIXME interpolate chroma
 	RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
 }
 
 static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride, int_fast32_t vertLumPerChroma)
 {
-	unsigned y;
-	const unsigned chromWidth= width>>1;
+	int_fast32_t y;
+	const int_fast32_t chromWidth= width>>1;
 	for(y=0; y<height; y++)
 	{
 #ifdef HAVE_MMX
@@ -1645,7 +1645,7 @@
 			"add $8, %%"REG_a"		\n\t"
 			"cmp %4, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
-			::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" ((long)chromWidth)
+			::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
 			: "%"REG_a
 		);
 #else
@@ -1705,8 +1705,8 @@
  * problem for anyone then tell me, and ill fix it)
  */
 static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride)
 {
 	//FIXME interpolate chroma
 	RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
@@ -1717,8 +1717,8 @@
  * width should be a multiple of 16
  */
 static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int dstStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t dstStride)
 {
 	RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
 }
@@ -1729,11 +1729,11 @@
  * problem for anyone then tell me, and ill fix it)
  */
 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride)
 {
-	unsigned y;
-	const unsigned chromWidth= width>>1;
+	int_fast32_t y;
+	const int_fast32_t chromWidth= width>>1;
 	for(y=0; y<height; y+=2)
 	{
 #ifdef HAVE_MMX
@@ -1785,7 +1785,7 @@
 			"add $8, %%"REG_a"		\n\t"
 			"cmp %4, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
-			::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" ((long)chromWidth)
+			::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
 			: "memory", "%"REG_a
 		);
 
@@ -1815,11 +1815,11 @@
 			"cmp %4, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
 
-			::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" ((long)chromWidth)
+			::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
 			: "memory", "%"REG_a
 		);
 #else
-		unsigned i;
+		int_fast32_t i;
 		for(i=0; i<chromWidth; i++)
 		{
 			ydst[2*i+0] 	= src[4*i+0];
@@ -1850,7 +1850,7 @@
 
 static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
 	uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height, int lumStride, int chromStride)
+	int_fast32_t width, int_fast32_t height, int_fast32_t lumStride, int_fast32_t chromStride)
 {
 	/* Y Plane */
 	memcpy(ydst, ysrc, width*height);
@@ -1858,9 +1858,9 @@
 	/* XXX: implement upscaling for U,V */
 }
 
-static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)
+static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int_fast32_t srcWidth, int_fast32_t srcHeight, int_fast32_t srcStride, int_fast32_t dstStride)
 {
-	int x,y;
+	int_fast32_t x,y;
 	
 	dst[0]= src[0];
         
@@ -1875,7 +1875,7 @@
 
 	for(y=1; y<srcHeight; y++){
 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
-		const long mmxSize= srcWidth&~15;
+		const int_fast32_t mmxSize= srcWidth&~15;
 		asm volatile(
 			"mov %4, %%"REG_a"		\n\t"
 			"1:				\n\t"
@@ -1919,7 +1919,7 @@
 
 		);
 #else
-		const int mmxSize=1;
+		const int_fast32_t mmxSize=1;
 #endif
 		dst[0        ]= (3*src[0] +   src[srcStride])>>2;
 		dst[dstStride]= (  src[0] + 3*src[srcStride])>>2;
@@ -1967,11 +1967,11 @@
  * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
  */
 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride)
 {
-	unsigned y;
-	const unsigned chromWidth= width>>1;
+	int_fast32_t y;
+	const int_fast32_t chromWidth= width>>1;
 	for(y=0; y<height; y+=2)
 	{
 #ifdef HAVE_MMX
@@ -2057,7 +2057,7 @@
 			: "memory", "%eax"
 		);
 #else
-		unsigned i;
+		int_fast32_t i;
 		for(i=0; i<chromWidth; i++)
 		{
 			udst[i] 	= src[4*i+0];
@@ -2093,15 +2093,15 @@
  * chrominance data is only taken from every secound line others are ignored in the C version FIXME write HQ version
  */
 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-	unsigned int width, unsigned int height,
-	int lumStride, int chromStride, int srcStride)
+	int_fast32_t width, int_fast32_t height,
+	int_fast32_t lumStride, int_fast32_t chromStride, int_fast32_t srcStride)
 {
-	unsigned y;
-	const unsigned chromWidth= width>>1;
+	int_fast32_t y;
+	const int_fast32_t chromWidth= width>>1;
 #ifdef HAVE_MMX
 	for(y=0; y<height-2; y+=2)
 	{
-		unsigned i;
+		int_fast32_t i;
 		for(i=0; i<2; i++)
 		{
 			asm volatile(
@@ -2170,7 +2170,7 @@
 				MOVNTQ" %%mm0, (%1, %%"REG_a")	\n\t"
 				"add $8, %%"REG_a"		\n\t"
 				" js 1b				\n\t"
-				: : "r" (src+width*3), "r" (ydst+width), "g" ((long)-width)
+				: : "r" (src+width*3), "r" (ydst+width), "g" (-width)
 				: "%"REG_a, "%"REG_b
 			);
 			ydst += lumStride;
@@ -2322,7 +2322,7 @@
 			"movd %%mm0, (%3, %%"REG_a")	\n\t"
 			"add $4, %%"REG_a"		\n\t"
 			" js 1b				\n\t"
-			: : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" ((long)-chromWidth)
+			: : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
 			: "%"REG_a, "%"REG_b
 		);
 
@@ -2339,7 +2339,7 @@
 #endif
 	for(; y<height; y+=2)
 	{
-		unsigned i;
+		int_fast32_t i;
 		for(i=0; i<chromWidth; i++)
 		{
 			unsigned int b= src[6*i+0];
@@ -2389,13 +2389,13 @@
 }
 
 void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
-			    unsigned width, unsigned height, int src1Stride,
-			    int src2Stride, int dstStride){
-	unsigned h;
+			    int_fast32_t width, int_fast32_t height, int_fast32_t src1Stride,
+			    int_fast32_t src2Stride, int_fast32_t dstStride){
+	int_fast32_t h;
 
 	for(h=0; h < height; h++)
 	{
-		unsigned w;
+		int_fast32_t w;
 
 #ifdef HAVE_MMX
 #ifdef HAVE_SSE2
@@ -2414,7 +2414,7 @@
 			"add $16, %%"REG_a"		\n\t"
 			"cmp %3, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
-			::"r"(dest), "r"(src1), "r"(src2), "r" ((long)width-15)
+			::"r"(dest), "r"(src1), "r"(src2), "r" (width-15)
 			: "memory", "%"REG_a""
 		);
 #else
@@ -2440,7 +2440,7 @@
 			"add $16, %%"REG_a"		\n\t"
 			"cmp %3, %%"REG_a"		\n\t"
 			" jb 1b				\n\t"
-			::"r"(dest), "r"(src1), "r"(src2), "r" ((long)width-15)
+			::"r"(dest), "r"(src1), "r"(src2), "r" (width-15)
 			: "memory", "%"REG_a
 		);
 #endif
@@ -2471,12 +2471,11 @@
 
 static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
 			uint8_t *dst1, uint8_t *dst2,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int dstStride1, int dstStride2)
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t dstStride1, int_fast32_t dstStride2)
 {
-    unsigned int y,x,h;
-    int w;
+    int_fast32_t y,x,w,h;
     w=width/2; h=height/2;
 #ifdef HAVE_MMX
     asm volatile(
@@ -2575,11 +2574,11 @@
 
 static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
 			uint8_t *dst,
-			unsigned width, unsigned height,
-			int srcStride1, int srcStride2,
-			int srcStride3, int dstStride)
+			int_fast32_t width, int_fast32_t height,
+			int_fast32_t srcStride1, int_fast32_t srcStride2,
+			int_fast32_t srcStride3, int_fast32_t dstStride)
 {
-    unsigned long y,x,w,h;
+    int_fast32_t y,x,w,h;
     w=width/2; h=height;
     for(y=0;y<h;y++){
 	const uint8_t* yp=src1+srcStride1*y;
@@ -2644,7 +2643,7 @@
 #endif
 	for(; x<w; x++)
 	{
-	    const int x2= x<<2;
+	    const int_fast32_t x2= x<<2;
 	    d[8*x+0]=yp[x2];
 	    d[8*x+1]=up[x];
 	    d[8*x+2]=yp[x2+1];
Index: postproc/swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.120
diff -u -r1.120 swscale_template.c
--- postproc/swscale_template.c	12 Jul 2005 19:16:04 -0000	1.120
+++ postproc/swscale_template.c	27 Sep 2005 15:50:28 -0000
@@ -757,7 +757,7 @@
 
 static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
 				    int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
-				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
+				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int_fast32_t dstW, int_fast32_t chrDstW)
 {
 #ifdef HAVE_MMX
 	if(uDest != NULL)
@@ -765,14 +765,14 @@
 		asm volatile(
 				YSCALEYUV2YV12X(0, CHR_MMX_FILTER_OFFSET)
 				:: "r" (&c->redDither),
-				"r" (uDest), "p" ((long)chrDstW)
+				"r" (uDest), "p" (chrDstW)
 				: "%"REG_a, "%"REG_d, "%"REG_S
 			);
 
 		asm volatile(
 				YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET)
 				:: "r" (&c->redDither),
-				"r" (vDest), "p" ((long)chrDstW)
+				"r" (vDest), "p" (chrDstW)
 				: "%"REG_a, "%"REG_d, "%"REG_S
 			);
 	}
@@ -780,7 +780,7 @@
 	asm volatile(
 			YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET)
 			:: "r" (&c->redDither),
-			   "r" (dest), "p" ((long)dstW)
+			   "r" (dest), "p" (dstW)
 			: "%"REG_a, "%"REG_d, "%"REG_S
 		);
 #else
@@ -806,7 +806,7 @@
 }
 
 static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
-				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
+				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int_fast32_t dstW, int_fast32_t chrDstW)
 {
 #ifdef HAVE_MMX
 	if(uDest != NULL)
@@ -814,14 +814,14 @@
 		asm volatile(
 				YSCALEYUV2YV121
 				:: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW),
-				"g" ((long)-chrDstW)
+				"g" (-chrDstW)
 				: "%"REG_a
 			);
 
 		asm volatile(
 				YSCALEYUV2YV121
 				:: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW),
-				"g" ((long)-chrDstW)
+				"g" (-chrDstW)
 				: "%"REG_a
 			);
 	}
@@ -829,7 +829,7 @@
 	asm volatile(
 		YSCALEYUV2YV121
 		:: "r" (lumSrc + dstW), "r" (dest + dstW),
-		"g" ((long)-dstW)
+		"g" (-dstW)
 		: "%"REG_a
 	);
 #else
@@ -1489,7 +1489,7 @@
 
 //FIXME yuy2* can read upto 7 samples to much
 
-static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, int width)
+static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, int_fast32_t width)
 {
 #ifdef HAVE_MMX
 	asm volatile(
@@ -1504,7 +1504,7 @@
 		"movq %%mm0, (%2, %%"REG_a")	\n\t"
 		"add $8, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "g" ((long)-width), "r" (src+width*2), "r" (dst+width)
+		: : "g" (-width), "r" (src+width*2), "r" (dst+width)
 		: "%"REG_a
 	);
 #else
@@ -1514,7 +1514,7 @@
 #endif
 }
 
-static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
+static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int_fast32_t width)
 {
 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
 	asm volatile(
@@ -1539,7 +1539,7 @@
 		"movd %%mm1, (%3, %%"REG_a")	\n\t"
 		"add $4, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "g" ((long)-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
+		: : "g" (-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
 		: "%"REG_a
 	);
 #else
@@ -1553,7 +1553,7 @@
 }
 
 //this is allmost identical to the previous, end exists only cuz yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses
-static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int width)
+static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int_fast32_t width)
 {
 #ifdef HAVE_MMX
 	asm volatile(
@@ -1567,7 +1567,7 @@
 		"movq %%mm0, (%2, %%"REG_a")	\n\t"
 		"add $8, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "g" ((long)-width), "r" (src+width*2), "r" (dst+width)
+		: : "g" (-width), "r" (src+width*2), "r" (dst+width)
 		: "%"REG_a
 	);
 #else
@@ -1577,7 +1577,7 @@
 #endif
 }
 
-static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
+static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int_fast32_t width)
 {
 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
 	asm volatile(
@@ -1602,7 +1602,7 @@
 		"movd %%mm1, (%3, %%"REG_a")	\n\t"
 		"add $4, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "g" ((long)-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
+		: : "g" (-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
 		: "%"REG_a
 	);
 #else
@@ -1648,7 +1648,7 @@
 	}
 }
 
-static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)
+static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int_fast32_t width)
 {
 #ifdef HAVE_MMX
 	asm volatile(
@@ -1717,7 +1717,7 @@
 		"movq %%mm0, (%1, %%"REG_a")	\n\t"
 		"add $8, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "r" (src+width*3), "r" (dst+width), "g" ((long)-width)
+		: : "r" (src+width*3), "r" (dst+width), "g" (-width)
 		: "%"REG_a, "%"REG_b
 	);
 #else
@@ -1733,7 +1733,7 @@
 #endif
 }
 
-static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
+static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int_fast32_t width)
 {
 #ifdef HAVE_MMX
 	asm volatile(
@@ -1882,7 +1882,7 @@
 		"movd %%mm0, (%3, %%"REG_a")	\n\t"
 		"add $4, %%"REG_a"		\n\t"
 		" js 1b				\n\t"
-		: : "r" (src1+width*6), "r" (src2+width*6), "r" (dstU+width), "r" (dstV+width), "g" ((long)-width)
+		: : "r" (src1+width*6), "r" (src2+width*6), "r" (dstU+width), "r" (dstV+width), "g" (-width)
 		: "%"REG_a, "%"REG_b
 	);
 #else
@@ -2035,7 +2035,7 @@
 
 // Bilinear / Bicubic scaling
 static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc,
-				  int16_t *filter, int16_t *filterPos, int filterSize)
+				  int16_t *filter, int16_t *filterPos, int_fast32_t filterSize)
 {
 #ifdef HAVE_MMX
 	assert(filterSize % 4 == 0 && filterSize>0);
@@ -2173,7 +2173,7 @@
 
 			: "+r" (counter), "+r" (filter)
 			: "m" (filterPos), "m" (dst), "m"(offset),
-			  "m" (src), "r" ((long)filterSize*2)
+			  "m" (src), "r" (filterSize*2)
 			: "%"REG_b, "%"REG_a, "%"REG_c
 		);
 	}
@@ -2373,7 +2373,7 @@
     }
 }
 
-inline static void RENAME(hcscale)(uint16_t *dst, int dstWidth, uint8_t *src1, uint8_t *src2,
+inline static void RENAME(hcscale)(uint16_t *dst, int_fast32_t dstWidth, uint8_t *src1, uint8_t *src2,
 				   int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,
 				   int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,
 				   int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,


More information about the MPlayer-dev-eng mailing list