[x265] [PATCH] asm: avx2 code for sad[32x64] for 10 bpp(6222 -> 2427)

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Tue May 12 08:15:46 CEST 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1431411338 -19800
#      Tue May 12 11:45:38 2015 +0530
# Node ID e1607bc0531206da5a5c4fe84ba45ea7158fb61a
# Parent  f2081ef64fd27dfd3a5bec92ee1a835a74061761
asm: avx2 code for sad[32x64] for 10 bpp(6222 -> 2427)

sse2
sad[32x64]  2.82x    6222.04         17557.96
avx2
sad[32x64]  7.05x    2427.57         17121.56

diff -r f2081ef64fd2 -r e1607bc05312 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon May 11 18:50:03 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Tue May 12 11:45:38 2015 +0530
@@ -1269,6 +1269,7 @@
         p.pu[LUMA_32x16].sad = x265_pixel_sad_32x16_avx2;
         p.pu[LUMA_32x24].sad = x265_pixel_sad_32x24_avx2;
         p.pu[LUMA_32x32].sad = x265_pixel_sad_32x32_avx2;
+        p.pu[LUMA_32x64].sad = x265_pixel_sad_32x64_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r f2081ef64fd2 -r e1607bc05312 source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Mon May 11 18:50:03 2015 -0500
+++ b/source/common/x86/sad16-a.asm	Tue May 12 11:45:38 2015 +0530
@@ -705,6 +705,64 @@
     movd    eax, xm0
     RET
 
+INIT_YMM avx2
+cglobal pixel_sad_32x64, 4,7,6
+    pxor    m0, m0
+    pxor    m5, m5
+    mov     r4d, 64 / 4
+    add     r3d, r3d
+    add     r1d, r1d
+    lea     r5,     [r1 * 3]
+    lea     r6,     [r3 * 3]
+.loop:
+    movu    m1, [r2]
+    movu    m2, [r2 + 32]
+    movu    m3, [r2 + r3]
+    movu    m4, [r2 + r3 + 32]
+    psubw   m1, [r0]
+    psubw   m2, [r0 + 32]
+    psubw   m3, [r0 + r1]
+    psubw   m4, [r0 + r1 + 32]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    pabsw   m4, m4
+    paddw   m1, m2
+    paddw   m3, m4
+    paddw   m0, m1
+    paddw   m5, m3
+
+    movu    m1, [r2 + 2 * r3]
+    movu    m2, [r2 + 2 * r3 + 32]
+    movu    m3, [r2 + r6]
+    movu    m4, [r2 + r6 + 32]
+    psubw   m1, [r0 + 2 * r1]
+    psubw   m2, [r0 + 2 * r1 + 32]
+    psubw   m3, [r0 + r5]
+    psubw   m4, [r0 + r5 + 32]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    pabsw   m4, m4
+    paddw   m1, m2
+    paddw   m3, m4
+    paddw   m0, m1
+    paddw   m5, m3
+    lea     r0, [r0 + 4 * r1]
+    lea     r2, [r2 + 4 * r3]
+
+    dec    r4d
+    jg .loop
+
+    HADDUWD m0, m1
+    HADDUWD m5, m1
+    HADDD   m0, m1
+    HADDD   m5, m1
+    paddd   m0, m5
+
+    movd    eax, xm0
+    RET
+
 ;------------------------------------------------------------------
 ; int pixel_sad_32xN( uint16_t *, intptr_t, uint16_t *, intptr_t )
 ;------------------------------------------------------------------


More information about the x265-devel mailing list