[x265] [PATCH 05 of 12] asm: interp_4tap_vert_ps_8xN sse2
dtyx265 at gmail.com
dtyx265 at gmail.com
Tue May 19 02:24:32 CEST 2015
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431992044 25200
# Node ID e1d6fc3777bca3f72bf04367a345ad91124d0bc5
# Parent 2f44ae6d6250677b87c31ca21a0098e44b19ee98
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.89x 1070.00 4161.10
chroma_vps[ 8x4] 3.24x 997.50 3232.74
chroma_vpp[ 8x6] 3.98x 1547.48 6160.16
chroma_vps[ 8x6] 3.20x 1458.85 4665.57
chroma_vpp[ 8x2] 3.71x 559.99 2077.40
chroma_vps[ 8x2] 3.04x 520.31 1582.48
chroma_vpp[ 8x4] 3.89x 1070.00 4160.32
chroma_vpp[ 8x4] 3.89x 1070.00 4160.64
chroma_vps[ 8x4] 3.24x 997.49 3232.47
diff -r 2f44ae6d6250 -r e1d6fc3777bc source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Mon May 18 16:27:54 2015 -0700
+++ b/source/common/x86/asm-primitives.cpp Mon May 18 16:34:04 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 2f44ae6d6250 -r e1d6fc3777bc source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm Mon May 18 16:27:54 2015 -0700
+++ b/source/common/x86/ipfilter8.asm Mon May 18 16:34:04 2015 -0700
@@ -1475,17 +1475,21 @@
%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]
+%endif
%ifdef PIC
lea r6, [tab_ChromaCoeffV]
@@ -1495,11 +1499,11 @@
mova m6, [tab_ChromaCoeffV + r4]
mova m5, [tab_ChromaCoeffV + r4 + 16]
%endif
+ lea r5, [r0 + 2 * r1]
movq m0, [r0]
movq m1, [r0 + r1]
movq m2, [r0 + 2 * r1]
- lea r5, [r0 + 2 * r1]
movq m3, [r5 + r1]
punpcklbw m0, m1
@@ -1521,10 +1525,15 @@
paddw m0, m7
+%ifidn %1,pp
paddw m0, m4
psraw m0, 6
-
- movq m11, [r0 + 4 * r1]
+%elifidn %1,ps
+ psubw m0, m4
+ movu [r2], m0
+%endif
+
+ movq m11, [r0 + 4 * r1]
punpcklbw m1, m2
punpcklbw m7, m3, m11
@@ -1545,13 +1554,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 + 2 * r3], m1
+%endif
+%if %2 == 2 ;end of 8x2
RET
%else
@@ -1577,10 +1591,15 @@
paddw m2, m7
+%ifidn %1,pp
paddw m2, m4
psraw m2, 6
-
- movq m10, [r6 + 2 * r1]
+%elifidn %1,ps
+ psubw m2, m4
+ movu [r2 + 4 * r3], m2
+%endif
+
+ movq m10, [r6 + 2 * r1]
punpcklbw m3, m11
punpcklbw m7, m1, m10
@@ -1601,29 +1620,35 @@
paddw m3, m7
+%ifidn %1,pp
+ lea r5, [r2 + 2 * r3]
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
+ lea r5, [r2 + 4 * r3]
+ psubw m3, m4
+ movu [r5 + 2 * r3], m3
+%endif
+%if %2 == 4 ;end of 8x4
RET
%else
lea r6, [r6 + 2 * r1]
movq m3, [r6 + r1]
- punpcklbw m11, m1
+ punpcklbw m11, m1
punpcklbw m7, m10, m3
movhlps m8, m11
- punpcklbw m11, m9
- punpcklbw m8, m9
- pmaddwd m11, m6
+ punpcklbw m11, m9
+ punpcklbw m8, m9
+ pmaddwd m11, m6
pmaddwd m8, m6
- packssdw m11, m8
+ packssdw m11, m8
movhlps m8, m7
punpcklbw m7, m9
@@ -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 + 8 * r3], m11
+%endif
movq m7, [r0 + 8 * r1]
@@ -1658,14 +1688,20 @@
paddw m1, m3
+%ifidn %1,pp
+ lea r5, [r2 + 4 * r3]
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
+ lea r5, [r2 + 8 * r3]
+ psubw m1, m4
+ movu [r5 + 2 * r3], m1
+%endif
+%if %2 == 6
RET
%else
@@ -1676,9 +1712,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 2f44ae6d6250 -r e1d6fc3777bc source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h Mon May 18 16:27:54 2015 -0700
+++ b/source/common/x86/ipfilter8.h Mon May 18 16:34:04 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