[x265] [PATCH] blockcopy_pp: 64x16, 64x32, 64x48, 64x64 AVX version of asm code, approx double speedup comapre to SSE

sagar at multicorewareinc.com sagar at multicorewareinc.com
Fri Sep 19 14:15:47 CEST 2014


# HG changeset patch
# User Sagar Kotecha <sagar at multicorewareinc.com>
# Date 1411128766 -19800
#      Fri Sep 19 17:42:46 2014 +0530
# Node ID d9587b52627426d4c3ff6ef5df2d8d750f401b1b
# Parent  4680ab4f92b8cc809b1e8dbc927126ec70bcc5c5
blockcopy_pp: 64x16, 64x32, 64x48, 64x64 AVX version of asm code, approx double speedup comapre to SSE

diff -r 4680ab4f92b8 -r d9587b526274 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Sep 18 18:16:25 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Fri Sep 19 17:42:46 2014 +0530
@@ -1709,6 +1709,10 @@
 
         p.ssim_4x4x2_core = x265_pixel_ssim_4x4x2_core_avx;
         p.ssim_end_4 = x265_pixel_ssim_end4_avx;
+        p.luma_copy_pp[LUMA_64x16] = x265_blockcopy_pp_64x16_avx;
+        p.luma_copy_pp[LUMA_64x32] = x265_blockcopy_pp_64x32_avx;
+        p.luma_copy_pp[LUMA_64x48] = x265_blockcopy_pp_64x48_avx;
+        p.luma_copy_pp[LUMA_64x64] = x265_blockcopy_pp_64x64_avx;
     }
     if (cpuMask & X265_CPU_XOP)
     {
diff -r 4680ab4f92b8 -r d9587b526274 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm	Thu Sep 18 18:16:25 2014 +0530
+++ b/source/common/x86/blockcopy8.asm	Fri Sep 19 17:42:46 2014 +0530
@@ -714,6 +714,44 @@
 BLOCKCOPY_PP_W64_H4 64, 48
 BLOCKCOPY_PP_W64_H4 64, 64
 
+%macro BLOCKCOPY_PP_W64_H4_avx 2
+INIT_YMM avx
+cglobal blockcopy_pp_%1x%2, 4, 7, 8
+    mov    r4d,    %2/4
+    lea     r5,    [3 * r3]
+    lea     r6,    [3 * r1]
+
+.loop:
+    movu    m0,    [r2]
+    movu    m1,    [r2 + 32]
+    movu    m2,    [r2 + r3]
+    movu    m3,    [r2 + r3 + 32]
+    movu    m4,    [r2 + 2 * r3]
+    movu    m5,    [r2 + 2 * r3 + 32]
+    movu    m6,    [r2 + r5]
+    movu    m7,    [r2 + r5 + 32]
+
+    movu    [r0],              m0
+    movu    [r0 + 32],         m1
+    movu    [r0 + r1],         m2
+    movu    [r0 + r1 + 32],    m3
+    movu    [r0 + 2 * r1],     m4
+    movu    [r0 + 2 * r1 + 32],m5
+    movu    [r0 + r6],         m6
+    movu    [r0 + r6 + 32],    m7
+
+    dec    r4d
+    lea    r0,    [r0 + 4 * r1]
+    lea    r2,    [r2 + 4 * r3]
+    jnz    .loop
+    RET
+%endmacro
+
+BLOCKCOPY_PP_W64_H4_avx 64, 16
+BLOCKCOPY_PP_W64_H4_avx 64, 32
+BLOCKCOPY_PP_W64_H4_avx 64, 48
+BLOCKCOPY_PP_W64_H4_avx 64, 64
+
 ;-----------------------------------------------------------------------------
 ; void blockcopy_sp_2x4(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
 ;-----------------------------------------------------------------------------
diff -r 4680ab4f92b8 -r d9587b526274 source/common/x86/blockcopy8.h
--- a/source/common/x86/blockcopy8.h	Thu Sep 18 18:16:25 2014 +0530
+++ b/source/common/x86/blockcopy8.h	Fri Sep 19 17:42:46 2014 +0530
@@ -183,6 +183,11 @@
 void x265_blockfill_s_16x16_sse2(int16_t *dst, intptr_t dstride, int16_t val);
 void x265_blockfill_s_32x32_sse2(int16_t *dst, intptr_t dstride, int16_t val);
 
+void x265_blockcopy_pp_64x16_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_64x32_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_64x48_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+void x265_blockcopy_pp_64x64_avx(pixel * a, intptr_t stridea, pixel * b, intptr_t strideb);
+
 #undef BLOCKCOPY_COMMON
 #undef BLOCKCOPY_SS_PP
 #undef BLOCKCOPY_SP


More information about the x265-devel mailing list