[x265] [PATCH Review Only] luma_hps[64x16, 64x32, 64x48, 64x64] avx2 asm: improved 17472c->10503c, 31107c->18187c, 44869c->26601c, 60809c->33937c

aasaipriya at multicorewareinc.com aasaipriya at multicorewareinc.com
Tue Mar 3 06:28:06 CET 2015


# HG changeset patch
# User Aasaipriya Chandran <aasaipriya at multicorewareinc.com>
# Date 1425360473 -19800
#      Tue Mar 03 10:57:53 2015 +0530
# Node ID f2a8c71599858eb09bf3374626045acd8e871a24
# Parent  88824fdb34aefbe9fec3c1da8d30375e00fe7d14
luma_hps[64x16, 64x32, 64x48, 64x64] avx2 asm: improved 17472c->10503c, 31107c->18187c, 44869c->26601c, 60809c->33937c

diff -r 88824fdb34ae -r f2a8c7159985 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Tue Mar 03 10:54:14 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Tue Mar 03 10:57:53 2015 +0530
@@ -1792,6 +1792,11 @@
         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.pu[LUMA_64x64].luma_hps = x265_interp_8tap_horiz_ps_64x64_avx2;
+        p.pu[LUMA_64x48].luma_hps = x265_interp_8tap_horiz_ps_64x48_avx2;
+        p.pu[LUMA_64x32].luma_hps = x265_interp_8tap_horiz_ps_64x32_avx2;
+        p.pu[LUMA_64x16].luma_hps = x265_interp_8tap_horiz_ps_64x16_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 88824fdb34ae -r f2a8c7159985 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Tue Mar 03 10:54:14 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Tue Mar 03 10:57:53 2015 +0530
@@ -2081,6 +2081,136 @@
 IPFILTER_LUMA_PS_32x_AVX2 32 , 8
 IPFILTER_LUMA_PS_32x_AVX2 32 , 64
 
+
+%macro IPFILTER_LUMA_PS_64x_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
+    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                          .label
+    lea                         r6,                [r1 * 3]                     ; r6 = (N / 2 - 1) * srcStride
+    sub                         r0,                r6                           ; r0(src)-r6
+    add                         r4,                7                            ; blkheight += N - 1  (7 - 1 = 6 ; since the last one row not in loop)
+
+.label
+    ; 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
+    phaddw                      m3,                m4                           ; DWORD [R1D R1C R0D R0C R1B R1A R0B R0A]
+
+    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
+    phaddw                      m4,                m5                           ; DWORD [R3D R3C R2D R2C R3B R3A R2B R2A]
+
+    phaddw                      m3,                m4                           ; first 16 elements
+    mova                        m5,                m7
+    vpermd                      m3,                m5,               m3
+    psubw                       m3,                m2
+
+    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
+    phaddw                      m3,                m4                           ; DWORD [R1D R1C R0D R0C R1B R1A R0
+
+    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
+    phaddw                      m4,                m5                           ; DWORD [R3D R3C R2D R2C R3B R3A R2B R2
+
+    phaddw                      m3,                m4                           ; second 16 elements
+    mova                        m5,                m7
+    vpermd                      m3,                m5,               m3
+    psubw                       m3,                m2
+
+    movu                        [r2 + 32],         m3                          ;row 0
+
+    vbroadcasti128              m3,                [r0 + 32]
+    pshufb                      m4,                m3,             m6           ; row 0 (col 36 to 39)
+    pshufb                      m3,                m1                           ; row 0 (col 32 to 35)
+    pmaddubsw                   m3,                m0
+    pmaddubsw                   m4,                m0
+    phaddw                      m3,                m4                           ; DWORD [R1D R1C R0D R0C R1B R1A R0
+
+    vbroadcasti128              m4,                [r0 + 40]
+    pshufb                      m5,                m4,            m6            ;row 0 (col 44 to 47)
+    pshufb                      m4,                m1                           ;row 0 (col 40 to 43)
+    pmaddubsw                   m4,                m0
+    pmaddubsw                   m5,                m0
+    phaddw                      m4,                m5                           ; DWORD [R3D R3C R2D R2C R3B R3A R2B R2
+
+
+    phaddw                      m3,                m4                           ; third 16 elements
+    mova                        m5,                m7
+    vpermd                      m3,                m5,               m3
+    psubw                       m3,                m2
+
+    movu                        [r2 + 64],         m3                          ;row 0
+
+    vbroadcasti128              m3,                [r0 + 48]
+    pshufb                      m4,                m3,             m6           ; row 0 (col 52 to 55)
+    pshufb                      m3,                m1                           ; row 0 (col 48 to 51)
+    pmaddubsw                   m3,                m0
+    pmaddubsw                   m4,                m0
+    phaddw                      m3,                m4                           ; DWORD [R1D R1C R0D R0C R1B R1A R0
+
+    vbroadcasti128              m4,                [r0 + 56]
+    pshufb                      m5,                m4,            m6            ;row 0 (col 60 to 63)
+    pshufb                      m4,                m1                           ;row 0 (col 56 to 59)
+    pmaddubsw                   m4,                m0
+    pmaddubsw                   m5,                m0
+    phaddw                      m4,                m5                           ; DWORD [R3D R3C R2D R2C R3B R3A R2B R2
+
+    phaddw                      m3,                m4                           ;fourth 16 elements
+    mova                        m5,                m7
+    vpermd                      m3,                m5,               m3
+    psubw                       m3,                m2
+
+    movu                        [r2 + 96],         m3                          ;row 0
+
+    lea                         r0,                [r0 + r1]
+    lea                         r2,                [r2 + r3]
+    dec                         r4d
+    jnz                         .label
+
+RET
+%endmacro
+
+IPFILTER_LUMA_PS_64x_AVX2 64 , 64
+IPFILTER_LUMA_PS_64x_AVX2 64 , 48
+IPFILTER_LUMA_PS_64x_AVX2 64 , 32
+IPFILTER_LUMA_PS_64x_AVX2 64 , 16
+
 ;--------------------------------------------------------------------------------------------------------------
 ; void interp_8tap_horiz_pp_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
 ;--------------------------------------------------------------------------------------------------------------


More information about the x265-devel mailing list