[x264-devel] [PATCH 07/23] aarch64: implement x264_pixel_asd8_neon

Janne Grunau janne-x264 at jannau.net
Thu Nov 27 08:56:35 CET 2014


7 times faster than C.
---
 common/aarch64/pixel-a.S | 26 ++++++++++++++++++++++++++
 common/aarch64/pixel.h   |  1 +
 common/pixel.c           |  1 +
 3 files changed, 28 insertions(+)

diff --git a/common/aarch64/pixel-a.S b/common/aarch64/pixel-a.S
index d19f595..52aaa64 100644
--- a/common/aarch64/pixel-a.S
+++ b/common/aarch64/pixel-a.S
@@ -273,6 +273,32 @@ function x264_pixel_vsad_neon, export=1
     ret
 endfunc
 
+function x264_pixel_asd8_neon, export=1
+    sub         w4,  w4,  #2
+    ld1        {v0.8b}, [x0], x1
+    ld1        {v1.8b}, [x2], x3
+    ld1        {v2.8b}, [x0], x1
+    ld1        {v3.8b}, [x2], x3
+    usubl       v16.8h, v0.8b,  v1.8b
+1:
+    subs        w4,  w4,  #2
+    ld1        {v4.8b}, [x0], x1
+    ld1        {v5.8b}, [x2], x3
+    usubl       v17.8h, v2.8b,  v3.8b
+    usubl       v18.8h, v4.8b,  v5.8b
+    add         v16.8h, v16.8h, v17.8h
+    ld1        {v2.8b}, [x0], x1
+    ld1        {v3.8b}, [x2], x3
+    add         v16.8h, v16.8h, v18.8h
+    b.gt        1b
+    usubl       v17.8h, v2.8b,  v3.8b
+    add         v16.8h, v16.8h, v17.8h
+    saddlv      s0,  v16.8h
+    abs         v0.2s,  v0.2s
+    fmov        w0,  s0
+    ret
+endfunc
+
 .macro SSD_START_4
     ld1        {v16.s}[0], [x0], x1
     ld1        {v17.s}[0], [x2], x3
diff --git a/common/aarch64/pixel.h b/common/aarch64/pixel.h
index 1eb8718..8af2098 100644
--- a/common/aarch64/pixel.h
+++ b/common/aarch64/pixel.h
@@ -73,4 +73,5 @@ void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t,
                                       int sums[2][4] );
 float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width );
 
+int x264_pixel_asd8_neon( uint8_t *, intptr_t,  uint8_t *, intptr_t, int );
 #endif
diff --git a/common/pixel.c b/common/pixel.c
index 6bdbbca..f84618d 100644
--- a/common/pixel.c
+++ b/common/pixel.c
@@ -1430,6 +1430,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
         pixf->var2[PIXEL_8x8]   = x264_pixel_var2_8x8_neon;
         pixf->var2[PIXEL_8x16]  = x264_pixel_var2_8x16_neon;
         pixf->vsad = x264_pixel_vsad_neon;
+        pixf->asd8 = x264_pixel_asd8_neon;
 
         pixf->intra_sad_x3_4x4    = x264_intra_sad_x3_4x4_neon;
         pixf->intra_satd_x3_4x4   = x264_intra_satd_x3_4x4_neon;
-- 
2.1.3



More information about the x264-devel mailing list