[x265] [PATCH] asm: avx2 code for sad_48x64, improved 9413c->3789c

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Thu May 28 09:42:19 CEST 2015


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1432798447 -19800
#      Thu May 28 13:04:07 2015 +0530
# Node ID 399b47e28145c9fe3a1004cf1d5239b7298242ee
# Parent  9b000dc7dea71d4eda3cb6c4bbf9a680f4afadae
asm: avx2 code for sad_48x64, improved 9413c->3789c

diff -r 9b000dc7dea7 -r 399b47e28145 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu May 28 11:51:00 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu May 28 13:04:07 2015 +0530
@@ -1413,6 +1413,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_48x64].sad = x265_pixel_sad_48x64_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;
diff -r 9b000dc7dea7 -r 399b47e28145 source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Thu May 28 11:51:00 2015 +0530
+++ b/source/common/x86/sad16-a.asm	Thu May 28 13:04:07 2015 +0530
@@ -764,6 +764,56 @@
     RET
 
 INIT_YMM avx2
+cglobal pixel_sad_48x64, 4, 5, 7
+    pxor    m0, m0
+    pxor    m5, m5
+    pxor    m6, m6
+    mov     r4d, 64/2
+    add     r3d, r3d
+    add     r1d, r1d
+.loop:
+    movu    m1, [r2 + 0 * mmsize]
+    movu    m2, [r2 + 1 * mmsize]
+    movu    m3, [r2 + 2 * mmsize]
+    psubw   m1, [r0 + 0 * mmsize]
+    psubw   m2, [r0 + 1 * mmsize]
+    psubw   m3, [r0 + 2 * mmsize]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    paddw   m0, m1
+    paddw   m5, m2
+    paddw   m6, m3
+
+    movu    m1, [r2 + r3 + 0 * mmsize]
+    movu    m2, [r2 + r3 + 1 * mmsize]
+    movu    m3, [r2 + r3 + 2 * mmsize]
+    psubw   m1, [r0 + r1 + 0 * mmsize]
+    psubw   m2, [r0 + r1 + 1 * mmsize]
+    psubw   m3, [r0 + r1 + 2 * mmsize]
+    pabsw   m1, m1
+    pabsw   m2, m2
+    pabsw   m3, m3
+    paddw   m0, m1
+    paddw   m5, m2
+    paddw   m6, m3
+
+    lea     r0, [r0 + 2 * r1]
+    lea     r2, [r2 + 2 * r3]
+
+    dec     r4d
+    jg      .loop
+
+    HADDUWD m0, m1
+    HADDUWD m5, m1
+    HADDUWD m6, m1
+    paddd   m0, m5
+    paddd   m0, m6
+    HADDD   m0, m1
+    movd    eax, xm0
+    RET
+
+INIT_YMM avx2
 cglobal pixel_sad_64x16, 4, 5, 5
     pxor    m0, m0
     mov     r4d, 16 / 2


More information about the x265-devel mailing list