<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 5:53 AM, <span dir="ltr"><<a href="mailto:dnyaneshwar@multicorewareinc.com" target="_blank">dnyaneshwar@multicorewareinc.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 Dnyaneshwar Gorade <<a href="mailto:dnyaneshwar@multicorewareinc.com">dnyaneshwar@multicorewareinc.com</a>><br>
# Date 1383216695 -19800<br>
# Thu Oct 31 16:21:35 2013 +0530<br>
# Node ID 86ff1a3ec89720a73325148e8ac01ec1dbdab3c2<br>
# Parent 5d6ed411995acd674b838f989385c61039760780<br>
asm: Optimized sad_64xN for better cache performance. Reduced lea instruction by half. Performance gain is average +5x w.r.t. previous asm code.<br></blockquote><div><br></div><div>this one does not apply, but the function already appears to be refactored.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 5d6ed411995a -r 86ff1a3ec897 source/common/x86/sad-a.asm<br>
--- a/source/common/x86/sad-a.asm Thu Oct 31 15:10:34 2013 +0530<br>
+++ b/source/common/x86/sad-a.asm Thu Oct 31 16:21:35 2013 +0530<br>
@@ -329,38 +329,21 @@<br>
paddd m3, m4<br>
paddd m0, m1<br>
paddd m0, m3<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
<br>
- movu m1, [r2]<br>
- movu m2, [r2 + 16]<br>
- movu m3, [r2 + 32]<br>
- movu m4, [r2 + 48]<br>
- psadbw m1, [r0]<br>
- psadbw m2, [r0 + 16]<br>
- psadbw m3, [r0 + 32]<br>
- psadbw m4, [r0 + 48]<br>
+ movu m1, [r2 + r3]<br>
+ movu m2, [r2 + r3 + 16]<br>
+ movu m3, [r2 + r3 + 32]<br>
+ movu m4, [r2 + r3 + 48]<br>
+ psadbw m1, [r0 + r1]<br>
+ psadbw m2, [r0 + r1 + 16]<br>
+ psadbw m3, [r0 + r1 + 32]<br>
+ psadbw m4, [r0 + r1 + 48]<br>
paddd m1, m2<br>
paddd m3, m4<br>
paddd m0, m1<br>
paddd m0, m3<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
- movu m1, [r2]<br>
- movu m2, [r2 + 16]<br>
- movu m3, [r2 + 32]<br>
- movu m4, [r2 + 48]<br>
- psadbw m1, [r0]<br>
- psadbw m2, [r0 + 16]<br>
- psadbw m3, [r0 + 32]<br>
- psadbw m4, [r0 + 48]<br>
- paddd m1, m2<br>
- paddd m3, m4<br>
- paddd m0, m1<br>
- paddd m0, m3<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
+ lea r2, [r2 + 2 * r3]<br>
+ lea r0, [r0 + 2 * r1]<br>
<br>
movu m1, [r2]<br>
movu m2, [r2 + 16]<br>
@@ -375,6 +358,20 @@<br>
paddd m0, m1<br>
paddd m0, m3<br>
<br>
+ movu m1, [r2 + r3]<br>
+ movu m2, [r2 + r3 + 16]<br>
+ movu m3, [r2 + r3 + 32]<br>
+ movu m4, [r2 + r3 + 48]<br>
+ psadbw m1, [r0 + r1]<br>
+ psadbw m2, [r0 + r1 + 16]<br>
+ psadbw m3, [r0 + r1 + 32]<br>
+ psadbw m4, [r0 + r1 + 48]<br>
+ paddd m1, m2<br>
+ paddd m3, m4<br>
+ paddd m0, m1<br>
+ paddd m0, m3<br>
+ lea r2, [r2 + 2 * r3]<br>
+ lea r0, [r0 + 2 * r1]<br>
%endmacro<br>
<br>
%macro SAD_W16 0<br>
@@ -660,20 +657,8 @@<br>
pxor m0, m0<br>
<br>
PROCESS_SAD_64x4<br>
-<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
-<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
-<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
<br>
movhlps m1, m0<br>
@@ -684,27 +669,16 @@<br>
;-----------------------------------------------------------------------------<br>
; int pixel_sad_64x32( uint8_t *, intptr_t, uint8_t *, intptr_t )<br>
;-----------------------------------------------------------------------------<br>
-cglobal pixel_sad_64x32, 4,4,5<br>
+cglobal pixel_sad_64x32, 4,5,5<br>
pxor m0, m0<br>
- mov r4, 32<br>
-<br>
+ mov r4, 2<br>
.loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
- sub r4, 8<br>
- cmp r4, 8<br>
-<br>
-jnz .loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
PROCESS_SAD_64x4<br>
+ dec r4d<br>
+ jnz .loop<br>
<br>
movhlps m1, m0<br>
paddd m0, m1<br>
@@ -714,27 +688,15 @@<br>
;-----------------------------------------------------------------------------<br>
; int pixel_sad_64x48( uint8_t *, intptr_t, uint8_t *, intptr_t )<br>
;-----------------------------------------------------------------------------<br>
-cglobal pixel_sad_64x48, 4,4,5<br>
+cglobal pixel_sad_64x48, 4,5,5<br>
pxor m0, m0<br>
- mov r4, 48<br>
-<br>
+ mov r4, 4<br>
.loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
- sub r4, 8<br>
- cmp r4, 8<br>
-<br>
-jnz .loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
- PROCESS_SAD_64x4<br>
+ dec r4d<br>
+ jnz .loop<br>
<br>
movhlps m1, m0<br>
paddd m0, m1<br>
@@ -744,27 +706,16 @@<br>
;-----------------------------------------------------------------------------<br>
; int pixel_sad_64x64( uint8_t *, intptr_t, uint8_t *, intptr_t )<br>
;-----------------------------------------------------------------------------<br>
-cglobal pixel_sad_64x64, 4,4,5<br>
+cglobal pixel_sad_64x64, 4,5,5<br>
pxor m0, m0<br>
- mov r4, 64<br>
-<br>
+ mov r4, 4<br>
.loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
-<br>
- sub r4, 8<br>
- cmp r4, 8<br>
-<br>
-jnz .loop<br>
PROCESS_SAD_64x4<br>
- lea r2, [r2 + r3]<br>
- lea r0, [r0 + r1]<br>
PROCESS_SAD_64x4<br>
+ dec r4d<br>
+ jnz .loop<br>
<br>
movhlps m1, m0<br>
paddd m0, m1<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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>