[x265] [PATCH 05 of 12] asm: interp_4tap_vert_ps_8xN sse2

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


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431913291 25200
# Node ID 4018cf6354c4524ec0d0409ade3de01e19f92364
# Parent  5e00387a0130682e7467649bb6b25c0d11a88343
asm: interp_4tap_vert_ps_8xN sse2

Converted vert_pp_8xN 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 " 8x"
chroma_vpp[  8x4]	3.87x 	 1075.00  	 4161.23
chroma_vps[  8x4]	3.25x 	 995.00   	 3232.74
chroma_vpp[  8x6]	3.97x 	 1549.98  	 6160.32
chroma_vps[  8x6]	3.22x 	 1457.48  	 4693.99
chroma_vpp[  8x2]	3.71x 	 560.00   	 2077.48
chroma_vps[  8x2]	3.01x 	 525.00   	 1582.45
chroma_vpp[  8x4]	3.93x 	 1057.50  	 4160.76
chroma_vpp[  8x4]	3.87x 	 1075.00  	 4160.94
chroma_vps[  8x4]	3.21x 	 1007.50  	 3232.90

diff -r 5e00387a0130 -r 4018cf6354c4 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Sun May 17 18:33:34 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp	Sun May 17 18:41:31 2015 -0700
@@ -1521,7 +1521,11 @@
         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_I420].pu[CHROMA_420_8x2].filter_vps = x265_interp_4tap_vert_ps_8x2_sse2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].filter_vps = x265_interp_4tap_vert_ps_8x4_sse2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x6].filter_vps = x265_interp_4tap_vert_ps_8x6_sse2;
         p.chroma[X265_CSP_I422].pu[CHROMA_422_6x16].filter_vps = x265_interp_4tap_vert_ps_6x16_sse2;
+        p.chroma[X265_CSP_I444].pu[LUMA_8x4].filter_vps = x265_interp_4tap_vert_ps_8x4_sse2;
 #endif
 
         ALL_LUMA_PU(luma_hpp, interp_8tap_horiz_pp, sse2);
diff -r 5e00387a0130 -r 4018cf6354c4 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Sun May 17 18:33:34 2015 -0700
+++ b/source/common/x86/ipfilter8.asm	Sun May 17 18:41:31 2015 -0700
@@ -1475,17 +1475,22 @@
 %endif
 
 ;-----------------------------------------------------------------------------
-; void interp_4tap_vert_pp_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
-;-----------------------------------------------------------------------------
-%macro FILTER_V4_W8_sse2 1
+; void interp_4tap_vert_%1_8x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
+;-----------------------------------------------------------------------------
+%macro FILTER_V4_W8_sse2 2
 INIT_XMM sse2
-cglobal interp_4tap_vert_pp_8x%1, 4, 7, 12
-
+cglobal interp_4tap_vert_%1_8x%2, 4, 7, 12
     mov         r4d,       r4m
     sub         r0,        r1
     shl         r4d,       5
     pxor        m9,        m9
+
+%ifidn %1,pp
     mova        m4,        [pw_32]
+%elifidn %1,ps
+    mova        m4,        [pw_2000]
+    add         r3d,       r3d
+%endif
 
 %ifdef PIC
     lea         r6,        [tab_ChromaCoeffV]
@@ -1521,8 +1526,13 @@
 
     paddw       m0,        m7
 
+%ifidn %1,pp
     paddw       m0,        m4
     psraw       m0,        6
+%elifidn %1,ps
+    psubw       m0,        m4
+    movu        [r2],      m0
+%endif
 
     movq        m11,        [r0 + 4 * r1]
 
@@ -1545,13 +1555,18 @@
 
     paddw       m1,        m7
 
+%ifidn %1,pp
     paddw       m1,        m4
     psraw       m1,        6
     packuswb    m1,        m0
 
     movhps      [r2],      m1
     movh        [r2 + r3], m1
-%if %1 == 2     ;end of 8x2
+%elifidn %1,ps
+    psubw       m1,        m4
+    movu        [r2 + r3], m1
+%endif
+%if %2 == 2     ;end of 8x2
     RET
 
 %else
@@ -1577,8 +1592,13 @@
 
     paddw       m2,        m7
 
+%ifidn %1,pp
     paddw       m2,        m4
     psraw       m2,        6
+%elifidn %1,ps
+    psubw       m2,        m4
+    movu        [r2 + 2 * r3], m2
+%endif
 
     movq        m10,        [r6 + 2 * r1]
 
@@ -1600,15 +1620,20 @@
     packssdw    m7,        m8
 
     paddw       m3,        m7
-
+    lea         r5,        [r2 + 2 * r3]
+
+%ifidn %1,pp
     paddw       m3,        m4
     psraw       m3,        6
     packuswb    m3,        m2
 
     movhps      [r2 + 2 * r3], m3
-    lea         r5,        [r2 + 2 * r3]
     movh        [r5 + r3], m3
-%if %1 == 4     ;end of 8x4
+%elifidn %1,ps
+    psubw       m3,        m4
+    movu        [r5 + r3], m3
+%endif
+%if %2 == 4     ;end of 8x4
     RET
 
 %else
@@ -1632,10 +1657,15 @@
     pmaddwd     m8,        m5
     packssdw    m7,        m8
 
-    paddw       m11,        m7
-
-    paddw       m11,        m4
-    psraw       m11,        6
+    paddw       m11,       m7
+
+%ifidn %1, pp
+    paddw       m11,       m4
+    psraw       m11,       6
+%elifidn %1,ps
+    psubw       m11,       m4
+    movu        [r2 + 4 * r3], m11
+%endif
 
     movq        m7,        [r0 + 8 * r1]
 
@@ -1657,15 +1687,20 @@
     packssdw    m3,        m8
 
     paddw       m1,        m3
-
+    lea         r5,        [r2 + 4 * r3]
+
+%ifidn %1,pp
     paddw       m1,        m4
     psraw       m1,        6
     packuswb    m1,        m11
 
     movhps      [r2 + 4 * r3], m1
-    lea         r5,        [r2 + 4 * r3]
     movh        [r5 + r3], m1
-%if %1 == 6
+%elifidn %1,ps
+    psubw       m1,        m4
+    movu        [r5 + r3], m1
+%endif
+%if %2 == 6
     RET
 
 %else
@@ -1676,9 +1711,12 @@
 %endmacro
 
 %if ARCH_X86_64
-    FILTER_V4_W8_sse2 2
-    FILTER_V4_W8_sse2 4
-    FILTER_V4_W8_sse2 6
+    FILTER_V4_W8_sse2 pp, 2
+    FILTER_V4_W8_sse2 pp, 4
+    FILTER_V4_W8_sse2 pp, 6
+    FILTER_V4_W8_sse2 ps, 2
+    FILTER_V4_W8_sse2 ps, 4
+    FILTER_V4_W8_sse2 ps, 6
 %endif
 
 ;-----------------------------------------------------------------------------
diff -r 5e00387a0130 -r 4018cf6354c4 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Sun May 17 18:33:34 2015 -0700
+++ b/source/common/x86/ipfilter8.h	Sun May 17 18:41:31 2015 -0700
@@ -956,6 +956,9 @@
 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);
+void x265_interp_4tap_vert_ps_8x2_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_ps_8x4_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_ps_8x6_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