[x265] [PATCH 3 of 6] asm: 10bpp sse4 code for saoCuOrgE1_2Rows, improved 10095c->900c, over C code

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


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1434977140 -19800
#      Mon Jun 22 18:15:40 2015 +0530
# Node ID 558ffdc4e832061d99f1ec688fe1ae64db48642f
# Parent  1c02df66f093b5b1bacc8a1bbf9be2ef81591ad5
asm: 10bpp sse4 code for saoCuOrgE1_2Rows, improved 10095c->900c, over C code

diff -r 1c02df66f093 -r 558ffdc4e832 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Jun 22 10:18:14 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Jun 22 18:15:40 2015 +0530
@@ -1091,6 +1091,7 @@
     {
         p.saoCuOrgE0 = PFX(saoCuOrgE0_sse4);
         p.saoCuOrgE1 = PFX(saoCuOrgE1_sse4);
+        p.saoCuOrgE1_2Rows = PFX(saoCuOrgE1_2Rows_sse4);
 
         LUMA_ADDAVG(sse4);
         CHROMA_420_ADDAVG(sse4);
diff -r 1c02df66f093 -r 558ffdc4e832 source/common/x86/loopfilter.asm
--- a/source/common/x86/loopfilter.asm	Mon Jun 22 10:18:14 2015 +0530
+++ b/source/common/x86/loopfilter.asm	Mon Jun 22 18:15:40 2015 +0530
@@ -442,6 +442,111 @@
 ; void saoCuOrgE1_2Rows(pixel *pRec, int8_t *m_iUpBuff1, int8_t *m_iOffsetEo, Int iStride, Int iLcuWidth)
 ;========================================================================================================
 INIT_XMM sse4
+%if HIGH_BIT_DEPTH
+cglobal saoCuOrgE1_2Rows, 4,7,8
+    add         r3d, r3d
+    mov         r4d, r4m
+    pxor        m0, m0                      ; m0 = 0
+    mova        m6, [pw_1023]
+    mov         r5d, r4d
+    shr         r4d, 4
+    mov         r6, r0
+.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, [pb_2]
+
+    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, m6
+    pminsw      m5, m6
+
+    movu        [r0], m7
+    movu        [r0 + 16],  m5
+
+    add         r0, 32
+    add         r1, 16
+    dec         r4d
+    jnz         .loop
+
+    sub         r1, r5
+    shr         r5d, 4
+    lea         r0, [r6 + r3]
+.loopH:
+    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, [pb_2]
+
+    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, m6
+    pminsw      m5, m6
+
+    movu        [r0], m7
+    movu        [r0 + 16],  m5
+
+    add         r0, 32
+    add         r1, 16
+    dec         r5d
+    jnz         .loopH
+    RET
+%else ; HIGH_BIT_DEPTH
 cglobal saoCuOrgE1_2Rows, 3, 5, 8, pRec, m_iUpBuff1, m_iOffsetEo, iStride, iLcuWidth
     mov         r3d,        r3m
     mov         r4d,        r4m
@@ -512,6 +617,7 @@
     dec         r4d
     jnz         .loop
     RET
+%endif
 
 INIT_YMM avx2
 cglobal saoCuOrgE1_2Rows, 3, 5, 7, pRec, m_iUpBuff1, m_iOffsetEo, iStride, iLcuWidth


More information about the x265-devel mailing list