[x265] [PATCH] asm: intrapred dc16 sse2 high bit
dtyx265 at gmail.com
dtyx265 at gmail.com
Mon Mar 2 23:48:38 CET 2015
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1425336406 28800
# Node ID 4641827f98c935603f608425de8c76785aef1114
# Parent 30df8e0058c7ca1fe1a59a7e8bce344071348641
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 16x16
intra_dc_16x16[f=0] 2.53x 1030.01 2607.97
intra_dc_16x16[f=1] 2.57x 1507.50 3877.95
diff -r 30df8e0058c7 -r 4641827f98c9 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Thu Feb 26 21:03:33 2015 -0800
+++ b/source/common/x86/asm-primitives.cpp Mon Mar 02 14:46:46 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].sse_ss = x265_pixel_ssd_ss_4x4_mmx2;
ALL_LUMA_CU(sse_ss, pixel_ssd_ss, sse2);
diff -r 30df8e0058c7 -r 4641827f98c9 source/common/x86/intrapred16.asm
--- a/source/common/x86/intrapred16.asm Thu Feb 26 21:03:33 2015 -0800
+++ b/source/common/x86/intrapred16.asm Mon Mar 02 14:46:46 2015 -0800
@@ -246,6 +246,146 @@
.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 r2, 2
+ add r1, r1
+ movu m0, [r3]
+ movu m1, [r3 + 16]
+ movu m2, [r2]
+ movu m3, [r2 + 16]
+
+ 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]
+ paddw m2, m1
+ psraw m2, 2
+ movu [r0], m2
+ movu m3, [r2 + 16]
+ 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]
+ 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 r2, m3
+ pshufd m3, m3, 0xEE
+ mov [r9 + r1 * 2], r2w
+ shr r2, 16
+ mov [r0 + r7 * 2], r2w
+ shr r2, 16
+ mov [r9 + r1 * 4], r2w
+ shr r2, 16
+ mov [r0 + r6 * 4], r2w
+ movq r2, m3
+ mov [r9 + r6 * 2], r2w
+ shr r2, 16
+ mov [r9 + r8], r2w
+ shr r2, 16
+ mov [r9 + r1 * 8], r2w
+.end:
+ RET
+
;-----------------------------------------------------------------------------------
; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* above, int, int filter)
;-----------------------------------------------------------------------------------
More information about the x265-devel
mailing list