[x265] [PATCH] asm: avx2 code for sad[64x32] (7156 -> 2625) for 10 bpp

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu May 14 07:19:47 CEST 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1431580781 -19800
#      Thu May 14 10:49:41 2015 +0530
# Node ID 6502653ac351cea28a741753942d32d0720545f5
# Parent  acef1df5a9f1923dc85c88a328495aebbffc32f6
asm: avx2 code for sad[64x32] (7156 -> 2625) for 10 bpp

sse2
sad[64x32]  2.42x    7156.98         17353.95

avx2
sad[64x32]  6.59x    2625.69         17314.50

diff -r acef1df5a9f1 -r 6502653ac351 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu May 14 10:31:29 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu May 14 10:49:41 2015 +0530
@@ -1285,6 +1285,7 @@
         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_64x32].sad = x265_pixel_sad_64x32_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r acef1df5a9f1 -r 6502653ac351 source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Thu May 14 10:31:29 2015 +0530
+++ b/source/common/x86/sad16-a.asm	Thu May 14 10:49:41 2015 +0530
@@ -813,6 +813,61 @@
     movd    eax, xm0
     RET
 
+INIT_YMM avx2
+cglobal pixel_sad_64x32, 4, 5, 6
+    pxor    m0, m0
+    pxor    m5, m5
+    mov     r4d, 32 / 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   m5, 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   m5, m3
+    lea     r0, [r0 + 2 * r1]
+    lea     r2, [r2 + 2 * r3]
+
+    dec    r4d
+    jg     .loop
+
+    HADDUWD m0, m1
+    HADDUWD m5, m1
+    paddd   m0, m5
+    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