[x265] [PATCH] asm : chroma_hps[4x8 , 4x16] for i420 avx2 - improved 557c->377c, 873c->588c

aasaipriya at multicorewareinc.com aasaipriya at multicorewareinc.com
Wed Mar 11 12:50:45 CET 2015


# HG changeset patch
# User Aasaipriya Chandran <aasaipriya at multicorewareinc.com>
# Date 1426074632 -19800
#      Wed Mar 11 17:20:32 2015 +0530
# Node ID b15af56f64b9d397e44ff093b3a80d1bdbd71039
# Parent  c24cc7f55a051768331e3854c41aef404f572c24
asm : chroma_hps[4x8 , 4x16] for i420 avx2 - improved 557c->377c, 873c->588c

diff -r c24cc7f55a05 -r b15af56f64b9 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Mar 11 16:45:15 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Mar 11 17:20:32 2015 +0530
@@ -1592,6 +1592,8 @@
         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].filter_hps = x265_interp_4tap_horiz_ps_8x8_avx2;
 
         p.chroma[X265_CSP_I420].pu[CHROMA_420_4x2].filter_hps = x265_interp_4tap_horiz_ps_4x2_avx2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x8].filter_hps = x265_interp_4tap_horiz_ps_4x8_avx2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x16].filter_hps = x265_interp_4tap_horiz_ps_4x16_avx2;
 
         p.chroma[X265_CSP_I422].pu[CHROMA_422_4x4].filter_vpp = x265_interp_4tap_vert_pp_4x4_avx2;
 
diff -r c24cc7f55a05 -r b15af56f64b9 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Wed Mar 11 16:45:15 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Wed Mar 11 17:20:32 2015 +0530
@@ -14922,6 +14922,101 @@
     movhps            [r2],         xm3
 .end
    RET
+
+;-----------------------------------------------------------------------------------------------------------------------------
+; void interp_4tap_horiz_ps_4xN(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx, int isRowExt)
+;-----------------------------------------------------------------------------------------------------------------------------;
+%macro IPFILTER_CHROMA_PS_4xN_AVX2 2
+INIT_YMM avx2 
+cglobal interp_4tap_horiz_ps_%1x%2, 4,7,5
+    mov             r4d, r4m
+    mov             r5d, r5m
+    add             r3d, r3d
+
+%ifdef PIC
+    lea               r6,           [tab_ChromaCoeff]
+    vpbroadcastd      m0,           [r6 + r4 * 4]
+%else
+    vpbroadcastd      m0,           [tab_ChromaCoeff + r4 * 4]
+%endif
+
+    vbroadcasti128     m2,           [pw_1]
+    vbroadcasti128     m1,           [tab_Tm]
+
+    ; register map
+    ; m0 - interpolate coeff
+    ; m1 - shuffle order table
+    ; m2 - constant word 1
+
+    mov              r4,                %2
+    dec              r0
+    test             r5d,       r5d
+    je               .loop
+    sub              r0 ,               r1
+
+
+.loop
+    sub              r4d,           4
+    ; Row 0-1
+    movu              xm3,          [r0]
+    vinserti128       m3,           m3,      [r0 + r1],     1
+    pshufb            m3,           m1
+    pmaddubsw         m3,           m0
+    pmaddwd           m3,           m2
+
+    ; Row 2-3
+    lea               r0,           [r0 + r1 * 2]
+    movu              xm4,          [r0]
+    vinserti128       m4,           m4,      [r0 + r1],     1
+    pshufb            m4,           m1
+    pmaddubsw         m4,           m0
+    pmaddwd           m4,           m2
+
+    packssdw          m3,           m4
+    psubw             m3,           [pw_2000]
+    vextracti128      xm4,          m3,     1
+    movq              [r2],         xm3
+    movq              [r2+r3],      xm4
+    lea               r2,           [r2 + r3 * 2]
+    movhps            [r2],         xm3
+    movhps            [r2 + r3],    xm4
+
+    lea               r2,           [r2 + r3 * 2]
+    lea               r0,           [r0 + r1 * 2]
+
+    test              r4d,          r4d
+    jnz               .loop
+    test                r5d,        r5d
+    jz                .end
+
+    ;Row 5-6
+    movu              xm3,          [r0]
+    vinserti128       m3,           m3,      [r0 + r1],     1
+    pshufb            m3,           m1
+    pmaddubsw         m3,           m0
+    pmaddwd           m3,           m2
+
+    ; Row 7
+    lea               r0,           [r0 + r1 * 2]
+    vbroadcasti128    m4,           [r0]                      ; [x x x x x A 9 8 7 6 5 4 3 2 1 0]
+    pshufb            m4,           m1
+    pmaddubsw         m4,           m0
+    pmaddwd           m4,           m2
+
+    packssdw          m3,           m4
+    psubw             m3,           [pw_2000]
+
+    vextracti128      xm4,          m3,     1
+    movq              [r2],         xm3
+    movq              [r2+r3],      xm4
+    lea               r2,           [r2 + r3 * 2]
+    movhps            [r2],         xm3
+.end
+RET
+%endmacro
+
+    IPFILTER_CHROMA_PS_4xN_AVX2  4 , 8
+    IPFILTER_CHROMA_PS_4xN_AVX2  4 , 16
 ;-----------------------------------------------------------------------------------------------------------------------------
 ; void interp_4tap_horiz_ps_8x8(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx, int isRowExt)
 ;-----------------------------------------------------------------------------------------------------------------------------;


More information about the x265-devel mailing list