[x265] [PATCH Review Only] luma_hps[32x8, 32x16, 32x24, 32x32, 32x64] avx2 asm : improved 5793c->3061c, 9061c->4723c, 12388c->6522c, 15552c->8309c, 27670c->14790c

chen chenm003 at 163.com
Wed Mar 11 23:45:54 CET 2015


 

At 2015-03-11 17:18:05,aasaipriya at multicorewareinc.com wrote:
># HG changeset patch
># User Aasaipriya Chandran <aasaipriya at multicorewareinc.com>
># Date 1426065460 -19800
>#      Wed Mar 11 14:47:40 2015 +0530
># Node ID 57e51fa4dd246720cb4c3e12005e7682baf26e7f
># Parent  800f8ecd1e7393756f4bb58e536497162dc32150
>luma_hps[32x8, 32x16, 32x24, 32x32, 32x64] avx2 asm : improved 5793c->3061c, 9061c->4723c, 12388c->6522c, 15552c->8309c, 27670c->14790c
>
>diff -r 800f8ecd1e73 -r 57e51fa4dd24 source/common/x86/asm-primitives.cpp
>--- a/source/common/x86/asm-primitives.cpp	Tue Mar 10 10:49:11 2015 +0530
>+++ b/source/common/x86/asm-primitives.cpp	Wed Mar 11 14:47:40 2015 +0530
>@@ -1570,6 +1570,12 @@
>         p.pu[LUMA_16x32].luma_hps = x265_interp_8tap_horiz_ps_16x32_avx2;
>         p.pu[LUMA_16x64].luma_hps = x265_interp_8tap_horiz_ps_16x64_avx2;
> 
>+        p.pu[LUMA_32x32].luma_hps = x265_interp_8tap_horiz_ps_32x32_avx2;
>+        p.pu[LUMA_32x16].luma_hps = x265_interp_8tap_horiz_ps_32x16_avx2;
>+        p.pu[LUMA_32x24].luma_hps = x265_interp_8tap_horiz_ps_32x24_avx2;
>+        p.pu[LUMA_32x8].luma_hps = x265_interp_8tap_horiz_ps_32x8_avx2;
>+        p.pu[LUMA_32x64].luma_hps = x265_interp_8tap_horiz_ps_32x64_avx2;
>+
>         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].filter_hpp = x265_interp_4tap_horiz_pp_8x8_avx2;
>         p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].filter_hpp = x265_interp_4tap_horiz_pp_4x4_avx2;
>         p.chroma[X265_CSP_I420].pu[CHROMA_420_32x32].filter_hpp = x265_interp_4tap_horiz_pp_32x32_avx2;
>diff -r 800f8ecd1e73 -r 57e51fa4dd24 source/common/x86/ipfilter8.asm
>--- a/source/common/x86/ipfilter8.asm	Tue Mar 10 10:49:11 2015 +0530
>+++ b/source/common/x86/ipfilter8.asm	Wed Mar 11 14:47:40 2015 +0530
>@@ -2018,7 +2018,103 @@
> IPFILTER_LUMA_PS_16x_AVX2 16 , 32
> IPFILTER_LUMA_PS_16x_AVX2 16 , 64
> 
>-
>+%macro IPFILTER_LUMA_PS_32xN_AVX2 2
>+INIT_YMM avx2
>+cglobal interp_8tap_horiz_ps_%1x%2, 6, 7, 8
>+%ifdef PIC
>+    lea                         r6,                [tab_LumaCoeff]
>+    vpbroadcastq                m0,                [r6 + r4 * 8]
>+%else
>+    vpbroadcastq                m0,                [tab_LumaCoeff + r4 * 8]
>+%endif
>+    mova                        m6,                [tab_Lm + 32]
>+    mova                        m1,                [tab_Lm]
>+    mov                         r4,                %2                           ;height

