[x265] [PATCH 1 of 2] asm: avx2 code for sad[32x64] for 8bpp

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu Mar 19 06:59:21 CET 2015


# HG changeset patch
# User Sumalatha Polureddy<sumalatha at multicorewareinc.com>
# Date 1426744440 -19800
# Node ID 22107b4b361e08602808d46fc9ad59037f14b4d2
# Parent  cbfa66e0b50cc2393ccbcf6471406504c6c06011
asm: avx2 code for sad[32x64] for 8bpp

see3
sad[32x64]  31.63x   1418.64         44877.38

avx2
sad[32x64]  56.61x   779.04          44103.82

diff -r cbfa66e0b50c -r 22107b4b361e source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Mar 18 18:16:51 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Thu Mar 19 11:24:00 2015 +0530
@@ -1452,6 +1452,7 @@
         p.pu[LUMA_32x16].sad = x265_pixel_sad_32x16_avx2;
         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_64x32].sad = x265_pixel_sad_64x32_avx2;
         p.pu[LUMA_64x48].sad = x265_pixel_sad_64x48_avx2;
diff -r cbfa66e0b50c -r 22107b4b361e source/common/x86/sad-a.asm
--- a/source/common/x86/sad-a.asm	Wed Mar 18 18:16:51 2015 -0500
+++ b/source/common/x86/sad-a.asm	Thu Mar 19 11:24:00 2015 +0530
@@ -4087,6 +4087,70 @@
     movd            eax, xm0
     RET
 
+ INIT_YMM avx2
+cglobal pixel_sad_32x64, 4,7,5
+    xorps           m0, m0
+    mov             r4d, 64/8
+    lea             r5, [r1 * 3]
+    lea             r6, [r3 * 3]
+
+.loop
+    movu           m1, [r0]               ; row 0 of pix0
+    movu           m2, [r2]               ; row 0 of pix1
+    movu           m3, [r0 + r1]          ; row 1 of pix0
+    movu           m4, [r2 + r3]          ; row 1 of pix1
+
+    psadbw         m1, m2
+    psadbw         m3, m4
+    paddd          m0, m1
+    paddd          m0, m3
+
+    movu           m1, [r0 + 2 * r1]      ; row 2 of pix0
+    movu           m2, [r2 + 2 * r3]      ; row 2 of pix1
+    movu           m3, [r0 + r5]          ; row 3 of pix0
+    movu           m4, [r2 + r6]          ; row 3 of pix1
+
+    psadbw         m1, m2
+    psadbw         m3, m4
+    paddd          m0, m1
+    paddd          m0, m3
+
+    lea            r2,     [r2 + 4 * r3]
+    lea            r0,     [r0 + 4 * r1]
+
+    movu           m1, [r0]               ; row 4 of pix0
+    movu           m2, [r2]               ; row 4 of pix1
+    movu           m3, [r0 + r1]          ; row 5 of pix0
+    movu           m4, [r2 + r3]          ; row 5 of pix1
+
+    psadbw         m1, m2
+    psadbw         m3, m4
+    paddd          m0, m1
+    paddd          m0, m3
+
+    movu           m1, [r0 + 2 * r1]      ; row 6 of pix0
+    movu           m2, [r2 + 2 * r3]      ; row 6 of pix1
+    movu           m3, [r0 + r5]          ; row 7 of pix0
+    movu           m4, [r2 + r6]          ; row 7 of pix1
+
+    psadbw         m1, m2
+    psadbw         m3, m4
+    paddd          m0, m1
+    paddd          m0, m3
+
+    lea            r2,     [r2 + 4 * r3]
+    lea            r0,     [r0 + 4 * r1]
+
+    dec            r4d
+    jnz           .loop
+
+    vextracti128   xm1, m0, 1
+    paddd          xm0, xm1
+    pshufd         xm1, xm0, 2
+    paddd          xm0,xm1
+    movd            eax, xm0
+    RET
+
 INIT_YMM avx2
 cglobal pixel_sad_64x16, 4,5,6
     xorps           m0, m0


More information about the x265-devel mailing list