comparison libswscale/yuv2rgb_altivec.c @ 27771:15df1f217e6d

Convert typeof keyword into __typeof__ typeof is a gcc extension and the former is not accepted in C99 without GNU extensions enabled (e.g. via -fasm). This fixes compilation on PPC.
author conrad
date Sun, 19 Oct 2008 18:56:35 +0000
parents 5707f04b8e69
children e9e41961f16e
comparison
equal deleted inserted replaced
27770:c8d4cace053d 27771:15df1f217e6d
152 perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a, 152 perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a,
153 0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f}; 153 0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f};
154 154
155 #define vec_merge3(x2,x1,x0,y0,y1,y2) \ 155 #define vec_merge3(x2,x1,x0,y0,y1,y2) \
156 do { \ 156 do { \
157 typeof(x0) o0,o2,o3; \ 157 __typeof__(x0) o0,o2,o3; \
158 o0 = vec_mergeh (x0,x1); \ 158 o0 = vec_mergeh (x0,x1); \
159 y0 = vec_perm (o0, x2, perm_rgb_0); \ 159 y0 = vec_perm (o0, x2, perm_rgb_0); \
160 o2 = vec_perm (o0, x2, perm_rgb_1); \ 160 o2 = vec_perm (o0, x2, perm_rgb_1); \
161 o3 = vec_mergel (x0,x1); \ 161 o3 = vec_mergel (x0,x1); \
162 y1 = vec_perm (o3,o2,perm_rgb_2); \ 162 y1 = vec_perm (o3,o2,perm_rgb_2); \
163 y2 = vec_perm (o3,o2,perm_rgb_3); \ 163 y2 = vec_perm (o3,o2,perm_rgb_3); \
164 } while(0) 164 } while(0)
165 165
166 #define vec_mstbgr24(x0,x1,x2,ptr) \ 166 #define vec_mstbgr24(x0,x1,x2,ptr) \
167 do { \ 167 do { \
168 typeof(x0) _0,_1,_2; \ 168 __typeof__(x0) _0,_1,_2; \
169 vec_merge3 (x0,x1,x2,_0,_1,_2); \ 169 vec_merge3 (x0,x1,x2,_0,_1,_2); \
170 vec_st (_0, 0, ptr++); \ 170 vec_st (_0, 0, ptr++); \
171 vec_st (_1, 0, ptr++); \ 171 vec_st (_1, 0, ptr++); \
172 vec_st (_2, 0, ptr++); \ 172 vec_st (_2, 0, ptr++); \
173 } while (0); 173 } while (0);
174 174
175 #define vec_mstrgb24(x0,x1,x2,ptr) \ 175 #define vec_mstrgb24(x0,x1,x2,ptr) \
176 do { \ 176 do { \
177 typeof(x0) _0,_1,_2; \ 177 __typeof__(x0) _0,_1,_2; \
178 vec_merge3 (x2,x1,x0,_0,_1,_2); \ 178 vec_merge3 (x2,x1,x0,_0,_1,_2); \
179 vec_st (_0, 0, ptr++); \ 179 vec_st (_0, 0, ptr++); \
180 vec_st (_1, 0, ptr++); \ 180 vec_st (_1, 0, ptr++); \
181 vec_st (_2, 0, ptr++); \ 181 vec_st (_2, 0, ptr++); \
182 } while (0); 182 } while (0);
220 220
221 221
222 222
223 #define vec_unh(x) \ 223 #define vec_unh(x) \
224 (vector signed short) \ 224 (vector signed short) \
225 vec_perm(x,(typeof(x)){0}, \ 225 vec_perm(x,(__typeof__(x)){0}, \
226 ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\ 226 ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\
227 0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07})) 227 0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07}))
228 #define vec_unl(x) \ 228 #define vec_unl(x) \
229 (vector signed short) \ 229 (vector signed short) \
230 vec_perm(x,(typeof(x)){0}, \ 230 vec_perm(x,(__typeof__(x)){0}, \
231 ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\ 231 ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\
232 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F})) 232 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F}))
233 233
234 #define vec_clip_s16(x) \ 234 #define vec_clip_s16(x) \
235 vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \ 235 vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \
238 #define vec_packclp(x,y) \ 238 #define vec_packclp(x,y) \
239 (vector unsigned char)vec_packs \ 239 (vector unsigned char)vec_packs \
240 ((vector unsigned short)vec_max (x,((vector signed short) {0})), \ 240 ((vector unsigned short)vec_max (x,((vector signed short) {0})), \
241 (vector unsigned short)vec_max (y,((vector signed short) {0}))) 241 (vector unsigned short)vec_max (y,((vector signed short) {0})))
242 242
243 //#define out_pixels(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),a,a,a,ptr) 243 //#define out_pixels(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){0}),a,a,a,ptr)
244 244
245 245
246 static inline void cvtyuvtoRGB (SwsContext *c, 246 static inline void cvtyuvtoRGB (SwsContext *c,
247 vector signed short Y, vector signed short U, vector signed short V, 247 vector signed short Y, vector signed short U, vector signed short V,
248 vector signed short *R, vector signed short *G, vector signed short *B) 248 vector signed short *R, vector signed short *G, vector signed short *B)
439 } \ 439 } \
440 return srcSliceH; \ 440 return srcSliceH; \
441 } 441 }
442 442
443 443
444 #define out_abgr(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),c,b,a,ptr) 444 #define out_abgr(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){0}),c,b,a,ptr)
445 #define out_bgra(a,b,c,ptr) vec_mstrgb32(typeof(a),c,b,a,((typeof (a)){0}),ptr) 445 #define out_bgra(a,b,c,ptr) vec_mstrgb32(__typeof__(a),c,b,a,((__typeof__ (a)){0}),ptr)
446 #define out_rgba(a,b,c,ptr) vec_mstrgb32(typeof(a),a,b,c,((typeof (a)){0}),ptr) 446 #define out_rgba(a,b,c,ptr) vec_mstrgb32(__typeof__(a),a,b,c,((__typeof__ (a)){0}),ptr)
447 #define out_argb(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),a,b,c,ptr) 447 #define out_argb(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){0}),a,b,c,ptr)
448 #define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr) 448 #define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr)
449 #define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr) 449 #define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr)
450 450
451 DEFCSP420_CVT (yuv2_abgr, out_abgr) 451 DEFCSP420_CVT (yuv2_abgr, out_abgr)
452 #if 1 452 #if 1