r4 is loop counter, you just need r4d here.
>+    add                         r3d,               r3d
>+    vbroadcasti128              m2,                [pw_2000]
>+    mova                        m7,                [interp8_hps_shuf]
>+
>+    ; register map
>+    ; m0      - interpolate coeff
>+    ; m1 , m6 - shuffle order table
>+    ; m2      - pw_2000
>+
>+    sub                         r0,                3
>+    test                        r5d,               r5d
>+    jz                          .loop
>+    lea                         r6,                [r1 * 3]                     ; r8 = (N / 2 - 1) * srcStride
>+    sub                         r0,                r6
>+    add                         r4,                7                            ; blkheight += N - 1  (7 - 1 = 6 ; since the last one row not in loop)

r4d?
>+
>+.loop
>+    ; Row 0
>+    vbroadcasti128              m3,                [r0]                         ; [x x x x x A 9 8 7 6 5 4 3 2 1 0]
>+    pshufb                      m4,                m3,             m6           ; row 0 (col 4 to 7)
>+    pshufb                      m3,                m1                           ; shuffled based on the col order tab_Lm row 0 (col 0 to 3)
>+    pmaddubsw                   m3,                m0
>+    pmaddubsw                   m4,                m0
>+    pmaddwd                     m3,                [pw_1]
>+    pmaddwd                     m4,                [pw_1]
>+    packssdw                    m3,                m4
>+
>+
>+    vbroadcasti128              m4,                [r0 + 8]
>+    pshufb                      m5,                m4,            m6            ;row 0 (col 12 to 15)
>+    pshufb                      m4,                m1                           ;row 0 (col 8 to 11)
>+    pmaddubsw                   m4,                m0
>+    pmaddubsw                   m5,                m0
>+    pmaddwd                     m4,                [pw_1]
>+    pmaddwd                     m5,                [pw_1]
>+    packssdw                    m4,                m5
>+
>+    pmaddwd                     m3,                [pw_1]
>+    pmaddwd                     m4,                [pw_1]
>+    packssdw                    m3,                m4
>+    mova                        m5,                m7
>+    vpermd                      m3,                m5,               m3
>+    psubw                       m3,                m2

m2 use less, so if we swap constant pw_1 into m2, it is less code size and more performance
>+
>+    movu                        [r2],              m3                          ;row 0
>+
>+    vbroadcasti128              m3,                [r0 + 16]
>+    pshufb                      m4,                m3,             m6           ; row 0 (col 20 to 23)
>+    pshufb                      m3,                m1                           ; row 0 (col 16 to 19)
>+    pmaddubsw                   m3,                m0
>+    pmaddubsw                   m4,                m0
>+    pmaddwd                     m3,                [pw_1]
>+    pmaddwd                     m4,                [pw_1]
>+    packssdw                    m3,                m4
>+
>+    vbroadcasti128              m4,                [r0 + 24]
>+    pshufb                      m5,                m4,            m6            ;row 0 (col 28 to 31)
>+    pshufb                      m4,                m1                           ;row 0 (col 24 to 27)
>+    pmaddubsw                   m4,                m0
>+    pmaddubsw                   m5,                m0
>+    pmaddwd                     m4,                [pw_1]
>+    pmaddwd                     m5,                [pw_1]
>+    packssdw                    m4,                m5
>+
>+    pmaddwd                     m3,                [pw_1]
>+    pmaddwd                     m4,                [pw_1]
>+    packssdw                    m3,                m4
>+    mova                        m5,                m7
>+    vpermd                      m3,                m5,               m3
>+    psubw                       m3,                m2
>+
>+    movu                        [r2 + 32],         m3                          ;row 0
>+
>+    add                         r0,                r1
>+    add                         r2,                r3
>+    dec                         r4d
>+    jnz                         .loop
>+RET

need spaces before RET, ident to other instructions
>+%endmacro
>+
>+IPFILTER_LUMA_PS_32xN_AVX2 32 , 32
>+IPFILTER_LUMA_PS_32xN_AVX2 32 , 16
>+IPFILTER_LUMA_PS_32xN_AVX2 32 , 24
>+IPFILTER_LUMA_PS_32xN_AVX2 32 , 8
>+IPFILTER_LUMA_PS_32xN_AVX2 32 , 64
> ;--------------------------------------------------------------------------------------------------------------
> ; void interp_8tap_horiz_pp_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
> ;--------------------------------------------------------------------------------------------------------------
>_______________________________________________
>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/20150312/3aad82c7/attachment-0001.html>


More information about the x265-devel mailing list