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

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Thu Jun 25 10:23:52 CEST 2015


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1435213857 -19800
#      Thu Jun 25 12:00:57 2015 +0530
# Node ID 8b680fd502e08ec2cab4fff7f5833791bb5bfeef
# Parent  f43aa44673dcd8e96581c938cf22ad4bbb7657e3
asm: 10bpp AVX2 code for saoCuOrgE2

SAO_EO_2[0] 207c->166
SAO_EO_2[1] 555c->422c

diff -r f43aa44673dc -r 8b680fd502e0 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Jun 25 11:54:22 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Jun 25 12:00:57 2015 +0530
@@ -1287,6 +1287,8 @@
         p.saoCuOrgE0 = PFX(saoCuOrgE0_avx2);
         p.saoCuOrgE1 = PFX(saoCuOrgE1_avx2);
         p.saoCuOrgE1_2Rows = PFX(saoCuOrgE1_2Rows_avx2);
+        p.saoCuOrgE2[0] = PFX(saoCuOrgE2_avx2);
+        p.saoCuOrgE2[1] = PFX(saoCuOrgE2_32_avx2);
 
         p.cu[BLOCK_16x16].intra_pred[2]     = PFX(intra_pred_ang16_2_avx2);
         p.cu[BLOCK_16x16].intra_pred[3]     = PFX(intra_pred_ang16_3_avx2);
diff -r f43aa44673dc -r 8b680fd502e0 source/common/x86/loopfilter.asm
--- a/source/common/x86/loopfilter.asm	Thu Jun 25 11:54:22 2015 +0530
+++ b/source/common/x86/loopfilter.asm	Thu Jun 25 12:00:57 2015 +0530
@@ -948,6 +948,55 @@
 %endif
 
 INIT_YMM avx2
+%if HIGH_BIT_DEPTH
+cglobal saoCuOrgE2, 6,6,7
+    mov             r4d, r4m
+    add             r5d, r5d
+    inc             r1
+    movq            xm4, [r0 + r4 * 2]
+    movhps          xm4, [r1 + r4]
+    vbroadcasti128  m5, [r3]
+    mova            m6, [pw_1023]
+.loop
+    movu            m1, [r0]
+    movu            m3, [r0 + r5 + 2]
+
+    pcmpgtw         m2, m1, m3
+    pcmpgtw         m3, m1
+
+    packsswb        m2, m3
+    vpermq          m3, m2, 11011101b
+    vpermq          m2, m2, 10001000b
+
+    pand            xm2, [pb_1]
+    por             xm2, xm3
+
+    movu            xm3, [r2]
+
+    paddb           xm3, xm2
+    paddb           xm3, [pb_2]
+    pshufb          xm0, xm5, xm3
+    pmovsxbw        m3, xm0
+
+    pxor            m0, m0
+    paddw           m1, m3
+    pmaxsw          m1, m0
+    pminsw          m1, m6
+    movu            [r0], m1
+
+    psubb           xm0, xm2
+    movu            [r1], xm0
+
+    add             r0, 32
+    add             r1, 16
+    add             r2, 16
+    sub             r4, 16
+    jg              .loop
+
+    movq            [r0 + r4 * 2], xm4
+    movhps          [r1 + r4], xm4
+    RET
+%else ; HIGH_BIT_DEPTH
 cglobal saoCuOrgE2, 5, 6, 7, rec, bufft, buff1, offsetEo, lcuWidth
     mov            r4d,   r4m
     mov            r5d,   r5m
@@ -987,8 +1036,70 @@
     movq           [r0 + r4], xm6
     movhps         [r1 + r4], xm6
     RET
+%endif
 
 INIT_YMM avx2
+%if HIGH_BIT_DEPTH
+cglobal saoCuOrgE2_32, 6,6,8
+    mov             r4d, r4m
+    add             r5d, r5d
+    inc             r1
+    movq            xm4, [r0 + r4 * 2]
+    movhps          xm4, [r1 + r4]
+    vbroadcasti128  m5, [r3]
+
+.loop
+    movu            m1, [r0]
+    movu            m7, [r0 + 32]
+    movu            m3, [r0 + r5 + 2]
+    movu            m6, [r0 + r5 + 34]
+
+    pcmpgtw         m2, m1, m3
+    pcmpgtw         m0, m7, m6
+    pcmpgtw         m3, m1
+    pcmpgtw         m6, m7
+
+    packsswb        m2, m0
+    packsswb        m3, m6
+    vpermq          m3, m3, 11011000b
+    vpermq          m2, m2, 11011000b
+
+    pand            m2, [pb_1]
+    por             m2, m3
+
+    movu            m3, [r2]
+
+    paddb           m3, m2
+    paddb           m3, [pb_2]
+    pshufb          m0, m5, m3
+
+    pmovsxbw        m3, xm0
+    vextracti128    xm0, m0, 1
+    pmovsxbw        m6, xm0
+
+    pxor            m0, m0
+    paddw           m1, m3
+    paddw           m7, m6
+    pmaxsw          m1, m0
+    pmaxsw          m7, m0
+    pminsw          m1, [pw_1023]
+    pminsw          m7, [pw_1023]
+    movu            [r0], m1
+    movu            [r0 + 32], m7
+
+    psubb           m0, m2
+    movu            [r1], m0
+
+    add             r0, 64
+    add             r1, 32
+    add             r2, 32
+    sub             r4, 32
+    jg              .loop
+
+    movq            [r0 + r4 * 2], xm4
+    movhps          [r1 + r4], xm4
+    RET
+%else ; HIGH_BIT_DEPTH
 cglobal saoCuOrgE2_32, 5, 6, 8, rec, bufft, buff1, offsetEo, lcuWidth
     mov             r4d,   r4m
     mov             r5d,   r5m
@@ -1040,6 +1151,7 @@
     movq            [r0 + r4], xm6
     movhps          [r1 + r4], xm6
     RET
+%endif
 
 ;=======================================================================================================
 ;void saoCuOrgE3(pixel *rec, int8_t *upBuff1, int8_t *m_offsetEo, intptr_t stride, int startX, int endX)


More information about the x265-devel mailing list