]> git.sesse.net Git - ffmpeg/blobdiff - postproc/yuv2rgb.c
simplify the init
[ffmpeg] / postproc / yuv2rgb.c
index 24295d014d0bb9861fdb76c058a651d504a5539f..317ada954e4d7152383b04ecba4a54b77c616d6d 100644 (file)
@@ -159,20 +159,20 @@ const uint8_t  __attribute__((aligned(8))) dither_8x8_220[8][8]={
 #ifdef ARCH_X86
 
 /* hope these constant values are cache line aligned */
-uint64_t __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ff;
-uint64_t __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8;
-uint64_t __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfc;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8ULL;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfcULL;
 
-uint64_t __attribute__((aligned(8))) M24A=   0x00FF0000FF0000FFLL;
-uint64_t __attribute__((aligned(8))) M24B=   0xFF0000FF0000FF00LL;
-uint64_t __attribute__((aligned(8))) M24C=   0x0000FF0000FF0000LL;
+uint64_t attribute_used __attribute__((aligned(8))) M24A=   0x00FF0000FF0000FFULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24B=   0xFF0000FF0000FF00ULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24C=   0x0000FF0000FF0000ULL;
 
 // the volatile is required because gcc otherwise optimizes some writes away not knowing that these
 // are read in the asm block
-volatile uint64_t __attribute__((aligned(8))) b5Dither;
-volatile uint64_t __attribute__((aligned(8))) g5Dither;
-volatile uint64_t __attribute__((aligned(8))) g6Dither;
-volatile uint64_t __attribute__((aligned(8))) r5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) b5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) g5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) r5Dither;
 
 uint64_t __attribute__((aligned(8))) dither4[2]={
        0x0103010301030103LL,
@@ -607,6 +607,14 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
        if(t) return t;
     }
 #endif
+#ifdef HAVE_ALTIVEC
+    if (c->flags & SWS_CPU_CAPS_ALTIVEC)
+    {
+       SwsFunc t = yuv2rgb_init_altivec(c);
+       if(t) return t;
+    }
+#endif
+
     MSG_WARN("No accelerated colorspace conversion found\n");
 
     switch(c->dstFormat){
@@ -642,8 +650,8 @@ static int div_round (int dividend, int divisor)
 
 int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
 {  
-    const int bpp= c->dstFormat&0xFF;
-    const int isRgb= (c->dstFormat>>24) != 'R';
+    const int isRgb = IMGFMT_IS_BGR(c->dstFormat);
+    const int bpp = isRgb?IMGFMT_RGB_DEPTH(c->dstFormat):IMGFMT_BGR_DEPTH(c->dstFormat);
     int i;
     uint8_t table_Y[1024];
     uint32_t *table_32 = 0;