[x265] [PATCH] asm: avx2 code for sad[64x48] (10791 -> 4053) for 10 bpp

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


# HG changeset patch
# User Sumalatha Polureddy
# Date 1431581856 -19800
#      Thu May 14 11:07:36 2015 +0530
# Node ID 8f66730a49c9c679f81cf54dd52a94e40e51b86c
# Parent  6502653ac351cea28a741753942d32d0720545f5
asm: avx2 code for sad[64x48] (10791 -> 4053) for 10 bpp

sse2
sad[64x48]  2.34x    10791.39        25291.58

avx2
sad[64x48]  6.45x    4053.05         26139.05

diff -r 6502653ac351 -r 8f66730a49c9 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu May 14 10:49:41 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu May 14 11:07:36 2015 +0530
@@ -1286,6 +1286,7 @@
         p.pu[LUMA_32x64].sad = x265_pixel_sad_32x64_avx2;
         p.pu[LUMA_64x16].sad = x265_pixel_sad_64x16_avx2;
         p.pu[LUMA_64x32].sad = x265_pixel_sad_64x32_avx2;
+        p.pu[LUMA_64x48].sad = x265_pixel_sad_64x48_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r 6502653ac351 -r 8f66730a49c9 source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Thu May 14 10:49:41 2015 +0530
+++ b/source/common/x86/sad16-a.asm	Thu May 14 11:07:36 2015 +0530
@@ -868,6 +868,67 @@
     movd    eax, xm0
     RET
 
+INIT_YMM avx2
+cglobal pixel_sad_64x48, 4, 5, 8
+    pxor    m0, m0
+    pxor    m5, m5
+    pxor    m6, m6
+    pxor    m7, m7
+    mov     r4d, 48 / 2
+    add     r3d, r3d
+    add     r1d, r1d
+.loop:
+    movu    m1, [r2 + 0]
+    movu    m2, [r2 + 32]
+    movu    m3, [r2 + 64]
+    movu    m4, [r2 + 96]
+    psubw   m1, [r0 + 0]
+    psubw   m2, [r0 + 32]
+    psubw   m3, [r0 + 64]
+    psubw   m4, [r0 + 96]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    pabsw   m4, m4
+    paddw   m0, m1
+    paddw   m5, m2
+    paddw   m6, m3
+    paddw   m7, m4
+
+    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   m0, m1
+    paddw   m5, m2
+    paddw   m6, m3
+    paddw   m7, m4
+
+    lea     r0, [r0 + 2 * r1]
+    lea     r2, [r2 + 2 * r3]
+
+    dec    r4d
+    jg     .loop
+
+    HADDUWD m0, m1
+    HADDUWD m5, m1
+    HADDUWD m6, m1
+    HADDUWD m7, m1
+    paddd   m0, m5
+    paddd   m0, m6
+    paddd   m0, m7
+    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