[x265] [PATCH] asm: avx2 code for sad[16x64] for 10 bpp (3060->1353)

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Mon May 11 07:12:21 CEST 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1431321133 -19800
#      Mon May 11 10:42:13 2015 +0530
# Branch stable
# Node ID 06bc0b4430388875b2d71f3e7484504c4a800edf
# Parent  b642b3d8cc1ec5d12f89dfd9db960c91ab0e13be
asm: avx2 code for sad[16x64] for 10 bpp (3060->1353)

sse2:
sad[16x64]  3.08x    3060.55         9412.37
avx2:
sad[16x64]  6.85x    1353.36         9263.85

diff -r b642b3d8cc1e -r 06bc0b443038 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Sat May 09 12:33:18 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Mon May 11 10:42:13 2015 +0530
@@ -1264,6 +1264,7 @@
         p.pu[LUMA_16x12].sad = x265_pixel_sad_16x12_avx2;
         p.pu[LUMA_16x16].sad = x265_pixel_sad_16x16_avx2;
         p.pu[LUMA_16x32].sad = x265_pixel_sad_16x32_avx2;
+        p.pu[LUMA_16x64].sad = x265_pixel_sad_16x64_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r b642b3d8cc1e -r 06bc0b443038 source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Sat May 09 12:33:18 2015 -0500
+++ b/source/common/x86/sad16-a.asm	Mon May 11 10:42:13 2015 +0530
@@ -392,6 +392,70 @@
 SAD  16, 16
 SAD  16, 32
 
+INIT_YMM avx2
+cglobal pixel_sad_16x64, 4,7,4
+    pxor    m0, m0
+    pxor    m3, m3
+    mov     r4d, 64 / 8
+    add     r3d, r3d
+    add     r1d, r1d
+    lea     r5,     [r1 * 3]
+    lea     r6,     [r3 * 3]
+.loop:
+    movu    m1, [r2]
+    movu    m2, [r2 + r3]
+    psubw   m1, [r0]
+    psubw   m2, [r0 + r1]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    paddw   m0, m1
+    paddw   m3, m2
+
+    movu    m1, [r2 + 2 * r3]
+    movu    m2, [r2 + r6]
+    psubw   m1, [r0 + 2 * r1]
+    psubw   m2, [r0 + r5]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    paddw   m0, m1
+    paddw   m3, m2
+
+    lea     r0, [r0 + 4 * r1]
+    lea     r2, [r2 + 4 * r3]
+
+    movu    m1, [r2]
+    movu    m2, [r2 + r3]
+    psubw   m1, [r0]
+    psubw   m2, [r0 + r1]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    paddw   m0, m1
+    paddw   m3, m2
+
+    movu    m1, [r2 + 2 * r3]
+    movu    m2, [r2 + r6]
+    psubw   m1, [r0 + 2 * r1]
+    psubw   m2, [r0 + r5]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    paddw   m0, m1
+    paddw   m3, m2
+
+    lea     r0, [r0 + 4 * r1]
+    lea     r2, [r2 + 4 * r3]
+
+    dec    r4d
+    jg .loop
+
+    HADDUWD m0, m1
+    HADDUWD m3, m1
+    HADDD   m0, m1
+    HADDD   m3, m1
+    paddd   m0, m3
+
+    movd    eax, xm0
+    RET
+
 ;------------------------------------------------------------------
 ; int pixel_sad_32xN( uint16_t *, intptr_t, uint16_t *, intptr_t )
 ;------------------------------------------------------------------


More information about the x265-devel mailing list