[x265] [PATCH 3 of 9] asm: intrapred dc16 sse2 high bit
dtyx265 at gmail.com
dtyx265 at gmail.com
Fri Mar 6 01:19:56 CET 2015
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1425592488 28800
# Node ID c5fa433ffda0a95889e99f4df787f3edc5880d0f
# Parent 3b2512cba57e1af6ba21c445122a2b5b2efd87dc
asm: intrapred dc16 sse2 high bit
This replaces c code for systems using ssse3 to sse2 processors
The code is backported from intrapred dc16 sse4 high bit
./test/TestBench --testbench intrapred | grep intra_dc_16x16
intra_dc_16x16[f=0] 2.55x 1022.78 2607.93
intra_dc_16x16[f=1] 2.57x 1510.13 3887.95
diff -r 3b2512cba57e -r c5fa433ffda0 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Thu Mar 05 12:45:55 2015 -0800
+++ b/source/common/x86/asm-primitives.cpp Thu Mar 05 13:54:48 2015 -0800
@@ -870,6 +870,7 @@
p.cu[BLOCK_4x4].intra_pred[DC_IDX] = x265_intra_pred_dc4_sse2;
p.cu[BLOCK_8x8].intra_pred[DC_IDX] = x265_intra_pred_dc8_sse2;
+ p.cu[BLOCK_16x16].intra_pred[DC_IDX] = x265_intra_pred_dc16_sse2;
p.cu[BLOCK_4x4].intra_pred[PLANAR_IDX] = x265_intra_pred_planar4_sse2;
diff -r 3b2512cba57e -r c5fa433ffda0 source/common/x86/intrapred16.asm
--- a/source/common/x86/intrapred16.asm Thu Mar 05 12:45:55 2015 -0800
+++ b/source/common/x86/intrapred16.asm Thu Mar 05 13:54:48 2015 -0800
@@ -241,6 +241,145 @@
.end:
RET
+;-------------------------------------------------------------------------------------------------------
+; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* left, pixel* above, int dirMode, int filter)
+;-------------------------------------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal intra_pred_dc16, 5, 10, 4
+ lea r3, [r2 + 66]
+ add r1, r1
+ movu m0, [r3]
+ movu m1, [r3 + 16]
+ movu m2, [r2 + 2]
+ movu m3, [r2 + 18]
+
+ paddw m0, m1
+ paddw m2, m3
+ paddw m0, m2
+ movhlps m1, m0
+ paddw m0, m1
+ pshuflw m1, m0, 0x6E
+ paddw m0, m1
+ pmaddwd m0, [pw_1]
+
+ paddw m0, [pw_16]
+ psraw m0, 5
+ movd r5d, m0
+ pshuflw m0, m0, 0 ; m0 = word [dc_val ...]
+ pshufd m0, m0, 0
+
+ test r4d, r4d
+
+ ; store DC 16x16
+ lea r6, [r1 + r1 * 2] ;index 3
+ lea r7, [r1 + r1 * 4] ;index 5
+ lea r8, [r6 + r1 * 4] ;index 7
+ lea r9, [r0 + r8] ;base + 7
+ movu [r0], m0
+ movu [r0 + 16], m0
+ movu [r0 + r1], m0
+ movu [r0 + 16 + r1], m0
+ movu [r0 + r1 * 2], m0
+ movu [r0 + r1 * 2 + 16], m0
+ movu [r0 + r6], m0
+ movu [r0 + r6 + 16], m0
+ movu [r0 + r1 * 4], m0
+ movu [r0 + r1 * 4 + 16], m0
+ movu [r0 + r7], m0
+ movu [r0 + r7 + 16], m0
+ movu [r0 + r6 * 2], m0
+ movu [r0 + r6 * 2 + 16], m0
+ movu [r9], m0
+ movu [r9 + 16], m0
+ movu [r0 + r1 * 8], m0
+ movu [r0 + r1 * 8 + 16], m0
+ movu [r9 + r1 * 2], m0
+ movu [r9 + r1 * 2 + 16], m0
+ movu [r0 + r7 * 2], m0
+ movu [r0 + r7 * 2 + 16], m0
+ movu [r9 + r1 * 4], m0
+ movu [r9 + r1 * 4 + 16], m0
+ movu [r0 + r6 * 4], m0
+ movu [r0 + r6 * 4 + 16], m0
+ movu [r9 + r6 * 2], m0
+ movu [r9 + r6 * 2 + 16], m0
+ movu [r9 + r8], m0
+ movu [r9 + r8 + 16], m0
+ movu [r9 + r1 * 8], m0
+ movu [r9 + r1 * 8 + 16], m0
+
+ ; Do DC Filter
+ jz .end
+ mova m1, [pw_2]
+ pmullw m1, m0
+ paddw m1, [pw_2]
+ movd r4d, m1
+ paddw m1, m0
+
+ ; filter top
+ movu m2, [r2 + 2]
+ paddw m2, m1
+ psraw m2, 2
+ movu [r0], m2
+ movu m3, [r2 + 18]
+ paddw m3, m1
+ psraw m3, 2
+ movu [r0 + 16], m3
+
+ ; filter top-left
+ movzx r4d, r4w
+ movzx r5d, word [r3]
+ add r4d, r5d
+ movzx r5d, word [r2 + 2]
+ add r5d, r4d
+ shr r5d, 2
+ mov [r0], r5w
+
+ ; filter left
+ movu m2, [r3 + 2]
+ paddw m2, m1
+ psraw m2, 2
+
+ movq r2, m2
+ pshufd m2, m2, 0xEE
+ mov [r0 + r1], r2w
+ shr r2, 16
+ mov [r0 + r1 * 2], r2w
+ shr r2, 16
+ mov [r0 + r6], r2w
+ shr r2, 16
+ mov [r0 + r1 * 4], r2w
+ movq r2, m2
+ mov [r0 + r7], r2w
+ shr r2, 16
+ mov [r0 + r6 * 2], r2w
+ shr r2, 16
+ mov [r9], r2w
+ shr r2, 16
+ mov [r0 + r1 * 8], r2w
+
+ movu m3, [r3 + 18]
+ paddw m3, m1
+ psraw m3, 2
+
+ movq r3, m3
+ pshufd m3, m3, 0xEE
+ mov [r9 + r1 * 2], r3w
+ shr r3, 16
+ mov [r0 + r7 * 2], r3w
+ shr r3, 16
+ mov [r9 + r1 * 4], r3w
+ shr r3, 16
+ mov [r0 + r6 * 4], r3w
+ movq r3, m3
+ mov [r9 + r6 * 2], r3w
+ shr r3, 16
+ mov [r9 + r8], r3w
+ shr r3, 16
+ mov [r9 + r1 * 8], r3w
+.end:
+ RET
+
;-----------------------------------------------------------------------------------
; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* above, int, int filter)
;-----------------------------------------------------------------------------------
More information about the x265-devel
mailing list