[x265] [PATCH] asm: avx2 code for sad[64x16] and sad[64x32] for 10 bpp

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu May 14 07:01:37 CEST 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1431579689 -19800
#      Thu May 14 10:31:29 2015 +0530
# Node ID 14362a71b78fe24ea4215051815a7171a0c1f485
# Parent  479087422e29a672d6e9bc8d0cd2a65649d71fe2
asm: avx2 code for sad[64x16] and sad[64x32] for 10 bpp

sse2
sad[64x16]  2.45x    3620.17         8851.77

avx2
sad[64x16]  7.00x    1279.94         8961.61

diff -r 479087422e29 -r 14362a71b78f source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed May 13 16:52:59 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp	Thu May 14 10:31:29 2015 +0530
@@ -1284,6 +1284,7 @@
         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_64x16].sad = x265_pixel_sad_64x16_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r 479087422e29 -r 14362a71b78f source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Wed May 13 16:52:59 2015 -0700
+++ b/source/common/x86/sad16-a.asm	Thu May 14 10:31:29 2015 +0530
@@ -763,6 +763,56 @@
     movd    eax, xm0
     RET
 
+INIT_YMM avx2
+cglobal pixel_sad_64x16, 4, 5, 5
+    pxor    m0, m0
+    mov     r4d, 16 / 2
+    add     r3d, r3d
+    add     r1d, r1d
+.loop:
+    movu    m1, [r2 + 0]
+    movu    m2, [r2 + 32]
+    movu    m3, [r2 + 2 * 32]
+    movu    m4, [r2 + 3 * 32]
+    psubw   m1, [r0 + 0]
+    psubw   m2, [r0 + 32]
+    psubw   m3, [r0 + 2 * 32]
+    psubw   m4, [r0 + 3 * 32]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    pabsw   m4, m4
+    paddw   m1, m2
+    paddw   m3, m4
+    paddw   m0, m1
+    paddw   m0, m3
+    movu    m1, [r2 + r3]
+    movu    m2, [r2 + r3 + 32]
+    movu    m3, [r2 + r3 + 64]
+    movu    m4, [r2 + r3 + 96]
+    psubw   m1, [r0 + r1]
+    psubw   m2, [r0 + r1 + 32]
+    psubw   m3, [r0 + r1 + 64]
+    psubw   m4, [r0 + r1 + 96]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    pabsw   m4, m4
+    paddw   m1, m2
+    paddw   m3, m4
+    paddw   m0, m1
+    paddw   m0, m3
+    lea     r0, [r0 + 2 * r1]
+    lea     r2, [r2 + 2 * r3]
+
+    dec    r4d
+    jg     .loop
+
+    HADDUWD m0, m1
+    HADDD   m0, m1
+    movd    eax, xm0
+    RET
+
 ;------------------------------------------------------------------
 ; int pixel_sad_32xN( uint16_t *, intptr_t, uint16_t *, intptr_t )
 ;------------------------------------------------------------------


More information about the x265-devel mailing list