[x265] [PATCH Review Only] chroma_hps[i420] avx2 asm code: 336c->214c

chen chenm003 at 163.com
Fri Mar 6 23:19:34 CET 2015


 

At 2015-03-06 16:17:08,aasaipriya at multicorewareinc.com wrote:
># HG changeset patch
># User Aasaipriya Chandran <aasaipriya at multicorewareinc.com>
># Date 1425629812 -19800
>#      Fri Mar 06 13:46:52 2015 +0530
># Node ID 29d4d0251f06777190867d9de35c43379a414342
># Parent  04861917b7b343216ac1b9a9f70e38396af53275
>chroma_hps[i420] avx2 asm code: 336c->214c
>
>diff -r 04861917b7b3 -r 29d4d0251f06 source/common/x86/asm-primitives.cpp
>--- a/source/common/x86/asm-primitives.cpp	Thu Feb 26 19:11:18 2015 +0530
>+++ b/source/common/x86/asm-primitives.cpp	Fri Mar 06 13:46:52 2015 +0530
>@@ -1791,6 +1791,8 @@
>         p.chroma[X265_CSP_I420].pu[CHROMA_420_32x32].filter_hpp = x265_interp_4tap_horiz_pp_32x32_avx2;
>         p.chroma[X265_CSP_I420].pu[CHROMA_420_16x16].filter_hpp = x265_interp_4tap_horiz_pp_16x16_avx2;
> 
>+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].filter_hps = x265_interp_4tap_horiz_ps_4x4_avx2;
>+
>         p.pu[LUMA_4x4].luma_vps = x265_interp_8tap_vert_ps_4x4_avx2;
> 
>         p.pu[LUMA_4x4].luma_vpp = x265_interp_8tap_vert_pp_4x4_avx2;
>diff -r 04861917b7b3 -r 29d4d0251f06 source/common/x86/ipfilter8.asm
>--- a/source/common/x86/ipfilter8.asm	Thu Feb 26 19:11:18 2015 +0530
>+++ b/source/common/x86/ipfilter8.asm	Fri Mar 06 13:46:52 2015 +0530
>@@ -1719,6 +1719,93 @@
>     IPFILTER_LUMA_64x_avx2 64 , 32
>     IPFILTER_LUMA_64x_avx2 64 , 16
> 
>+
>+;-----------------------------------------------------------------------------------------------------------------------------
>+; void interp_4tap_horiz_ps_4x4(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx, int isRowExt)
>+;-----------------------------------------------------------------------------------------------------------------------------;
>+INIT_YMM avx2 
>+cglobal interp_4tap_horiz_ps_4x4, 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
>+
>+    vpbroadcastd      m2,           [pw_1]
IACA show vbroadcasti128 are better

>+    vbroadcasti128    m1,           [tab_Tm]
>+
>+    ; register map
>+    ; m0 - interpolate coeff
>+    ; m1 - shuffle order table
>+    ; m2 - constant word 1
>+    mov                r6d,      4
>+    dec                r0
>+    cmp                r5m, byte 0
you have load r5m into r5d before

>+    je                 .label
>+    sub                r0 , r1
>+    add                r6d , 3
we don't need value in r6d, so the previous SUB may replace by CMOV (or keep jmp, depend on result by instruction analyze)
>+
>+.label
>+    ; Row 0-1
>+    vbroadcasti128    m3,           [r0]                        ; [x x x x x A 9 8 7 6 5 4 3 2 1 0]
>+    vinserti128       m3,           m3,      [r0 + r1],     1
careful on address alignment, testbench most time are aligned, but really encoder may different

>+    pshufb            m3,           m1
>+    pmaddubsw         m3,           m0
>+    pmaddwd           m3,           m2
>+
>+    ; Row 2-3
>+    lea               r0,           [r0 + r1 * 2]
>+    vbroadcasti128    m4,           [r0]                      ; [x x x x x A 9 8 7 6 5 4 3 2 1 0]
>+    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
>+
>+    cmp               r6d,           4
we may use r5d to check row extendsion

>+    jz                .l1
>+    lea               r2,           [r2 + r3 * 2]
>+    lea               r0,           [r0 + r1 * 2]
>+
>+    ;Row 5-6
>+    vbroadcasti128    m3,           [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]
>+    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
>+.l1
>+    RET
>+
>+
> ;-----------------------------------------------------------------------------------------------------------------------------
> ;void interp_horiz_ps_c(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx, int isRowExt)
> ;-----------------------------------------------------------------------------------------------------------------------------
>_______________________________________________
>x265-devel mailing list
>x265-devel at videolan.org
>https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20150307/4f41983c/attachment-0001.html>


More information about the x265-devel mailing list