[x265] [PATCH Review Only] Luma_hpp[16x16] Avx2 asm code

aasaipriya at multicorewareinc.com aasaipriya at multicorewareinc.com
Tue Nov 11 13:12:54 CET 2014


# HG changeset patch
# User maheshpittala
# Date 1415707607 -19800
#      Tue Nov 11 17:36:47 2014 +0530
# Node ID c92edd8bf12b369b4da460241c9c1ca0fcd40932
# Parent  32513a4c3bd435757347e729dc14b5a1c1c6ceef
Luma_hpp[16x16] Avx2 asm code

diff -r 32513a4c3bd4 -r c92edd8bf12b source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Nov 10 12:39:54 2014 +0900
+++ b/source/common/x86/asm-primitives.cpp	Tue Nov 11 17:36:47 2014 +0530
@@ -1799,6 +1799,8 @@
         p.transpose[BLOCK_64x64] = x265_transpose64_avx2;
 #endif
         p.luma_hpp[LUMA_4x4] = x265_interp_8tap_horiz_pp_4x4_avx2;
+		p.luma_hpp[LUMA_8x8] = x265_interp_8tap_horiz_pp_8x8_avx2;
+		p.luma_hpp[LUMA_16x16] = x265_interp_8tap_horiz_pp_16x16_avx2;
         p.luma_vpp[LUMA_4x4] = x265_interp_8tap_vert_pp_4x4_avx2;
     }
 #endif // if HIGH_BIT_DEPTH
diff -r 32513a4c3bd4 -r c92edd8bf12b source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Mon Nov 10 12:39:54 2014 +0900
+++ b/source/common/x86/ipfilter8.asm	Tue Nov 11 17:36:47 2014 +0530
@@ -124,6 +124,9 @@
 
 tab_c_64_n64:   times 8 db 64, -64
 
+shuf1:   times 2 db 0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15
+
+shuf2 : times 2 db 8, 9, 10, 11, 12, 13, 14, 15, 4, 5, 6, 7, 0, 1, 2, 3
 
 SECTION .text
 
@@ -853,6 +856,145 @@
     pextrd          [r2+r0], xm3, 3
     RET
 
