[x265] [PATCH 2 of 6] asm: 10bpp sse4 code for saoCuOrgE1, improved 5017c->470c, over C code

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


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1434948494 -19800
#      Mon Jun 22 10:18:14 2015 +0530
# Node ID 1c02df66f093b5b1bacc8a1bbf9be2ef81591ad5
# Parent  a94e9a1f0fde08e060a9b52e3353ce2f242d9257
asm: 10bpp sse4 code for saoCuOrgE1, improved 5017c->470c, over C code

diff -r a94e9a1f0fde -r 1c02df66f093 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Fri Jun 19 16:47:56 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Jun 22 10:18:14 2015 +0530
@@ -1090,6 +1090,7 @@
     if (cpuMask & X265_CPU_SSE4)
     {
         p.saoCuOrgE0 = PFX(saoCuOrgE0_sse4);
+        p.saoCuOrgE1 = PFX(saoCuOrgE1_sse4);
 
         LUMA_ADDAVG(sse4);
         CHROMA_420_ADDAVG(sse4);
diff -r a94e9a1f0fde -r 1c02df66f093 source/common/x86/loopfilter.asm
--- a/source/common/x86/loopfilter.asm	Fri Jun 19 16:47:56 2015 +0530
+++ b/source/common/x86/loopfilter.asm	Mon Jun 22 10:18:14 2015 +0530
@@ -292,6 +292,62 @@
 ; void saoCuOrgE1(pixel *pRec, int8_t *m_iUpBuff1, int8_t *m_iOffsetEo, Int iStride, Int iLcuWidth)
 ;==================================================================================================
 INIT_XMM sse4
+%if HIGH_BIT_DEPTH
+cglobal saoCuOrgE1, 4,5,8
+    add         r3d, r3d
+    mov         r4d, r4m
+    pxor        m0, m0                      ; m0 = 0
+    mova        m6, [pb_2]                  ; m6 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
+    shr         r4d, 4
+.loop
+    movu        m7, [r0]
+    movu        m5, [r0 + 16]
+    movu        m3, [r0 + r3]
+    movu        m1, [r0 + r3 + 16]
+
+    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, [r1]                    ; m3 = m_iUpBuff1
+
+    paddb       m3, m2
+    paddb       m3, m6
+
+    movu        m4, [r2]                    ; m4 = m_iOffsetEo
+    pshufb      m1, m4, m3
+
+    psubb       m3, m0, m2
+    movu        [r1], m3
+
+    pmovsxbw    m3, m1
+    punpckhbw   m1, m1
+    psraw       m1, 8
+
+    paddw       m7, m3
+    paddw       m5, m1
+
+    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
+    dec         r4d
+    jnz         .loop
+    RET
+%else ; HIGH_BIT_DEPTH
 cglobal saoCuOrgE1, 3, 5, 8, pRec, m_iUpBuff1, m_iOffsetEo, iStride, iLcuWidth
     mov         r3d, r3m
     mov         r4d, r4m
@@ -337,6 +393,7 @@
     dec         r4d
     jnz         .loop
     RET
+%endif
 
 INIT_YMM avx2
 cglobal saoCuOrgE1, 3, 5, 8, pRec, m_iUpBuff1, m_iOffsetEo, iStride, iLcuWidth
diff -r a94e9a1f0fde -r 1c02df66f093 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Fri Jun 19 16:47:56 2015 +0530
+++ b/source/test/pixelharness.cpp	Mon Jun 22 10:18:14 2015 +0530
@@ -929,8 +929,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);
 
     int j = 0;
 


More information about the x265-devel mailing list