[x265] [PATCH] asm: avx2 code for ssd_s[16x16] for 8bpp

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Tue Mar 24 05:55:14 CET 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1427172906 -19800
#      Tue Mar 24 10:25:06 2015 +0530
# Node ID 3aebdde26c77bfdabf515ade4bd19e3e9f805d39
# Parent  7b66c36ed9effc864d262f2673f4ed941d550365
asm: avx2 code for ssd_s[16x16] for 8bpp

see3
ssd_s[16x16]  6.33x    345.70          2188.47

avx2
ssd_s[16x16]  9.86x    221.34          2183.05

diff -r 7b66c36ed9ef -r 3aebdde26c77 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Mar 23 19:55:02 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Tue Mar 24 10:25:06 2015 +0530
@@ -1519,6 +1519,8 @@
         p.pu[LUMA_16x32].sad_x4 = x265_pixel_sad_x4_16x32_avx2;
 
         p.cu[BLOCK_16x16].sse_pp = x265_pixel_ssd_16x16_avx2;
+
+        p.cu[BLOCK_16x16].ssd_s = x265_pixel_ssd_s_16_avx2;
         p.cu[BLOCK_32x32].ssd_s = x265_pixel_ssd_s_32_avx2;
 
         p.cu[BLOCK_8x8].copy_cnt = x265_copy_cnt_8_avx2;
diff -r 7b66c36ed9ef -r 3aebdde26c77 source/common/x86/pixel.h
--- a/source/common/x86/pixel.h	Mon Mar 23 19:55:02 2015 -0500
+++ b/source/common/x86/pixel.h	Tue Mar 24 10:25:06 2015 +0530
@@ -177,6 +177,7 @@
 int x265_pixel_ssd_s_8_sse2(const int16_t*, intptr_t);
 int x265_pixel_ssd_s_16_sse2(const int16_t*, intptr_t);
 int x265_pixel_ssd_s_32_sse2(const int16_t*, intptr_t);
+int x265_pixel_ssd_s_16_avx2(const int16_t*, intptr_t);
 int x265_pixel_ssd_s_32_avx2(const int16_t*, intptr_t);
 
 #define ADDAVG(func)  \
diff -r 7b66c36ed9ef -r 3aebdde26c77 source/common/x86/ssd-a.asm
--- a/source/common/x86/ssd-a.asm	Mon Mar 23 19:55:02 2015 -0500
+++ b/source/common/x86/ssd-a.asm	Tue Mar 24 10:25:06 2015 +0530
@@ -2548,6 +2548,35 @@
     movd    eax, m0
     RET
 
+INIT_YMM avx2
+cglobal pixel_ssd_s_16, 2,4,5
+    add     r1, r1
+    lea     r3, [r1 * 3]
+    mov     r2d, 16/4
+    pxor    m0, m0
+.loop:
+    movu    m1, [r0]
+    movu    m2, [r0 + r1]
+    movu    m3, [r0 + 2 * r1]
+    movu    m4, [r0 + r3]
+
+    lea     r0, [r0 + r1 * 4]
+    pmaddwd m1, m1
+    pmaddwd m2, m2
+    pmaddwd m3, m3
+    pmaddwd m4, m4
+    paddd   m1, m2
+    paddd   m3, m4
+    paddd   m1, m3
+    paddd   m0, m1
+
+    dec     r2d
+    jnz    .loop
+
+    ; calculate sum and return
+    HADDD   m0, m1
+    movd    eax, xm0
+    RET
 
 INIT_YMM avx2
 cglobal pixel_ssd_s_32, 2,4,5


More information about the x265-devel mailing list