[x265] [PATCH 27 of 29] intrapred: updated asm code for intra_ang_4x4 mode 2 to 34
dnyaneshwar at multicorewareinc.com
dnyaneshwar at multicorewareinc.com
Tue Jan 13 08:11:35 CET 2015
# HG changeset patch
# User Aasaipriya <aasaipriya at multicorewareinc.com>
# Date 1420780470 -19800
# Fri Jan 09 10:44:30 2015 +0530
# Node ID 36a918aff53652e0a5d47e9527a42ec1c673b1e7
# Parent cefe5fd25fe6435445ba1606e39075c4d439c97f
intrapred: updated asm code for intra_ang_4x4 mode 2 to 34
diff -r cefe5fd25fe6 -r 36a918aff536 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Tue Jan 13 10:34:46 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp Fri Jan 09 10:44:30 2015 +0530
@@ -949,6 +949,7 @@
p.intra_pred[mode][BLOCK_4x4] = x265_intra_pred_ang4_ ## fno ## _ ## cpu; \
#define SETUP_INTRA_ANG_COMMON_NEW(mode, fno, cpu) \
+ p.intra_pred_new[mode][BLOCK_4x4] = x265_intra_pred_ang4_ ## fno ## _new_ ## cpu; \
p.intra_pred_new[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _new_ ## cpu; \
p.intra_pred_new[mode][BLOCK_16x16] = x265_intra_pred_ang16_ ## fno ## _new_ ## cpu; \
p.intra_pred_new[mode][BLOCK_32x32] = x265_intra_pred_ang32_ ## fno ## _new_ ## cpu;
@@ -969,6 +970,7 @@
p.intra_pred[mode][BLOCK_4x4] = x265_intra_pred_ang4_ ## fno ## _ ## cpu; \
#define SETUP_INTRA_ANG4_8_NEW(mode, fno, cpu) \
+ p.intra_pred_new[mode][BLOCK_4x4] = x265_intra_pred_ang4_ ## fno ## _new_ ## cpu; \
p.intra_pred_new[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _new_ ## cpu;
#define INTRA_ANG_SSSE3(cpu) \
diff -r cefe5fd25fe6 -r 36a918aff536 source/common/x86/intrapred8.asm
--- a/source/common/x86/intrapred8.asm Tue Jan 13 10:34:46 2015 +0530
+++ b/source/common/x86/intrapred8.asm Fri Jan 09 10:44:30 2015 +0530
@@ -1121,6 +1121,456 @@
psrldq m0, 1
movd [r0], m0
RET
+
+;-----------------------------------------------------------------------------------------
+; void intraPredAng4(pixel* dst, intptr_t dstStride, pixel* src, int dirMode, int bFilter)
+;-----------------------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal intra_pred_ang4_2_new, 3,5,4
+ lea r4, [r2 + 2]
+ add r2, 10
+ cmp r3m, byte 34
+ cmove r2, r4
+
+ movh m0, [r2]
+ movd [r0], m0
+ palignr m1, m0, 1
+ movd [r0 + r1], m1
+ palignr m2, m0, 2
+ movd [r0 + r1 * 2], m2
+ lea r1, [r1 * 3]
+ psrldq m0, 3
+ movd [r0 + r1], m0
+ RET
+
+INIT_XMM sse4
+cglobal intra_pred_ang4_3_new, 3,5,5
+ mov r4, 1
+ cmp r3m, byte 33
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ palignr m1, m0, 2 ; [x x x x x x x x 6 5 5 4 4 3 3 2]
+ palignr m2, m0, 4 ; [x x x x x x x x 7 6 6 5 5 4 4 3]
+ palignr m3, m0, 6 ; [x x x x x x x x 8 7 7 6 6 5 5 4]
+ punpcklqdq m0, m1
+ punpcklqdq m2, m3
+
+ lea r3, [ang_table + 20 * 16]
+ movh m3, [r3 + 6 * 16] ; [26]
+ movhps m3, [r3] ; [20]
+ movh m4, [r3 - 6 * 16] ; [14]
+ movhps m4, [r3 - 12 * 16] ; [ 8]
+ jmp .do_filter4x4
+
+ ; NOTE: share path, input is m0=[1 0], m2=[3 2], m3,m4=coef, flag_z=no_transpose
+ALIGN 16
+.do_filter4x4:
+ mova m1, [pw_1024]
+
+ pmaddubsw m0, m3
+ pmulhrsw m0, m1
+ pmaddubsw m2, m4
+ pmulhrsw m2, m1
+ packuswb m0, m2
+
+ ; NOTE: mode 33 doesn't reorde, UNSAFE but I don't use any instruction that affect eflag register before
+ jz .store
+
+ ; transpose 4x4
+ pshufb m0, [c_trans_4x4]
+
+.store:
+ ; TODO: use pextrd here after intrinsic ssse3 removed
+ movd [r0], m0
+ pextrd [r0 + r1], m0, 1
+ pextrd [r0 + r1 * 2], m0, 2
+ lea r1, [r1 * 3]
+ pextrd [r0 + r1], m0, 3
+ RET
+
+cglobal intra_pred_ang4_4_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 32
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ palignr m1, m0, 2 ; [x x x x x x x x 6 5 5 4 4 3 3 2]
+ palignr m3, m0, 4 ; [x x x x x x x x 7 6 6 5 5 4 4 3]
+ punpcklqdq m0, m1
+ punpcklqdq m2, m1, m3
+
+ lea r3, [ang_table + 18 * 16]
+ movh m3, [r3 + 3 * 16] ; [21]
+ movhps m3, [r3 - 8 * 16] ; [10]
+ movh m4, [r3 + 13 * 16] ; [31]
+ movhps m4, [r3 + 2 * 16] ; [20]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_5_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 31
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ palignr m1, m0, 2 ; [x x x x x x x x 6 5 5 4 4 3 3 2]
+ palignr m3, m0, 4 ; [x x x x x x x x 7 6 6 5 5 4 4 3]
+ punpcklqdq m0, m1
+ punpcklqdq m2, m1, m3
+
+ lea r3, [ang_table + 10 * 16]
+ movh m3, [r3 + 7 * 16] ; [17]
+ movhps m3, [r3 - 8 * 16] ; [ 2]
+ movh m4, [r3 + 9 * 16] ; [19]
+ movhps m4, [r3 - 6 * 16] ; [ 4]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_6_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 30
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ palignr m2, m0, 2 ; [x x x x x x x x 6 5 5 4 4 3 3 2]
+ punpcklqdq m0, m0
+ punpcklqdq m2, m2
+
+ lea r3, [ang_table + 19 * 16]
+ movh m3, [r3 - 6 * 16] ; [13]
+ movhps m3, [r3 + 7 * 16] ; [26]
+ movh m4, [r3 - 12 * 16] ; [ 7]
+ movhps m4, [r3 + 1 * 16] ; [20]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_7_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 29
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ palignr m3, m0, 2 ; [x x x x x x x x 6 5 5 4 4 3 3 2]
+ punpcklqdq m2, m0, m3
+ punpcklqdq m0, m0
+
+ lea r3, [ang_table + 20 * 16]
+ movh m3, [r3 - 11 * 16] ; [ 9]
+ movhps m3, [r3 - 2 * 16] ; [18]
+ movh m4, [r3 + 7 * 16] ; [27]
+ movhps m4, [r3 - 16 * 16] ; [ 4]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_8_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 28
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ punpcklqdq m0, m0
+ mova m2, m0
+
+ lea r3, [ang_table + 13 * 16]
+ movh m3, [r3 - 8 * 16] ; [ 5]
+ movhps m3, [r3 - 3 * 16] ; [10]
+ movh m4, [r3 + 2 * 16] ; [15]
+ movhps m4, [r3 + 7 * 16] ; [20]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_9_new, 3,5,5
+ xor r4, r4
+ inc r4
+ cmp r3m, byte 27
+ mov r3, 9
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [8 7 6 5 4 3 2 1]
+ palignr m1, m0, 1 ; [x 8 7 6 5 4 3 2]
+ punpcklbw m0, m1 ; [x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+ punpcklqdq m0, m0
+ mova m2, m0
+
+ lea r3, [ang_table + 4 * 16]
+ movh m3, [r3 - 2 * 16] ; [ 2]
+ movhps m3, [r3 - 0 * 16] ; [ 4]
+ movh m4, [r3 + 2 * 16] ; [ 6]
+ movhps m4, [r3 + 4 * 16] ; [ 8]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_10_new, 3,3,4
+ movd m0, [r2 + 9] ; [8 7 6 5 4 3 2 1]
+ pshufb m0, [pb_unpackbd1]
+ pshufd m1, m0, 1
+ movhlps m2, m0
+ pshufd m3, m0, 3
+ movd [r0 + r1], m1
+ movd [r0 + r1 * 2], m2
+ lea r1, [r1 * 3]
+ movd [r0 + r1], m3
+ cmp r4m, byte 0
+ jz .quit
+
+ ; filter
+ pmovzxbw m0, m0 ; [-1 -1 -1 -1]
+ movh m1, [r2] ; [4 3 2 1 0]
+ pshufb m2, m1, [pb_0_8] ; [0 0 0 0]
+ pshufb m1, [pb_unpackbw1] ; [4 3 2 1]
+ psubw m1, m2
+ psraw m1, 1
+ paddw m0, m1
+ packuswb m0, m0
+.quit:
+ movd [r0], m0
+ RET
+
+INIT_XMM sse4
+cglobal intra_pred_ang4_26_new, 3,4,3
+ movd m0, [r2 + 1] ; [8 7 6 5 4 3 2 1]
+
+ ; store
+ movd [r0], m0
+ movd [r0 + r1], m0
+ movd [r0 + r1 * 2], m0
+ lea r3, [r1 * 3]
+ movd [r0 + r3], m0
+
+ ; filter
+ cmp r4m, byte 0
+ jz .quit
+
+ pshufb m0, [pb_0_8] ; [ 1 1 1 1]
+ movh m1, [r2 + 8] ; [-4 -3 -2 -1 0]
+ pinsrb m1, [r2], 0
+ pshufb m2, m1, [pb_0_8] ; [0 0 0 0]
+ pshufb m1, [pb_unpackbw1] ; [-4 -3 -2 -1]
+ psubw m1, m2
+ psraw m1, 1
+ paddw m0, m1
+ packuswb m0, m0
+
+ pextrb [r0], m0, 0
+ pextrb [r0 + r1], m0, 1
+ pextrb [r0 + r1 * 2], m0, 2
+ pextrb [r0 + r3], m0, 3
+.quit:
+ RET
+
+cglobal intra_pred_ang4_11_new, 3,5,5
+ xor r4, r4
+ cmp r3m, byte 25
+ mov r3, 8
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [x x x 4 3 2 1 0]
+ pinsrb m0, [r2], 0
+ palignr m1, m0, 1 ; [x x x x 4 3 2 1]
+ punpcklbw m0, m1 ; [x x x x x x x x 4 3 3 2 2 1 1 0]
+ punpcklqdq m0, m0
+ mova m2, m0
+
+ lea r3, [ang_table + 24 * 16]
+
+ movh m3, [r3 + 6 * 16] ; [24]
+ movhps m3, [r3 + 4 * 16] ; [26]
+ movh m4, [r3 + 2 * 16] ; [28]
+ movhps m4, [r3 + 0 * 16] ; [30]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_12_new, 3,5,5
+ xor r4, r4
+ cmp r3m, byte 24
+ mov r3, 8
+ cmove r3, r4
+
+ movh m0, [r2 + r3] ; [x x x 4 3 2 1 0]
+ pinsrb m0, [r2], 0
+ palignr m1, m0, 1 ; [x x x x 4 3 2 1]
+ punpcklbw m0, m1 ; [x x x x x x x x 4 3 3 2 2 1 1 0]
+ punpcklqdq m0, m0
+ mova m2, m0
+
+ lea r3, [ang_table + 20 * 16]
+ movh m3, [r3 + 7 * 16] ; [27]
+ movhps m3, [r3 + 2 * 16] ; [22]
+ movh m4, [r3 - 3 * 16] ; [17]
+ movhps m4, [r3 - 8 * 16] ; [12]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_13_new, 4,5,5
+ xor r4, r4
+ cmp r3m, byte 23
+ mov r3, 8
+ jz .next
+ xchg r3, r4
+.next:
+ movh m1, [r2 + r4 - 1] ; [x x 4 3 2 1 0 x]
+ pinsrb m1, [r2], 1
+ palignr m0, m1, 1 ; [x x x 4 3 2 1 0]
+ palignr m2, m1, 2 ; [x x x x 4 3 2 1]
+ pinsrb m1, [r2 + r3 + 4], 0
+ punpcklbw m1, m0 ; [3 2 2 1 1 0 0 x]
+ punpcklbw m0, m2 ; [4 3 3 2 2 1 1 0]
+ punpcklqdq m2, m0, m1
+ punpcklqdq m0, m0
+
+ lea r3, [ang_table + 21 * 16]
+ movh m3, [r3 + 2 * 16] ; [23]
+ movhps m3, [r3 - 7 * 16] ; [14]
+ movh m4, [r3 - 16 * 16] ; [ 5]
+ movhps m4, [r3 + 7 * 16] ; [28]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_14_new, 4,5,5
+ xor r4, r4
+ cmp r3m, byte 22
+ mov r3, 8
+ jz .next
+ xchg r3, r4
+.next:
+ movh m2, [r2 + r4 - 1] ; [x x 4 3 2 1 0 x]
+ pinsrb m2, [r2], 1
+ palignr m0, m2, 1 ; [x x x 4 3 2 1 0]
+ palignr m1, m2, 2 ; [x x x x 4 3 2 1]
+ pinsrb m2, [r2 + r3 + 2], 0
+ punpcklbw m2, m0 ; [3 2 2 1 1 0 0 x]
+ punpcklbw m0, m1 ; [4 3 3 2 2 1 1 0]
+ punpcklqdq m0, m0
+ punpcklqdq m2, m2
+
+ lea r3, [ang_table + 19 * 16]
+ movh m3, [r3 + 0 * 16] ; [19]
+ movhps m3, [r3 - 13 * 16] ; [ 6]
+ movh m4, [r3 + 6 * 16] ; [25]
+ movhps m4, [r3 - 7 * 16] ; [12]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_15_new, 4,5,5
+ xor r4, r4
+ cmp r3m, byte 21
+ mov r3, 8
+ jz .next
+ xchg r3, r4
+.next:
+ movh m2, [r2 + r4 - 1] ; [x x 4 3 2 1 0 x]
+ pinsrb m2, [r2], 1
+ palignr m0, m2, 1 ; [x x x 4 3 2 1 0]
+ palignr m1, m2, 2 ; [x x x x 4 3 2 1]
+ pinsrb m2, [r2 + r3 + 2], 0
+ pslldq m3, m2, 1 ; [x 4 3 2 1 0 x y]
+ pinsrb m3, [r2 + r3 + 4], 0
+ punpcklbw m4, m3, m2 ; [2 1 1 0 0 x x y]
+ punpcklbw m2, m0 ; [3 2 2 1 1 0 0 x]
+ punpcklbw m0, m1 ; [4 3 3 2 2 1 1 0]
+ punpcklqdq m0, m2
+ punpcklqdq m2, m4
+
+ lea r3, [ang_table + 23 * 16]
+ movh m3, [r3 - 8 * 16] ; [15]
+ movhps m3, [r3 + 7 * 16] ; [30]
+ movh m4, [r3 - 10 * 16] ; [13]
+ movhps m4, [r3 + 5 * 16] ; [28]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_16_new, 3,5,5
+ xor r4, r4
+ cmp r3m, byte 20
+ mov r3, 8
+ jz .next
+ xchg r3, r4
+.next:
+ movh m2, [r2 + r4 - 1] ; [x x 4 3 2 1 0 x]
+ pinsrb m2, [r2], 1
+ palignr m0, m2, 1 ; [x x x 4 3 2 1 0]
+ palignr m1, m2, 2 ; [x x x x 4 3 2 1]
+ pinsrb m2, [r2 + r3 + 2], 0
+ pslldq m3, m2, 1 ; [x 4 3 2 1 0 x y]
+ pinsrb m3, [r2 + r3 + 3], 0
+ punpcklbw m4, m3, m2 ; [2 1 1 0 0 x x y]
+ punpcklbw m2, m0 ; [3 2 2 1 1 0 0 x]
+ punpcklbw m0, m1 ; [4 3 3 2 2 1 1 0]
+ punpcklqdq m0, m2
+ punpcklqdq m2, m4
+
+ lea r3, [ang_table + 19 * 16]
+ movh m3, [r3 - 8 * 16] ; [11]
+ movhps m3, [r3 + 3 * 16] ; [22]
+ movh m4, [r3 - 18 * 16] ; [ 1]
+ movhps m4, [r3 - 7 * 16] ; [12]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_17_new, 3,5,5
+ xor r4, r4
+ cmp r3m, byte 19
+ mov r3, 8
+ jz .next
+ xchg r3, r4
+.next:
+ movh m3, [r2 + r4 - 1] ; [- - 4 3 2 1 0 x]
+ pinsrb m3, [r2], 1
+ palignr m0, m3, 1 ; [- - - 4 3 2 1 0]
+ palignr m1, m3, 2 ; [- - - - 4 3 2 1]
+ mova m4, m0
+ punpcklbw m0, m1 ; [4 3 3 2 2 1 1 0]
+ pinsrb m3, [r2 + r3 + 1], 0
+ punpcklbw m1, m3, m4 ; [3 2 2 1 1 0 0 x]
+ punpcklqdq m0, m1
+
+ pslldq m2, m3, 1 ; [- 4 3 2 1 0 x y]
+ pinsrb m2, [r2 + r3 + 2], 0
+ pslldq m1, m2, 1 ; [4 3 2 1 0 x y z]
+ pinsrb m1, [r2 + r3 + 4], 0
+ punpcklbw m1, m2 ; [1 0 0 x x y y z]
+ punpcklbw m2, m3 ; [2 1 1 0 0 x x y]
+ punpcklqdq m2, m1
+
+ lea r3, [ang_table + 14 * 16]
+ movh m3, [r3 - 8 * 16] ; [ 6]
+ movhps m3, [r3 - 2 * 16] ; [12]
+ movh m4, [r3 + 4 * 16] ; [18]
+ movhps m4, [r3 + 10 * 16] ; [24]
+ jmp mangle(private_prefix %+ _ %+ intra_pred_ang4_3_new %+ SUFFIX %+ .do_filter4x4)
+
+cglobal intra_pred_ang4_18_new, 3,5,1
+ mov r4d, [r2 + 8]
+ mov r3b, byte [r2]
+ mov [r2 + 8], r3b
+ mov r3d, [r2 + 8]
+ bswap r3d
+ movd m0, r3d
+
+ pinsrd m0, [r2 + 1], 1 ; [- 3 2 1 0 -1 -2 -3]
+ lea r3, [r1 * 3]
+ movd [r0 + r3], m0
+ psrldq m0, 1
+ movd [r0 + r1 * 2], m0
+ psrldq m0, 1
+ movd [r0 + r1], m0
+ psrldq m0, 1
+ movd [r0], m0
+ mov [r2 + 8], r4w
+ RET
+
;-----------------------------------------------------------------------------------------
; void intraPredAng8(pixel* dst, intptr_t dstStride, pixel* src, int dirMode, int bFilter)
;-----------------------------------------------------------------------------------------
More information about the x265-devel
mailing list