[x265] [PATCH 04 of 12] asm: interp_4tap_vert_ps_6xN sse2

dtyx265 at gmail.com dtyx265 at gmail.com
Mon May 18 04:48:55 CEST 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431912814 25200
# Node ID 5e00387a0130682e7467649bb6b25c0d11a88343
# Parent  c2624b61f4c7d894616a7dc1e8a6cc1c0a506028
asm: interp_4tap_vert_ps_6xN sse2

Converted vert_pp_6xN macro to also create ps primitives.  This replaces c code for ps with minimal impact on pp.

64-bit

./test/TestBench --testbench interp | grep vp | grep " 6x"
chroma_vpp[  6x8]	2.98x 	 2125.00  	 6330.15
chroma_vps[  6x8]	2.45x 	 2032.49  	 4980.56
chroma_vpp[ 6x16]	2.98x 	 4198.94  	 12520.75
chroma_vps[ 6x16]	2.47x 	 4004.99  	 9897.92

diff -r c2624b61f4c7 -r 5e00387a0130 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Sun May 17 18:24:12 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp	Sun May 17 18:33:34 2015 -0700
@@ -1520,6 +1520,8 @@
         p.chroma[X265_CSP_I444].pu[LUMA_64x32].filter_vpp = x265_interp_4tap_vert_pp_64x32_sse2;
         p.chroma[X265_CSP_I444].pu[LUMA_64x48].filter_vpp = x265_interp_4tap_vert_pp_64x48_sse2;
         p.chroma[X265_CSP_I444].pu[LUMA_64x64].filter_vpp = x265_interp_4tap_vert_pp_64x64_sse2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_6x8].filter_vps = x265_interp_4tap_vert_ps_6x8_sse2;
+        p.chroma[X265_CSP_I422].pu[CHROMA_422_6x16].filter_vps = x265_interp_4tap_vert_ps_6x16_sse2;
 #endif
 
         ALL_LUMA_PU(luma_hpp, interp_8tap_horiz_pp, sse2);
diff -r c2624b61f4c7 -r 5e00387a0130 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Sun May 17 18:24:12 2015 -0700
+++ b/source/common/x86/ipfilter8.asm	Sun May 17 18:33:34 2015 -0700
@@ -1282,12 +1282,11 @@
     FILTER_V4_W4_H4_sse2 ps, 32
 
 ;-----------------------------------------------------------------------------
-;void interp_4tap_vert_pp_6x8(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
-;-----------------------------------------------------------------------------
-%macro FILTER_V4_W6_H4_sse2 1
+;void interp_4tap_vert_%1_6x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
+;-----------------------------------------------------------------------------
+%macro FILTER_V4_W6_H4_sse2 2
 INIT_XMM sse2
-cglobal interp_4tap_vert_pp_6x%1, 4, 7, 10
-
+cglobal interp_4tap_vert_%1_6x%2, 4, 7, 10
     mov         r4d,       r4m
     sub         r0,        r1
     shl         r4d,       5
@@ -1302,11 +1301,16 @@
     mova        m5,        [tab_ChromaCoeffV + r4 + 16]
 %endif
 
+%ifidn %1,pp
     mova        m4,        [pw_32]
+%elifidn %1,ps
+    mova        m4,        [pw_2000]
+    add         r3d,       r3d
+%endif
     lea         r5,        [3 * r1]
 
 %assign x 1
-%rep %1/4
+%rep %2/4
     movq        m0,        [r0]
     movq        m1,        [r0 + r1]
     movq        m2,        [r0 + 2 * r1]
@@ -1333,12 +1337,20 @@
 
     paddw       m0,        m7
 
+%ifidn %1,pp
     paddw       m0,        m4
     psraw       m0,        6
     packuswb    m0,        m0
+
     movd        [r2],      m0
     pextrw      r6d,       m0,        2
     mov         [r2 + 4],  r6w
+%elifidn %1,ps
+    psubw       m0,        m4
+    movh        [r2],      m0
+    pshufd      m0,        m0,        2
+    movd        [r2 + 8],  m0
+%endif
 
     lea         r0,        [r0 + 4 * r1]
 
@@ -1362,12 +1374,21 @@
 
     paddw       m1,        m7
 
+%ifidn %1,pp
     paddw       m1,        m4
     psraw       m1,        6
     packuswb    m1,        m1
+
     movd        [r2 + r3], m1
     pextrw      r6d,       m1,        2
     mov         [r2 + r3 + 4], r6w
+%elifidn %1,ps
+    psubw       m1,        m4
+    movh        [r2 + r3], m1
+    pshufd      m1,        m1,        2
+    movd        [r2 + r3 + 8],  m1
+%endif
+
     movq        m1,        [r0 + r1]
     punpcklbw   m7,        m0,        m1
 
@@ -1386,14 +1407,21 @@
     packssdw    m7,        m8
 
     paddw       m2,        m7
-
+    lea         r2,        [r2 + 2 * r3]
+
+%ifidn %1,pp
     paddw       m2,        m4
     psraw       m2,        6
     packuswb    m2,        m2
-    lea         r2,        [r2 + 2 * r3]
     movd        [r2],      m2
     pextrw      r6d,       m2,    2
     mov         [r2 + 4],  r6w
+%elifidn %1,ps
+    psubw       m2,        m4
+    movh        [r2],      m2
+    pshufd      m2,        m2,        2
+    movd        [r2 + 8],  m2
+%endif
 
     movq        m2,        [r0 + 2 * r1]
     punpcklbw   m1,        m2
@@ -1414,17 +1442,25 @@
 
     paddw       m3,        m1
 
+%ifidn %1,pp
     paddw       m3,        m4
     psraw       m3,        6
     packuswb    m3,        m3
 
     movd        [r2 + r3], m3
-    pextrw      r6d,    m3,    2
+    pextrw      r6d,       m3,    2
     mov         [r2 + r3 + 4], r6w
-
-%if x < %1/4
+%elifidn %1,ps
+    psubw       m3,        m4
+    movh        [r2 + r3], m3
+    pshufd      m3,        m3,        2
+    movd        [r2 + r3 + 8],  m3
+%endif
+
+%if x < %2/4
     lea         r2,        [r2 + 2 * r3]
 %endif
+
 %assign x x+1
 %endrep
     RET
@@ -1432,8 +1468,10 @@
 %endmacro
 
 %if ARCH_X86_64
-    FILTER_V4_W6_H4_sse2 8
-    FILTER_V4_W6_H4_sse2 16
+    FILTER_V4_W6_H4_sse2 pp, 8
+    FILTER_V4_W6_H4_sse2 pp, 16
+    FILTER_V4_W6_H4_sse2 ps, 8
+    FILTER_V4_W6_H4_sse2 ps, 16
 %endif
 
 ;-----------------------------------------------------------------------------
diff -r c2624b61f4c7 -r 5e00387a0130 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Sun May 17 18:24:12 2015 -0700
+++ b/source/common/x86/ipfilter8.h	Sun May 17 18:33:34 2015 -0700
@@ -954,6 +954,8 @@
 void x265_interp_4tap_vert_pp_64x32_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
 void x265_interp_4tap_vert_pp_64x48_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
 void x265_interp_4tap_vert_pp_64x64_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_ps_6x8_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_ps_6x16_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
 #endif
 #undef LUMA_FILTERS
 #undef LUMA_SP_FILTERS


More information about the x265-devel mailing list