<div dir="ltr"><div>Min, <br><br></div>Can you update your patches to the tip and re-send? <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 22, 2015 at 6:49 AM, Min Chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Min Chen <<a href="mailto:chenm003@163.com">chenm003@163.com</a>><br>
# Date 1440204616 25200<br>
# Node ID 6ad08d8288099fe11f2f518e54194c02b7a36020<br>
# Parent 9bbcc4a622f25aeead11efd8cac82cabbf413d62<br>
asm: re-design AVX2 algorithm for intra_pred_8x8[20], 246c -> 194c<br>
---<br>
source/common/x86/asm-primitives.cpp | 2 +-<br>
source/common/x86/intrapred8.asm | 78 +++++++++++++++++++++++++++++++---<br>
2 files changed, 72 insertions(+), 8 deletions(-)<br>
<br>
diff -r 9bbcc4a622f2 -r 6ad08d828809 source/common/x86/asm-primitives.cpp<br>
--- a/source/common/x86/asm-primitives.cpp Fri Aug 21 15:05:47 2015 -0700<br>
+++ b/source/common/x86/asm-primitives.cpp Fri Aug 21 17:50:16 2015 -0700<br>
@@ -3664,6 +3664,7 @@<br>
p.planeClipAndMax = PFX(planeClipAndMax_avx2);<br>
<br>
/* The following primitives have been disabled since performance compared to SSE is negligible/negative */<br>
+ <a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_8x8].intra_pred[20] = PFX(intra_pred_ang8_20_avx2);<br>
#if 0<br>
p.pu[LUMA_8x4].addAvg = PFX(addAvg_8x4_avx2);<br>
p.pu[LUMA_8x8].addAvg = PFX(addAvg_8x8_avx2);<br>
@@ -3687,7 +3688,6 @@<br>
<a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_4x4].cpy1Dto2D_shl = PFX(cpy1Dto2D_shl_4_avx2);<br>
<a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_4x4].cpy1Dto2D_shr = PFX(cpy1Dto2D_shr_4_avx2);<br>
<a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_4x4].count_nonzero = PFX(count_nonzero_4x4_avx2);<br>
- <a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_8x8].intra_pred[20] = PFX(intra_pred_ang8_20_avx2);<br>
<a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_16x16].intra_pred[13] = PFX(intra_pred_ang16_13_avx2);<br>
<a href="http://p.cu" rel="noreferrer" target="_blank">p.cu</a>[BLOCK_16x16].copy_sp = PFX(blockcopy_sp_16x16_avx2);<br>
p.chroma[X265_CSP_I420].cu[BLOCK_420_16x16].copy_sp = PFX(blockcopy_sp_16x16_avx2);<br>
diff -r 9bbcc4a622f2 -r 6ad08d828809 source/common/x86/intrapred8.asm<br>
--- a/source/common/x86/intrapred8.asm Fri Aug 21 15:05:47 2015 -0700<br>
+++ b/source/common/x86/intrapred8.asm Fri Aug 21 17:50:16 2015 -0700<br>
@@ -27,7 +27,9 @@<br>
<br>
SECTION_RODATA 32<br>
<br>
-intra_pred_shuff_0_8: times 2 db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8<br>
+const intra_pred_shuff_0_8, times 2 db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8<br>
+ db 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9<br>
+<br>
intra_pred_shuff_15_0: times 2 db 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0<br>
<br>
intra_filter4_shuf0: times 2 db 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13<br>
@@ -461,11 +463,17 @@<br>
<br>
const angHor8_tab_16, db (32-11), 11, (32-22), 22, (32-1 ), 1, (32-12), 12, (32-23), 23, (32- 2), 2, (32-13), 13, (32-24), 24<br>
<br>
-ALIGN 32<br>
-c_ang8_mode_20: db 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 10, 22, 10, 22, 10, 22, 10, 22, 10, 22, 10, 22, 10, 22, 10, 22<br>
- db 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12<br>
- db 9, 23, 9, 23, 9, 23, 9, 23, 9, 23, 9, 23, 9, 23, 9, 23, 30, 2, 30, 2, 30, 2, 30, 2, 30, 2, 30, 2, 30, 2, 30, 2<br>
- db 19, 13, 19, 13, 19, 13, 19, 13, 19, 13, 19, 13, 19, 13, 19, 13, 8, 24, 8, 24, 8, 24, 8, 24, 8, 24, 8, 24, 8, 24, 8, 24<br>
+const c_ang8_mode_20, db 15, 13, 12, 10, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0<br>
+<br>
+; NOTE: this big table improve speed ~10%, if we have broadcast instruction work on high-128bits infuture, we can remove the table<br>
+const angHor8_tab_20, times 8 db (32-24), 24<br>
+ times 8 db (32-13), 13<br>
+ times 8 db (32- 2), 2<br>
+ times 8 db (32-23), 23<br>
+ times 8 db (32-12), 12<br>
+ times 8 db (32- 1), 1<br>
+ times 8 db (32-22), 22<br>
+ times 8 db (32-11), 11<br>
<br>
const angHor_tab_11, db (32-30), 30, (32-28), 28, (32-26), 26, (32-24), 24, (32-22), 22, (32-20), 20, (32-18), 18, (32-16), 16<br>
db (32-14), 14, (32-12), 12, (32-10), 10, (32- 8), 8, (32- 6), 6, (32- 4), 4, (32- 2), 2, (32- 0), 0<br>
@@ -14010,7 +14018,7 @@<br>
lea r3, [r1 * 3]<br>
vbroadcasti128 m0, [angHor8_tab_16] ; m0 = factor<br>
mova m1, [intra_pred8_shuff16] ; m1 = 4 of Row shuffle<br>
- movu m2, [intra_pred8_shuff16 + 8] ; m1 = 4 of Row shuffle<br>
+ movu m2, [intra_pred8_shuff16 + 8] ; m2 = 4 of Row shuffle<br>
<br>
; prepare reference pixel<br>
movq xm3, [r2 + 16 + 1] ; m3 = [-1 -2 -3 -4 -5 -6 -7 -8 x x x x x x x x]<br>
@@ -14055,6 +14063,61 @@<br>
movhps [r0 + r3], xm5<br>
RET<br>
<br>
+%if 1<br>
+INIT_YMM avx2<br>
+cglobal intra_pred_ang8_20, 3,5,6<br>
+ lea r0, [r0 + r1 * 8]<br>
+ sub r0, r1<br>
+ neg r1<br>
+ lea r3, [angHor8_tab_20]<br>
+ lea r4, [r1 * 3]<br>
+ movu m5, [intra_pred_shuff_0_8 + 16]<br>
+<br>
+ ; prepare reference pixel<br>
+ movq xm1, [r2 + 1] ; m3 = [ 1 2 3 4 5 6 7 8 x x x x x x x x]<br>
+ movhps xm1, [r2 + 16 + 2] ; m3 = [ 1 2 3 4 5 6 7 8 -2 -3 x -5 -6 x -8 x]<br>
+ palignr xm1, xm1, [r2 - 15], 15 ; m3 = [ 0 1 2 3 4 5 6 7 8 -2 -3 x -5 -6 x -8]<br>
+ pshufb xm1, [c_ang8_mode_20]<br>
+ vinserti128 m1, m1, xm1, 1<br>
+<br>
+ ; process 4 rows<br>
+ pshufb m3, m1, m5<br>
+ psrldq m1, 2<br>
+ pmaddubsw m3, [r3 + 0 * 16]<br>
+ pmulhrsw m3, [pw_1024]<br>
+<br>
+ pshufb m4, m1, [intra_pred_shuff_0_8]<br>
+ psrldq m1, 1<br>
+ pmaddubsw m4, [r3 + 2 * 16]<br>
+ pmulhrsw m4, [pw_1024]<br>
+<br>
+ packuswb m3, m4<br>
+ vextracti128 xm4, m3, 1<br>
+ movq [r0], xm3<br>
+ movq [r0 + r1], xm4<br>
+ movhps [r0 + r1 * 2], xm3<br>
+ movhps [r0 + r4], xm4<br>
+<br>
+ ; process 4 rows<br>
+ lea r0, [r0 + r1 * 4]<br>
+ pshufb m3, m1, m5<br>
+ psrldq m1, 1<br>
+ pmaddubsw m3, [r3 + 4 * 16]<br>
+ pmulhrsw m3, [pw_1024]<br>
+<br>
+ pshufb m4, m1, m5<br>
+ pmaddubsw m4, [r3 + 6 * 16]<br>
+ pmulhrsw m4, [pw_1024]<br>
+<br>
+ packuswb m3, m4<br>
+ vextracti128 xm4, m3, 1<br>
+ movq [r0], xm3<br>
+ movq [r0 + r1], xm4<br>
+ movhps [r0 + r1 * 2], xm3<br>
+ movhps [r0 + r4], xm4<br>
+ RET<br>
+<br>
+%else<br>
INIT_YMM avx2<br>
cglobal intra_pred_ang8_20, 3, 6, 6<br>
mova m3, [pw_1024]<br>
@@ -14108,6 +14171,7 @@<br>
movhps [r0 + 2 * r1], xm4<br>
movhps [r0 + r3], xm2<br>
RET<br>
+%endif<br>
<br>
INIT_YMM avx2<br>
cglobal intra_pred_ang8_21, 3, 6, 6<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>