[x265] [PATCH] asm: fix sad[16x64] avx2 code for main12

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Tue Sep 29 10:36:37 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1443508666 -19800
#      Tue Sep 29 12:07:46 2015 +0530
# Node ID ff279fe6bcccbc5dbe384194a1332b1e96595b61
# Parent  f4c267f28487161fa78c43cabb30dc4f4f82570c
asm: fix sad[16x64] avx2 code for main12

diff -r f4c267f28487 -r ff279fe6bccc source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Sep 28 13:38:33 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Tue Sep 29 12:07:46 2015 +0530
@@ -1624,8 +1624,8 @@
         p.pu[LUMA_16x12].sad = PFX(pixel_sad_16x12_avx2);
         p.pu[LUMA_16x16].sad = PFX(pixel_sad_16x16_avx2);
         p.pu[LUMA_16x32].sad = PFX(pixel_sad_16x32_avx2);
+        p.pu[LUMA_16x64].sad = PFX(pixel_sad_16x64_avx2);
 #if X265_DEPTH <= 10
-        p.pu[LUMA_16x64].sad = PFX(pixel_sad_16x64_avx2);
         p.pu[LUMA_32x8].sad = PFX(pixel_sad_32x8_avx2);
         p.pu[LUMA_32x16].sad = PFX(pixel_sad_32x16_avx2);
         p.pu[LUMA_32x24].sad = PFX(pixel_sad_32x24_avx2);
diff -r f4c267f28487 -r ff279fe6bccc source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Mon Sep 28 13:38:33 2015 +0530
+++ b/source/common/x86/sad16-a.asm	Tue Sep 29 12:07:46 2015 +0530
@@ -413,66 +413,38 @@
 SAD  16, 32
 
 INIT_YMM avx2
-cglobal pixel_sad_16x64, 4,7,4
+cglobal pixel_sad_16x64, 4,5,5
     pxor    m0, m0
-    pxor    m3, m3
-    mov     r4d, 64 / 8
-    add     r3d, r3d
-    add     r1d, r1d
-    lea     r5,     [r1 * 3]
-    lea     r6,     [r3 * 3]
+    mov     r4d, 16
+    mova    m4, [pw_1]
 .loop:
     movu    m1, [r2]
-    movu    m2, [r2 + r3]
+    movu    m2, [r2 + r3 * 2]
     psubw   m1, [r0]
-    psubw   m2, [r0 + r1]
+    psubw   m2, [r0 + r1 * 2]
     pabsw   m1, m1
     pabsw   m2, m2
-    paddw   m0, m1
-    paddw   m3, m2
-
-    movu    m1, [r2 + 2 * r3]
-    movu    m2, [r2 + r6]
-    psubw   m1, [r0 + 2 * r1]
-    psubw   m2, [r0 + r5]
-    pabsw   m1, m1
-    pabsw   m2, m2
-    paddw   m0, m1
-    paddw   m3, m2
-
+    paddw   m3, m1, m2
     lea     r0, [r0 + 4 * r1]
     lea     r2, [r2 + 4 * r3]
 
     movu    m1, [r2]
-    movu    m2, [r2 + r3]
+    movu    m2, [r2 + r3 * 2]
     psubw   m1, [r0]
-    psubw   m2, [r0 + r1]
+    psubw   m2, [r0 + r1 * 2]
     pabsw   m1, m1
     pabsw   m2, m2
-    paddw   m0, m1
-    paddw   m3, m2
+    paddw   m1, m2
+    pmaddwd m3, m4
+    paddd   m0, m3
+    pmaddwd m1, m4
+    paddd   m0, m1
+    lea     r0, [r0+4*r1]
+    lea     r2, [r2+4*r3]
+    dec     r4d
+    jg      .loop
 
-    movu    m1, [r2 + 2 * r3]
-    movu    m2, [r2 + r6]
-    psubw   m1, [r0 + 2 * r1]
-    psubw   m2, [r0 + r5]
-    pabsw   m1, m1
-    pabsw   m2, m2
-    paddw   m0, m1
-    paddw   m3, m2
-
-    lea     r0, [r0 + 4 * r1]
-    lea     r2, [r2 + 4 * r3]
-
-    dec    r4d
-    jg .loop
-
-    HADDUWD m0, m1
-    HADDUWD m3, m1
     HADDD   m0, m1
-    HADDD   m3, m1
-    paddd   m0, m3
-
     movd    eax, xm0
     RET
 


More information about the x265-devel mailing list