[x265] [PATCH Review Only] Luma_hpp[32x32 , 64x64] avx2 asm code : improved 8297c->6307c , 34004c->22745c

aasaipriya at multicorewareinc.com aasaipriya at multicorewareinc.com
Thu Nov 13 12:34:27 CET 2014


# HG changeset patch
# User Aasaipriya
# Date 1415878300 -19800
#      Thu Nov 13 17:01:40 2014 +0530
# Node ID 066204c64ed7c44cef3ba2fae582bba38f053560
# Parent  bb769f22b32bee9ccda56f081d44c5e6f3cab274
Luma_hpp[32x32 , 64x64] avx2 asm code : improved 8297c->6307c , 34004c->22745c

diff -r bb769f22b32b -r 066204c64ed7 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Nov 13 16:54:53 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Nov 13 17:01:40 2014 +0530
@@ -1800,6 +1800,8 @@
 #endif
         p.luma_hpp[LUMA_4x4] = x265_interp_8tap_horiz_pp_4x4_avx2;
 		p.luma_hpp[LUMA_16x16] = x265_interp_8tap_horiz_pp_16x16_avx2;
+        p.luma_hpp[LUMA_32x32] = x265_interp_8tap_horiz_pp_32x32_avx2;
+        p.luma_hpp[LUMA_64x64] = x265_interp_8tap_horiz_pp_64x64_avx2;
         p.luma_vpp[LUMA_4x4] = x265_interp_8tap_vert_pp_4x4_avx2;
     }
 #endif // if HIGH_BIT_DEPTH
diff -r bb769f22b32b -r 066204c64ed7 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Thu Nov 13 16:54:53 2014 +0530
+++ b/source/common/x86/ipfilter8.asm	Thu Nov 13 17:01:40 2014 +0530
@@ -904,6 +904,187 @@
     jnz             .loop
     RET
 
+INIT_YMM avx2
+cglobal interp_8tap_horiz_pp_32x32, 4,6,8
+    sub             r0, 3
+    mov             r4d, r4m
+%ifdef PIC
+    lea             r5, [tab_LumaCoeff]
+    vpbroadcastd    m0, [r5 + r4 * 8]
+    vpbroadcastd    m1, [r5 + r4 * 8 + 4]
+%else
+    vpbroadcastd    m0, [tab_LumaCoeff + r4 * 8]
+    vpbroadcastd    m1, [tab_LumaCoeff + r4 * 8 + 4]
+%endif
+    mova            m2, [tab_Tm]
+    movu            m3, [tab_Tm + 16]
+    vpbroadcastd    m7, [pw_1]
+
+    ; register map
+    ; m0 , m1 interpolate coeff
+    ; m2 , m2  shuffle order table
+    ; m7 - pw_1
+
+    mov             r4d,  32
+.loop:
+    ; Row 0
+    vbroadcasti128  m4, [r0]                        ; [x E D C B A 9 8 7 6 5 4 3 2 1 0]
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 8]                    
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5                          ; [17 16 15 14 07 06 05 04 13 12 11 10 03 02 01 00]
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2],xm4
+    vbroadcasti128  m4, [r0 + 16]                  
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 24]                
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5                          
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2 + 16],xm4
+    lea             r0, [r0 + r1 ]
+    lea             r2, [r2 + r3]
+    dec             r4d
+    jnz             .loop
+    RET
+
+
+INIT_YMM avx2
+cglobal interp_8tap_horiz_pp_64x64, 4,6,8
+    sub             r0, 3
+    mov             r4d, r4m
+%ifdef PIC
+    lea             r5, [tab_LumaCoeff]
+    vpbroadcastd    m0, [r5 + r4 * 8]
+    vpbroadcastd    m1, [r5 + r4 * 8 + 4]
+%else
+    vpbroadcastd    m0, [tab_LumaCoeff + r4 * 8]
+    vpbroadcastd    m1, [tab_LumaCoeff + r4 * 8 + 4]
+%endif
+    mova            m2, [tab_Tm]
+    movu            m3, [tab_Tm + 16]
+    vpbroadcastd    m7, [pw_1]
+
+    ; register map
+    ; m0 , m1 interpolate coeff
+    ; m2 , m2  shuffle order table
+    ; m7 - pw_1
+
+    mov             r4d,  64
+.loop:
+    ; Row 0
+    vbroadcasti128  m4, [r0]                        ; [x E D C B A 9 8 7 6 5 4 3 2 1 0]
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 8]                    
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5                          ; [17 16 15 14 07 06 05 04 13 12 11 10 03 02 01 00]
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2],xm4
+    vbroadcasti128  m4, [r0 + 16]               
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 24]                   
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2 + 16],xm4
+    vbroadcasti128  m4, [r0 + 32]
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 40]
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5 
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2 + 32],xm4
+    vbroadcasti128  m4, [r0 + 48]
+    pshufb          m5, m4, m3
+    pshufb          m4, m2
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m1
+    paddw           m4, m5
+    pmaddwd         m4, m7
+    vbroadcasti128  m5, [r0 + 56]
+    pshufb          m6, m5, m3
+    pshufb          m5, m2
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m1
+    paddw           m5, m6
+    pmaddwd         m5, m7
+    packssdw        m4, m5
+    pmulhrsw        m4, [pw_512]
+    packuswb        m4, m4
+    vpermq          m4, m4, 11011000b
+    pshufd          xm4, xm4, 11011000b
+    movdqu          [r2 + 48],xm4
+    lea             r0, [r0 + r1]
+    lea             r2, [r2 + r3]
+    dec             r4d
+    jnz             .loop
+    RET
+
 
 ;--------------------------------------------------------------------------------------------------------------
 ; 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