]> granicus.if.org Git - libx264/commitdiff
more AltiVec mc, ~4.5% overall speedup
authorEric Petit <titer@videolan.org>
Sun, 16 Apr 2006 16:38:16 +0000 (16:38 +0000)
committerEric Petit <titer@videolan.org>
Sun, 16 Apr 2006 16:38:16 +0000 (16:38 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@499 df754926-b1dd-0310-bc7b-ec298dee348c

common/ppc/mc.c

index 7e3ed46192d8b767aaa474bfb0cdc46b31aa10e8..0baf8cc750285a6197511f88460c539e083c97a9 100644 (file)
@@ -75,11 +75,22 @@ static inline void pixel_avg_w8( uint8_t *dst,  int i_dst,
                                  uint8_t *src2, int i_src2,
                                  int i_height )
 {
-    /* TODO - optimize */
-    pixel_avg_w4( &dst[0], i_dst, &src1[0], i_src1, &src2[0], i_src2,
-                  i_height );
-    pixel_avg_w4( &dst[4], i_dst, &src1[4], i_src1, &src2[4], i_src2,
-                  i_height );
+    int y;
+    vec_u8_t src1v, src2v;
+    LOAD_ZERO;
+    PREP_LOAD;
+    PREP_STORE8;
+    for( y = 0; y < i_height; y++ )
+    {
+        VEC_LOAD( src1, src1v, 8, vec_u8_t );
+        VEC_LOAD( src2, src2v, 8, vec_u8_t );
+        src1v = vec_avg( src1v, src2v );
+        VEC_STORE8( src1v, dst );
+
+        dst  += i_dst;
+        src1 += i_src1;
+        src2 += i_src2;
+    }
 }
 static inline void pixel_avg_w16( uint8_t *dst,  int i_dst,
                                   uint8_t *src1, int i_src1,