<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;color:#000000"><br></div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername"></b> <span dir="ltr"><<a href="mailto:vignesh@multicorewareinc.com">vignesh@multicorewareinc.com</a>></span><br>Date: Tue, May 2, 2017 at 3:16 PM<br>Subject: [x265] [PATCH 3 of 3] SEA motion search:integralv functions avx2 implementation<br>To: <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br><br><br># HG changeset patch<br>
# User Vignesh Vijayakumar<br>
# Date 1493121121 -19800<br>
# Tue Apr 25 17:22:01 2017 +0530<br>
# Node ID e5ee88d08fcedee83efa63869a5a34<wbr>6c711a0e3d<br>
# Parent 1afc127e62b4502c8f052ee989843c<wbr>64b45ffc56<br>
SEA motion search:integralv functions avx2 implementation<br>
<br>
diff -r 1afc127e62b4 -r e5ee88d08fce source/common/CMakeLists.txt<br>
--- a/source/common/CMakeLists.txt Fri Apr 28 11:22:29 2017 +0530<br>
+++ b/source/common/CMakeLists.txt Tue Apr 25 17:22:01 2017 +0530<br>
@@ -57,10 +57,10 @@<br>
set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES})<br>
source_group(Intrinsics FILES ${VEC_PRIMITIVES})<br>
<br>
- set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h loopfilter.h)<br>
+ set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h loopfilter.h seaintegral.h)<br>
set(A_SRCS pixel-a.asm const-a.asm cpu-a.asm ssd-a.asm mc-a.asm<br>
mc-a2.asm pixel-util8.asm blockcopy8.asm<br>
- pixeladd8.asm dct8.asm)<br>
+ pixeladd8.asm dct8.asm seaintegral.asm)<br>
if(HIGH_BIT_DEPTH)<br>
set(A_SRCS ${A_SRCS} sad16-a.asm intrapred16.asm ipfilter16.asm loopfilter.asm)<br>
else()<br>
diff -r 1afc127e62b4 -r e5ee88d08fce source/common/x86/asm-<wbr>primitives.cpp<br>
--- a/source/common/x86/asm-<wbr>primitives.cpp Fri Apr 28 11:22:29 2017 +0530<br>
+++ b/source/common/x86/asm-<wbr>primitives.cpp Tue Apr 25 17:22:01 2017 +0530<br>
@@ -2158,6 +2158,13 @@<br>
p.fix8Unpack = PFX(cutree_fix8_unpack_avx2);<br>
p.fix8Pack = PFX(cutree_fix8_pack_avx2);<br>
<br>
+ p.integral_init4v = PFX(integral4v_avx2);<br>
+ p.integral_init8v = PFX(integral8v_avx2);<br>
+ p.integral_init12v = PFX(integral12v_avx2);<br>
+ p.integral_init16v = PFX(integral16v_avx2);<br>
+ p.integral_init24v = PFX(integral24v_avx2);<br>
+ p.integral_init32v = PFX(integral32v_avx2);<br>
+<br>
/* TODO: This kernel needs to be modified to work with HIGH_BIT_DEPTH only<br>
p.planeClipAndMax = PFX(planeClipAndMax_avx2); */<br>
<br>
@@ -2178,6 +2185,7 @@<br>
p.costCoeffNxN = PFX(costCoeffNxN_avx2_bmi2);<br>
}<br>
}<br>
+<br>
}<br>
#else // if HIGH_BIT_DEPTH<br>
<br>
@@ -3696,6 +3704,13 @@<br>
p.fix8Unpack = PFX(cutree_fix8_unpack_avx2);<br>
p.fix8Pack = PFX(cutree_fix8_pack_avx2);<br>
<br>
+ p.integral_init4v = PFX(integral4v_avx2);<br>
+ p.integral_init8v = PFX(integral8v_avx2);<br>
+ p.integral_init12v = PFX(integral12v_avx2);<br>
+ p.integral_init16v = PFX(integral16v_avx2);<br>
+ p.integral_init24v = PFX(integral24v_avx2);<br>
+ p.integral_init32v = PFX(integral32v_avx2);<br>
+<br>
}<br>
#endif<br>
}<br>
diff -r 1afc127e62b4 -r e5ee88d08fce source/common/x86/seaintegral.<wbr>asm<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/common/x86/<wbr>seaintegral.asm Tue Apr 25 17:22:01 2017 +0530<br>
@@ -0,0 +1,155 @@<br>
+;****************************<wbr>******************************<wbr>*******************<br>
+;* Copyright (C) 2013-2017 MulticoreWare, Inc<br>
+;*<br>
+;* Authors: Jayashri Murugan <<a href="mailto:jayashri@multicorewareinc.com">jayashri@multicorewareinc.com</a><wbr>><br>
+;* Vignesh V Menon <<a href="mailto:vignesh@multicorewareinc.com">vignesh@multicorewareinc.com</a>><br>
+;*<br>
+;* This program is free software; you can redistribute it and/or modify<br>
+;* it under the terms of the GNU General Public License as published by<br>
+;* the Free Software Foundation; either version 2 of the License, or<br>
+;* (at your option) any later version.<br>
+;*<br>
+;* This program is distributed in the hope that it will be useful,<br>
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+;* GNU General Public License for more details.<br>
+;*<br>
+;* You should have received a copy of the GNU General Public License<br>
+;* along with this program; if not, write to the Free Software<br>
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>
+;*<br>
+;* This program is also available under a commercial proprietary license.<br>
+;* For more information, contact us at license @ <a href="http://x265.com" rel="noreferrer" target="_blank">x265.com</a>.<br>
+;****************************<wbr>******************************<wbr>*******************/<br>
+<br>
+%include "x86inc.asm"<br>
+%include "x86util.asm"<br>
+<br>
+SECTION .text<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init4v_c(uint32_t *sum4, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral4v, 2, 4, 2<br>
+<br>
+ mov r2, 0</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_default" style="font-family:georgia,serif;color:rgb(0,0,0)">xor will be faster method of clearing a register.</div><br></div><div class="gmail_quote"><br>
+ mov r3, r1</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_default" style="font-family:georgia,serif;color:rgb(0,0,0)">What are possible values of stride here, is it random number or multiple of a specific number?</div><br></div><div class="gmail_quote"><br>
+ shl r3, 4<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init8v_c(uint32_t *sum8, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral8v, 2, 4, 2<br>
+ mov r2, 0<br>
+ mov r3, r1<br>
+ shl r3, 5<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init12v_c(uint32_t *sum12, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral12v, 2, 5, 2<br>
+ mov r2, 0<br>
+ mov r3, r1<br>
+ mov r4, r1<br>
+ shl r3, 5<br>
+ shl r4, 4<br>
+ add r3, r4<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init16v_c(uint32_t *sum16, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral16v, 2, 4, 2<br>
+ mov r2, 0<br>
+ mov r3, r1<br>
+ shl r3, 6<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init24v_c(uint32_t *sum24, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral24v, 2, 5, 2<br>
+ mov r2, 0<br>
+ mov r3, r1<br>
+ mov r4, r1<br>
+ shl r3, 6<br>
+ shl r4, 5<br>
+ add r3, r4<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
+<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+;void integral_init32v_c(uint32_t *sum32, intptr_t stride)<br>
+;----------------------------<wbr>------------------------------<wbr>-------------------<br>
+INIT_YMM avx2<br>
+cglobal integral32v, 2, 4, 2<br>
+ mov r2, 0<br>
+ mov r3, r1<br>
+ shl r3, 7<br>
+<br>
+.loop:<br>
+ movu m0, [r0]<br>
+ movu m1, [r0 + r3]<br>
+ psubd m0, m1, m0<br>
+ movu [r0], m0<br>
+ add r2, 8<br>
+ add r0, 32<br>
+ cmp r2, r1<br>
+ jl .loop<br>
+ RET<br>
<br>______________________________<wbr>_________________<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/<wbr>listinfo/x265-devel</a><br>
<br></div><br></div>