[x265] [PATCH 4 of 6] asm: 10bpp sse4 code for saoCuOrgE2

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Mon Jun 22 14:50:36 CEST 2015


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1434963191 -19800
#      Mon Jun 22 14:23:11 2015 +0530
# Node ID f85c15cc0e1d70e63182b03e294c2778f598143d
# Parent  558ffdc4e832061d99f1ec688fe1ae64db48642f
asm: 10bpp sse4 code for saoCuOrgE2

Performance improvement over C:
SAO_EO_2[0]     6.27x    207.22          1298.92
SAO_EO_2[1]     8.92x    555.20          4949.69

diff -r 558ffdc4e832 -r f85c15cc0e1d source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Jun 22 18:15:40 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Jun 22 14:23:11 2015 +0530
@@ -1092,6 +1092,8 @@
         p.saoCuOrgE0 = PFX(saoCuOrgE0_sse4);
         p.saoCuOrgE1 = PFX(saoCuOrgE1_sse4);
         p.saoCuOrgE1_2Rows = PFX(saoCuOrgE1_2Rows_sse4);
+        p.saoCuOrgE2[0] = PFX(saoCuOrgE2_sse4);
+        p.saoCuOrgE2[1] = PFX(saoCuOrgE2_sse4);
 
         LUMA_ADDAVG(sse4);
         CHROMA_420_ADDAVG(sse4);
diff -r 558ffdc4e832 -r f85c15cc0e1d source/common/x86/loopfilter.asm
--- a/source/common/x86/loopfilter.asm	Mon Jun 22 18:15:40 2015 +0530
+++ b/source/common/x86/loopfilter.asm	Mon Jun 22 14:23:11 2015 +0530
@@ -672,6 +672,64 @@
 ; void saoCuOrgE2(pixel * rec, int8_t * bufft, int8_t * buff1, int8_t * offsetEo, int lcuWidth, intptr_t stride)
 ;======================================================================================================================================================
 INIT_XMM sse4
+%if HIGH_BIT_DEPTH
+cglobal saoCuOrgE2, 6,6,8
+    mov         r4d, r4m
+    add         r5d, r5d
+    pxor        m0, m0
+    inc         r1
+    movh        m6, [r0 + r4 * 2]
+    movhps      m6, [r1 + r4]
+
+.loop
+    movu        m7, [r0]
+    movu        m5, [r0 + 16]
+    movu        m3, [r0 + r5 + 2]
+    movu        m1, [r0 + r5 + 18]
+
+    pcmpgtw     m2, m7, m3
+    pcmpgtw     m3, m7
+    pcmpgtw     m4, m5, m1
+    pcmpgtw     m1, m5
+    packsswb    m2, m4
+    packsswb    m3, m1
+    pand        m2, [pb_1]
+    por         m2, m3
+
+    movu        m3, [r2]
+
+    paddb       m3, m2
+    paddb       m3, [pb_2]
+
+    movu        m4, [r3]
+    pshufb      m4, m3
+
+    psubb       m3, m0, m2
+    movu        [r1], m3
+
+    pmovsxbw    m3, m4
+    punpckhbw   m4, m4
+    psraw       m4, 8
+
+    paddw       m7, m3
+    paddw       m5, m4
+    pmaxsw      m7, m0
+    pmaxsw      m5, m0
+    pminsw      m7, [pw_1023]
+    pminsw      m5, [pw_1023]
+    movu        [r0], m7
+    movu        [r0 + 16], m5
+
+    add         r0, 32
+    add         r1, 16
+    add         r2, 16
+    sub         r4, 16
+    jg          .loop
+
+    movh        [r0 + r4 * 2], m6
+    movhps      [r1 + r4], m6
+    RET
+%else ; HIGH_BIT_DEPTH
 cglobal saoCuOrgE2, 5, 6, 8, rec, bufft, buff1, offsetEo, lcuWidth
     mov         r4d,   r4m
     mov         r5d,   r5m
@@ -722,6 +780,7 @@
     movh        [r0 + r4], m5
     movhps      [r1 + r4], m5
     RET
+%endif
 
 INIT_YMM avx2
 cglobal saoCuOrgE2, 5, 6, 7, rec, bufft, buff1, offsetEo, lcuWidth
diff -r 558ffdc4e832 -r f85c15cc0e1d source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Mon Jun 22 18:15:40 2015 +0530
+++ b/source/test/pixelharness.cpp	Mon Jun 22 14:23:11 2015 +0530
@@ -957,8 +957,8 @@
     ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
     ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
 
-    memset(ref_dest, 0xCD, sizeof(ref_dest));
-    memset(opt_dest, 0xCD, sizeof(opt_dest));
+    for (int i = 0; i < 64 * 64; i++)
+        ref_dest[i] = opt_dest[i] = rand() % (PIXEL_MAX);
 
     for (int id = 0; id < 2; id++)
     {


More information about the x265-devel mailing list