[x265] [PATCH 02 of 12] asm: interp_4tap_vert_ps_4x2 sse2

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


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431990450 25200
# Node ID 54423715e7a28e0ca5874649ebe1a999e4d93463
# Parent  16ec2193116749c053ebf4fd08a15aa403305a0b
asm: interp_4tap_vert_ps_4x2 sse2

Converted vert_pp_4x2 primitive to macro that also creates ps.  This replaces c code for ps with minimal impact on pp.

64-bit

./test/TestBench --testbench interp | grep vp | grep 4x2
chroma_vpp[  4x2]	2.13x 	 524.99   	 1117.46
chroma_vps[  4x2]	1.74x 	 489.98   	 854.98

32-bit

./test/TestBench --testbench interp | grep vp | grep 4x2
chroma_vpp[  4x2]	2.44x 	 579.99   	 1414.81
chroma_vps[  4x2]	2.33x 	 552.49   	 1284.96

diff -r 16ec21931167 -r 54423715e7a2 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon May 18 16:00:59 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp	Mon May 18 16:07:30 2015 -0700
@@ -1450,6 +1450,7 @@
         p.chroma[X265_CSP_I444].pu[LUMA_4x16].filter_vpp = x265_interp_4tap_vert_pp_4x16_sse2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_vps = x265_interp_4tap_vert_ps_2x4_sse2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_2x8].filter_vps = x265_interp_4tap_vert_ps_2x8_sse2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x2].filter_vps = x265_interp_4tap_vert_ps_4x2_sse2;
         p.chroma[X265_CSP_I422].pu[CHROMA_422_2x16].filter_vps = x265_interp_4tap_vert_ps_2x16_sse2;
 #if X86_64
         p.chroma[X265_CSP_I420].pu[CHROMA_420_6x8].filter_vpp = x265_interp_4tap_vert_pp_6x8_sse2;
diff -r 16ec21931167 -r 54423715e7a2 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Mon May 18 16:00:59 2015 -0700
+++ b/source/common/x86/ipfilter8.asm	Mon May 18 16:07:30 2015 -0700
@@ -1026,11 +1026,11 @@
     FILTER_V4_W2_H4_sse2 ps, 16
 
 ;-----------------------------------------------------------------------------
-; void interp_4tap_vert_pp_4x2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
-;-----------------------------------------------------------------------------
+; void interp_4tap_vert_%1_4x2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
+;-----------------------------------------------------------------------------
+%macro  FILTER_V2_W4_H4_sse2 1
 INIT_XMM sse2
-cglobal interp_4tap_vert_pp_4x2, 4, 6, 8
-
+cglobal interp_4tap_vert_%1_4x2, 4, 6, 8
     mov         r4d,       r4m
     sub         r0,        r1
     pxor        m7,        m7
@@ -1079,6 +1079,8 @@
     pshuflw     m5,        m3,        q2301
     pshufhw     m5,        m5,        q2301
     paddw       m3,        m5
+
+%ifidn %1, pp
     psrld       m2,        16
     psrld       m3,        16
     packssdw    m2,        m3
@@ -1090,7 +1092,23 @@
     movd        [r2],      m2
     psrldq      m2,        4
     movd        [r2 + r3], m2
-    RET
+%elifidn %1, ps
+    psrldq      m2,        2
+    psrldq      m3,        2
+    pshufd      m2,        m2, q3120
+    pshufd      m3,        m3, q3120
+
+    psubw       m2,        [pw_2000]
+    psubw       m3,        [pw_2000]
+    movh        [r2],      m2
+    movh        [r2 + r3 * 2], m3
+%endif
+    RET
+
+%endmacro
+
+    FILTER_V2_W4_H4_sse2 pp
+    FILTER_V2_W4_H4_sse2 ps
 
 ;-----------------------------------------------------------------------------
 ; void interp_4tap_vert_pp_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
diff -r 16ec21931167 -r 54423715e7a2 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Mon May 18 16:00:59 2015 -0700
+++ b/source/common/x86/ipfilter8.h	Mon May 18 16:07:30 2015 -0700
@@ -916,6 +916,7 @@
 void x265_interp_4tap_vert_ps_2x4_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
 void x265_interp_4tap_vert_ps_2x8_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
 void x265_interp_4tap_vert_ps_2x16_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_ps_4x2_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
 #ifdef X86_64
 void x265_interp_4tap_vert_pp_6x8_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
 void x265_interp_4tap_vert_pp_6x16_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);


More information about the x265-devel mailing list