Index: yuv2rgb_altivec.c =================================================================== RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb_altivec.c,v retrieving revision 1.5 diff -u -r1.5 yuv2rgb_altivec.c --- yuv2rgb_altivec.c 14 Nov 2005 00:30:37 -0000 1.5 +++ yuv2rgb_altivec.c 9 Feb 2006 22:29:53 -0000 @@ -207,9 +207,38 @@ (vector unsigned char)AVV(0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\ 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F)) -#define vec_clip(x) \ - vec_max (vec_min (x, (typeof(x))AVV(235)), (typeof(x))AVV(16)) +#ifndef __un_args_eq +#define __un_args_eq(xtype, x) \ + __builtin_types_compatible_p (xtype, __typeof__ (x)) +#endif + +#ifndef __ch +#define __ch(x, y, z) __builtin_choose_expr (x, y, z) +#endif + +#define vec_clip(x) \ + __ch( __un_args_eq(vector unsigned int, x),\ + vec_max (vec_min (x, (typeof(x))AVV(235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16)),\ + __ch( __un_args_eq(vector signed int, x),\ + vec_max (vec_min (x, (typeof(x))AVV(235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16)),\ + __ch( __un_args_eq(vector unsigned short, x),\ + vec_max (vec_min (x, (typeof(x))AVV(235,235,235,235,235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16,16,16,16,16)),\ + __ch( __un_args_eq(vector signed short, x),\ + vec_max (vec_min (x, (typeof(x))AVV(235,235,235,235,235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16,16,16,16,16)),\ + __ch( __un_args_eq(vector unsigned char, x),\ + vec_max (vec_min (x,\ + (typeof(x))AVV(235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16)),\ + __ch( __un_args_eq(vector signed char, x),\ + vec_max (vec_min (x,\ + (typeof(x))AVV(235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235)),\ + (typeof(x))AVV(16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16)),\ + 0)))))) #define vec_packclp_a(x,y) \ (vector unsigned char)vec_pack (vec_clip (x), vec_clip (y))