[x265] [PATCH] bloccopy_pp avx asm code: 32x32, 32x48, 32x64 improved by 803.69 -> 514.90, 1126.36 -> 655.24, 1454.09 -> 835.76 cycles

praveen at multicorewareinc.com praveen at multicorewareinc.com
Wed Sep 24 15:22:43 CEST 2014


# HG changeset patch
# User Praveen Tiwari
# Date 1411564953 -19800
# Node ID de1435d8eb446e21bcf2725caa55de7c44f67085
# Parent  6e31c786d691d7484b2d7e754d015da4768c01b5
bloccopy_pp avx asm code: 32x32, 32x48, 32x64 improved by 803.69 -> 514.90, 1126.36 -> 655.24, 1454.09 -> 835.76 cycles

diff -r 6e31c786d691 -r de1435d8eb44 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Sep 24 18:44:24 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Sep 24 18:52:33 2014 +0530
@@ -1724,6 +1724,15 @@
 
         p.chroma[X265_CSP_I420].copy_pp[CHROMA_32x24] = x265_blockcopy_pp_32x24_avx;
         p.luma_copy_pp[LUMA_32x24] = x265_blockcopy_pp_32x24_avx;
+
+        p.chroma[X265_CSP_I420].copy_pp[CHROMA_32x32] = x265_blockcopy_pp_32x32_avx;
+        p.chroma[X265_CSP_I422].copy_pp[CHROMA422_32x32] = x265_blockcopy_pp_32x32_avx;
+        p.luma_copy_pp[LUMA_32x32]  = x265_blockcopy_pp_32x32_avx;
+
+        p.chroma[X265_CSP_I422].copy_pp[CHROMA422_32x48] = x265_blockcopy_pp_32x48_avx;
+
+        p.chroma[X265_CSP_I422].copy_pp[CHROMA422_32x64] = x265_blockcopy_pp_32x64_avx;
+        p.luma_copy_pp[LUMA_32x64]  = x265_blockcopy_pp_32x64_avx;
     }
     if (cpuMask & X265_CPU_XOP)
     {
diff -r 6e31c786d691 -r de1435d8eb44 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm	Wed Sep 24 18:44:24 2014 +0530
+++ b/source/common/x86/blockcopy8.asm	Wed Sep 24 18:52:33 2014 +0530
@@ -724,6 +724,72 @@
 ;-----------------------------------------------------------------------------
 ; void blockcopy_pp_%1x%2(pixel *dest, intptr_t deststride, pixel *src, intptr_t srcstride)
 ;-----------------------------------------------------------------------------
+%macro BLOCKCOPY_PP_W32_H16_avx 2
+INIT_YMM avx
+cglobal blockcopy_pp_%1x%2, 4, 7, 6
+    lea    r4,  [3 * r1]
+    lea    r5,  [3 * r3]
+    mov    r6d, %2/16
+
+.loop:
+    movu    m0, [r2]
+    movu    m1, [r2 + r3]
+    movu    m2, [r2 + 2 * r3]
+    movu    m3, [r2 + r5]
+    lea     r2, [r2 + 4 * r3]
+    movu    m4, [r2]
+    movu    m5, [r2 + r3]
+  
+    movu    [r0], m0
+    movu    [r0 + r1], m1
+    movu    [r0 + 2 * r1], m2
+    movu    [r0 + r4], m3
+    lea     r0, [r0 + 4 * r1]
+    movu    [r0], m4
+    movu    [r0 + r1], m5
+
+    movu    m0, [r2 + 2 * r3]
+    movu    m1, [r2 + r5]
+    lea     r2, [r2 + 4 * r3]
+    movu    m2, [r2]
+    movu    m3, [r2 + r3]
+    movu    m4, [r2 + 2 * r3]
+    movu    m5, [r2 + r5]
+
+    movu    [r0 + 2 * r1], m0
+    movu    [r0 + r4], m1
+    lea     r0, [r0 + 4 * r1]
+    movu    [r0], m2
+    movu    [r0 + r1], m3
+    movu    [r0 + 2 * r1], m4
+    movu    [r0 + r4], m5
+
+    lea     r2, [r2 + 4 * r3]
+    movu    m0, [r2]
+    movu    m1, [r2 + r3]
+    movu    m2, [r2 + 2 * r3]
+    movu    m3, [r2 + r5]
+
+    lea     r0, [r0 + 4 * r1]
+    movu    [r0], m0
+    movu    [r0 + r1], m1
+    movu    [r0 + 2 * r1], m2
+    movu    [r0 + r4], m3
+
+    lea     r2, [r2 + 4 * r3]
+    lea     r0, [r0 + 4 * r1]
+    dec     r6d
+    jnz     .loop
+    RET
+%endmacro
+
+BLOCKCOPY_PP_W32_H16_avx 32, 32
+BLOCKCOPY_PP_W32_H16_avx 32, 48
+BLOCKCOPY_PP_W32_H16_avx 32, 64
+
+;-----------------------------------------------------------------------------
+; void blockcopy_pp_%1x%2(pixel *dest, intptr_t deststride, pixel *src, intptr_t srcstride)
+;-----------------------------------------------------------------------------
 %macro BLOCKCOPY_PP_W48_H2 2
 INIT_XMM sse2
 cglobal blockcopy_pp_%1x%2, 4, 5, 6
diff -r 6e31c786d691 -r de1435d8eb44 source/common/x86/blockcopy8.h
--- a/source/common/x86/blockcopy8.h	Wed Sep 24 18:44:24 2014 +0530
+++ b/source/common/x86/blockcopy8.h	Wed Sep 24 18:52:33 2014 +0530
@@ -197,6 +197,9 @@
 void x265_blockcopy_pp_32x8_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
 void x265_blockcopy_pp_32x16_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
 void x265_blockcopy_pp_32x24_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_32x32_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_32x48_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_32x64_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
 
 #undef BLOCKCOPY_COMMON
 #undef BLOCKCOPY_SS_PP


More information about the x265-devel mailing list