]> git.sesse.net Git - x264/blobdiff - common/quant.c
Merges Guillaume Poirier's AltiVec changes:
[x264] / common / quant.c
index 449461c61f36bdec29445b8a7b842c2f4a567c55..e7bd48ccdb24844201f4ef19bd5b8239ca00c8c6 100644 (file)
@@ -25,6 +25,9 @@
 #ifdef HAVE_MMXEXT
 #include "i386/quant.h"
 #endif
+#ifdef ARCH_PPC
+#   include "ppc/quant.h"
+#endif
 
 #define QUANT_ONE( coef, mf ) \
 { \
@@ -202,8 +205,6 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf )
     pf->dequant_4x4 = dequant_4x4;
     pf->dequant_8x8 = dequant_8x8;
 
-#ifdef HAVE_MMXEXT
-
     /* determine the biggest coefficient in all quant8_mf tables */
     for( j = 0; j < 2; j++ )
         for( i = 0; i < 6*8*8; i++ )
@@ -225,6 +226,8 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf )
                 maxQdc = q;
         }
 
+#ifdef HAVE_MMXEXT
+
     /* select quant_8x8 based on CPU and maxQ8 */
     if( maxQ8 < (1<<15) && cpu&X264_CPU_MMX )
         pf->quant_8x8_core = x264_quant_8x8_core15_mmx;
@@ -273,4 +276,21 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf )
         pf->dequant_8x8 = x264_dequant_8x8_mmx;
     }
 #endif  /* HAVE_MMXEXT */
+    
+#ifdef ARCH_PPC
+    if( cpu&X264_CPU_ALTIVEC ) {
+        if( maxQ8 < (1<<16) )
+        {
+            pf->quant_8x8_core = x264_quant_8x8_altivec;
+        }
+        if( maxQ4 < (1<<16) )
+        {
+            pf->quant_4x4_core = x264_quant_4x4_altivec;
+        }
+        if( maxQdc < (1<<16) )
+        {
+           pf->quant_4x4_dc_core = x264_quant_4x4_dc_altivec;
+        }
+    }
+#endif /* ARCH_PPC */
 }