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

dtyx265 at gmail.com dtyx265 at gmail.com
Tue May 19 02:24:31 CEST 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431991674 25200
# Node ID 2f44ae6d6250677b87c31ca21a0098e44b19ee98
# Parent  660aa8e3a00e3c22543f2fcbc61ff0d81287f9cd
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.93x 	 2162.50  	 6330.30
chroma_vps[  6x8]	2.48x 	 1997.49  	 4950.24
chroma_vpp[ 6x16]	2.99x 	 4184.12  	 12520.14
chroma_vps[ 6x16]	2.45x 	 4041.30  	 9897.54

diff -r 660aa8e3a00e -r 2f44ae6d6250 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon May 18 16:16:18 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp	Mon May 18 16:27:54 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 660aa8e3a00e -r 2f44ae6d6250 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Mon May 18 16:16:18 2015 -0700
+++ b/source/common/x86/ipfilter8.asm	Mon May 18 16:27:54 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,17 @@
     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]
+    lea         r4,        [3 * r3]
 
 %assign x 1
-%rep %1/4
+%rep %2/4
     movq        m0,        [r0]
     movq        m1,        [r0 + r1]
     movq        m2,        [r0 + 2 * r1]
@@ -1333,12 +1338,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 +1375,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
 
@@ -1387,13 +1409,19 @@
 
     paddw       m2,        m7
 
+%ifidn %1,pp
     paddw       m2,        m4
     psraw       m2,        6
     packuswb    m2,        m2
-    lea         r2,        [r2 + 2 * r3]
-    movd        [r2],      m2
+    movd        [r2 + 2 * r3], m2
     pextrw      r6d,       m2,    2
-    mov         [r2 + 4],  r6w
+    mov         [r2 + 2 * r3 + 4],  r6w
+%elifidn %1,ps
+    psubw       m2,        m4
+    movh        [r2 + 2 * r3], m2
+    pshufd      m2,        m2,        2
+    movd        [r2 + 2 * r3 + 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
-    mov         [r2 + r3 + 4], r6w
-
-%if x < %1/4
-    lea         r2,        [r2 + 2 * r3]
-%endif
+    movd        [r2 + r4], m3
+    pextrw      r6d,       m3,    2
+    mov         [r2 + r4 + 4], r6w
+%elifidn %1,ps
+    psubw       m3,        m4
+    movh        [r2 + r4], m3
+    pshufd      m3,        m3,        2
+    movd        [r2 + r4 + 8],  m3
+%endif
+
+%if x < %2/4
+    lea         r2,        [r2 + 4 * 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 660aa8e3a00e -r 2f44ae6d6250 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Mon May 18 16:16:18 2015 -0700
+++ b/source/common/x86/ipfilter8.h	Mon May 18 16:27:54 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