[x265] [PATCH 1 of 5] asm: interp_4tap_vert_pp sse2
dtyx265 at gmail.com
dtyx265 at gmail.com
Fri May 8 22:57:12 CEST 2015
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1431115282 25200
# Node ID 59e2e1b446e14adc8a7dae184bae9b241cc7a2f1
# Parent 57fce553135247caaafd415458d457d7f8696cd0
asm: interp_4tap_vert_pp sse2
This replaces c code for 2x4, 2x8 and 2x16
64-bit
./test/TestBench --testbench interp | grep vpp
chroma_vpp[ 2x4] 1.80x 644.93 1159.95
chroma_vpp[ 2x8] 1.72x 1204.84 2067.43
chroma_vpp[ 2x16] 1.99x 2252.45 4480.33
32-bit
./test/TestBench --testbench interp | grep vpp
chroma_vpp[ 2x4] 1.80x 822.45 1479.92
chroma_vpp[ 2x8] 1.90x 1477.46 2807.42
chroma_vpp[ 2x16] 2.26x 2770.04 6247.41
diff -r 57fce5531352 -r 59e2e1b446e1 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Thu May 07 14:58:39 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp Fri May 08 13:01:22 2015 -0700
@@ -1370,6 +1370,9 @@
CHROMA_420_VSP_FILTERS(_sse2);
CHROMA_422_VSP_FILTERS(_sse2);
CHROMA_444_VSP_FILTERS(_sse2);
+ p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_vpp = x265_interp_4tap_vert_pp_2x4_sse2;
+ p.chroma[X265_CSP_I420].pu[CHROMA_420_2x8].filter_vpp = x265_interp_4tap_vert_pp_2x8_sse2;
+ p.chroma[X265_CSP_I422].pu[CHROMA_422_2x16].filter_vpp = x265_interp_4tap_vert_pp_2x16_sse2;
ALL_LUMA_PU(luma_hpp, interp_8tap_horiz_pp, sse2);
p.pu[LUMA_4x4].luma_hpp = x265_interp_8tap_horiz_pp_4x4_sse2;
diff -r 57fce5531352 -r 59e2e1b446e1 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm Thu May 07 14:58:39 2015 +0530
+++ b/source/common/x86/ipfilter8.asm Fri May 08 13:01:22 2015 -0700
@@ -1042,6 +1042,135 @@
IPFILTER_LUMA_sse2 64, 16, ps
IPFILTER_LUMA_sse2 16, 64, ps
+%macro WORD_TO_DOUBLE 1
+%if ARCH_X86_64
+ punpcklbw %1, m8
+%else
+ punpcklbw %1, %1
+ psrlw %1, 8
+%endif
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void interp_4tap_vert_pp_2xn(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
+;-----------------------------------------------------------------------------
+%macro FILTER_V4_W2_H4_sse2 1
+INIT_XMM sse2
+%if ARCH_X86_64
+cglobal interp_4tap_vert_pp_2x%1, 4, 6, 9
+ pxor m8, m8
+%else
+cglobal interp_4tap_vert_pp_2x%1, 4, 6, 8
+%endif
+ mov r4d, r4m
+ sub r0, r1
+
+%ifdef PIC
+ lea r5, [tabw_ChromaCoeff]
+ movh m0, [r5 + r4 * 8]
+%else
+ movh m0, [tabw_ChromaCoeff + r4 * 8]
+%endif
+
+ punpcklqdq m0, m0
+ mova m1, [pw_32]
+ lea r5, [3 * r1]
+
+%assign x 1
+%rep %1/4
+ movd m2, [r0]
+ movd m3, [r0 + r1]
+ movd m4, [r0 + 2 * r1]
+ movd m5, [r0 + r5]
+
+ punpcklbw m2, m3
+ punpcklbw m6, m4, m5
+ punpcklwd m2, m6
+
+ WORD_TO_DOUBLE m2
+ pmaddwd m2, m0
+
+ lea r0, [r0 + 4 * r1]
+ movd m6, [r0]
+
+ punpcklbw m3, m4
+ punpcklbw m7, m5, m6
+ punpcklwd m3, m7
+
+ WORD_TO_DOUBLE m3
+ pmaddwd m3, m0
+
+ packssdw m2, m3
+ pshuflw m3, m2, q2301
+ pshufhw m3, m3, q2301
+ paddw m2, m3
+ psrld m2, 16
+
+ movd m7, [r0 + r1]
+
+ punpcklbw m4, m5
+ punpcklbw m3, m6, m7
+ punpcklwd m4, m3
+
+ WORD_TO_DOUBLE m4
+ pmaddwd m4, m0
+
+ movd m3, [r0 + 2 * r1]
+
+ punpcklbw m5, m6
+ punpcklbw m7, m3
+ punpcklwd m5, m7
+
+ WORD_TO_DOUBLE m5
+ pmaddwd m5, m0
+
+ packssdw m4, m5
+ pshuflw m5, m4, q2301
+ pshufhw m5, m5, q2301
+ paddw m4, m5
+ psrld m4, 16
+
+ packssdw m2, m4
+ paddw m2, m1
+ psraw m2, 6
+ packuswb m2, m2
+
+%if ARCH_X86_64
+ movq r4, m2
+ mov [r2], r4w
+ shr r4, 16
+ mov [r2 + r3], r4w
+ lea r2, [r2 + 2 * r3]
+ shr r4, 16
+ mov [r2], r4w
+ shr r4, 16
+ mov [r2 + r3], r4w
+%else
+ movd r4, m2
+ mov [r2], r4w
+ shr r4, 16
+ mov [r2 + r3], r4w
+ lea r2, [r2 + 2 * r3]
+ psrldq m2, 4
+ movd r4, m2
+ mov [r2], r4w
+ shr r4, 16
+ mov [r2 + r3], r4w
+%endif
+
+%if x < %1/4
+ lea r2, [r2 + 2 * r3]
+%endif
+%assign x x+1
+%endrep
+ RET
+
+%endmacro
+
+ FILTER_V4_W2_H4_sse2 4
+ FILTER_V4_W2_H4_sse2 8
+ FILTER_V4_W2_H4_sse2 16
+
;-----------------------------------------------------------------------------
; void interp_4tap_horiz_pp_2x4(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
;-----------------------------------------------------------------------------
diff -r 57fce5531352 -r 59e2e1b446e1 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h Thu May 07 14:58:39 2015 +0530
+++ b/source/common/x86/ipfilter8.h Fri May 08 13:01:22 2015 -0700
@@ -905,6 +905,9 @@
void x265_interp_8tap_horiz_ps_64x48_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx, int isRowExt);
void x265_interp_8tap_horiz_ps_64x64_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx, int isRowExt);
void x265_interp_8tap_hv_pp_8x8_sse3(const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY);
+void x265_interp_4tap_vert_pp_2x4_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_pp_2x8_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
+void x265_interp_4tap_vert_pp_2x16_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
#undef LUMA_FILTERS
#undef LUMA_SP_FILTERS
#undef LUMA_SS_FILTERS
More information about the x265-devel
mailing list