+	;------------------------------------------------------------------------------------------------------------------------------------
+	;8tap_horiz_pp_8x8
+	;------------------------------------------------------------------------------------------------------------------------------------
+
+
+	INIT_YMM avx2
+cglobal interp_8tap_horiz_pp_8x8, 4,7,7
+    mov             r4d, r4m
+    mov             r6w,  4
+
+%ifdef PIC
+    lea             r5, [tab_LumaCoeff]
+    vpbroadcastq    m0, [r5 + r4 * 8]
+%else
+    vpbroadcastq    m0, [tab_LumaCoeff + r4 * 8]
+%endif
+
+    mova            m1, [tab_Lm]
+    mova            m2, [tab_Lm + 32]
+
+    ; register map
+    ; m0 - interpolate coeff
+    ; m1 - shuffle order table
+
+    ;lea             r4, [r2]
+    sub             r0, 3
+.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, m2
+    pshufb          m4, m1
+    pmaddubsw       m4, m0
+    pmaddubsw       m5, m0
+    phaddw          m4, m5
+    ; Row 1
+    vbroadcasti128  m5, [r0 + r1]                   ; [x E D C B A 9 8 7 6 5 4 3 2 1 0]
+    pshufb          m6, m5, m2
+    pshufb          m5, m1
+    pmaddubsw       m5, m0
+    pmaddubsw       m6, m0
+    phaddw          m5, m6
+
+    phaddw          m4, m5
+    pmulhrsw        m4, [pw_512]
+    vextracti128    xm5, m4, 1
+    packuswb        xm4, xm5
+    pshufb          xm4, [shuf1]
+
+
+     movq            [r2], xm4
+     movhps          [r2 + r3], xm4
+    ;pextrd          [r2 +r3], xm4, 2
+    ;pextrd          [r2+r3+4], xm4, 3
+
+    lea             r2, [r2 + r3 * 2]
+    lea             r0, [r0 + r1 * 2]
+    dec             r6w
+    jnz             .loop
+    RET
+		
+	INIT_YMM avx2
+cglobal interp_8tap_horiz_pp_16x16, 4,7,7
+    mov             r4d, r4m
+	mov             r6w,  8
+
+%ifdef PIC
+    lea             r5, [tab_LumaCoeff]
+    vpbroadcastq    m0, [r5 + r4 * 8]
+%else
+    vpbroadcastq    m0, [tab_LumaCoeff + r4 * 8]
+%endif
+
+    mova             m1, [tab_Lm]
+    mova             m2, [tab_Lm + 32]
+
+	; register map
+    ; m0              -     interpolate coeff
+    ; m1, m2  -     shuffle order table
+  
+    sub             r0, 3
+    .loop:
+    ; Row 0
+    vbroadcasti128  m5, [r0]                       ; [x E D C B A 9 8 7 6 5 4 3 2 1 0] 0 to 127 bits (col 0 to 7)
+	vbroadcasti128  m7, [r0 + 8]                   ; 64 to 192 bits (for col 8 to 15)
+	
+	pshufb          m6, m7, m2                     ; 12-19 to 15-22 shuffle order   (col 12 to 15)
+	pshufb          m7, m1                         ; 8-15 to 11-18 shuffle order    (col 8 to 11)
+    pshufb          m3, m5, m2                     ; 4-11 to 7-14 shuffle order     (col 4 to 7)
+	pshufb          m5, m1                         ; 0-7 to 3-10 shuffle order      (col 0 to 3)   
+	                       
+	pmaddubsw       m5, m0
+	pmaddubsw       m6, m0
+	pmaddubsw       m7, m0
+	pmaddubsw       m3, m0
+
+	phaddw          m6, m7       ; col 8 to 15
+	phaddw          m5, m3       ; col 0 to 7
+	phaddw          m6, m5       ; col 0 to 15
+    pmulhrsw        m6, [pw_512]
+	
+	; Row 1
+    vbroadcasti128  m5, [r0 + r1]                       ; [x E D C B A 9 8 7 6 5 4 3 2 1 0] 0 to 127 bits (col 0 to 7)
+	vbroadcasti128  m7, [r0 + r1 + 8]                   ; 64 to 192 bits (for col 8 to 15)
+	
+	pshufb          m4, m7, m2                     ; 12-19 to 15-22 shuffle order   (col 12 to 15)
+	pshufb          m7, m1                         ; 8-15 to 11-18 shuffle order    (col 8 to 11)
+    pshufb          m3, m5, m2                     ; 4-11 to 7-14 shuffle order     (col 4 to 7)
+	pshufb          m5, m1                         ; 0-7 to 3-10 shuffle order      (col 0 to 3)   
+	                       
+	pmaddubsw       m5, m0
+	pmaddubsw       m4, m0
+	pmaddubsw       m7, m0
+	pmaddubsw       m3, m0
+
+	phaddw          m4, m7       ; col 8 to 15
+	phaddw          m5, m3       ; col 0 to 7
+	phaddw          m4, m5       ; col 0 to 15
+
+	pmulhrsw        m4, [pw_512]
+
+    packuswb        m6,m4
+  	vextracti128    xm5, m6, 1
+    punpcklwd       xm7, xm6, xm5
+    punpckhwd       xm3, xm6, xm5
+
+    pshufb          xm7, [shuf2]       ; row 0
+    pshufb          xm3, [shuf2]       ; row1
+	vextracti128    xm5, m7, 1
+
+	movq             [r2], xm7
+	movhps           [r2 + 8], xm7
+	movq             [r2 + r3], xm3
+	movhps           [r2 + r3 + 8], xm3
+
+	lea             r2, [r2 + r3 * 2]
+    lea             r0, [r0 + r1 * 2]
+    dec             r6w
+    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