[x265] [PATCH] add avx version for chroma_copy_ss 16x4, 16x8, 16x12, 16x16, 16x24, 16x32, 16x64 based on csp, approx 1.5x-2x speedup over SSE

sagar at multicorewareinc.com sagar at multicorewareinc.com
Mon Sep 22 15:15:57 CEST 2014


# HG changeset patch
# User Sagar Kotecha <sagar at multicorewareinc.com>
# Date 1411391728 -19800
#      Mon Sep 22 18:45:28 2014 +0530
# Node ID 2fb0a3286265a757c94a36cec0695817116d5260
# Parent  fd435504f15e0b13dabba9efe0aa94e7047060b5
add avx version for chroma_copy_ss 16x4, 16x8, 16x12, 16x16, 16x24, 16x32, 16x64 based on csp, approx 1.5x-2x speedup over SSE

diff -r fd435504f15e -r 2fb0a3286265 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Sep 22 13:14:54 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Sep 22 18:45:28 2014 +0530
@@ -1744,6 +1744,16 @@
         p.quant = x265_quant_avx2;
         p.nquant = x265_nquant_avx2;
         p.dequant_normal = x265_dequant_normal_avx2;
+        p.chroma[X265_CSP_I420].copy_ss[CHROMA_16x4] = x265_blockcopy_ss_16x4_avx;
+        p.chroma[X265_CSP_I420].copy_ss[CHROMA_16x8] = x265_blockcopy_ss_16x8_avx;
+        p.chroma[X265_CSP_I420].copy_ss[CHROMA_16x12] = x265_blockcopy_ss_16x12_avx;
+        p.chroma[X265_CSP_I420].copy_ss[CHROMA_16x16] = x265_blockcopy_ss_16x16_avx;
+        p.chroma[X265_CSP_I420].copy_ss[CHROMA_16x32] = x265_blockcopy_ss_16x32_avx;
+        p.chroma[X265_CSP_I422].copy_ss[CHROMA422_16x8] = x265_blockcopy_ss_16x8_avx;
+        p.chroma[X265_CSP_I422].copy_ss[CHROMA422_16x16] = x265_blockcopy_ss_16x16_avx;
+        p.chroma[X265_CSP_I422].copy_ss[CHROMA422_16x24] = x265_blockcopy_ss_16x24_avx;
+        p.chroma[X265_CSP_I422].copy_ss[CHROMA422_16x32] = x265_blockcopy_ss_16x32_avx;
+        p.chroma[X265_CSP_I422].copy_ss[CHROMA422_16x64] = x265_blockcopy_ss_16x64_avx;
 #if X86_64
         p.dct[DCT_16x16] = x265_dct16_avx2;
         p.dct[DCT_32x32] = x265_dct32_avx2;
diff -r fd435504f15e -r 2fb0a3286265 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm	Mon Sep 22 13:14:54 2014 +0530
+++ b/source/common/x86/blockcopy8.asm	Mon Sep 22 18:45:28 2014 +0530
@@ -2904,6 +2904,46 @@
 BLOCKCOPY_SS_W16_H4 16, 12
 
 ;-----------------------------------------------------------------------------
+; void blockcopy_ss_16x4(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride)
+;-----------------------------------------------------------------------------
+%macro BLOCKCOPY_SS_W16_H4_avx 2
+INIT_YMM avx
+cglobal blockcopy_ss_%1x%2, 4, 5, 2
+    mov     r4d, %2/4
+    add     r1, r1
+    add     r3, r3
+.loop:
+    movu    m0, [r2]
+    movu    m1, [r2 + r3]
+
+    movu    [r0], m0
+    movu    [r0 + r1], m1
+
+    lea     r2, [r2 + 2 * r3]
+    lea     r0, [r0 + 2 * r1]
+
+    movu    m0, [r2]
+    movu    m1, [r2 + r3]
+
+    movu    [r0], m0
+    movu    [r0 + r1], m1
+
+    dec     r4d
+    lea     r0, [r0 + 2 * r1]
+    lea     r2, [r2 + 2 * r3]
+    jnz     .loop
+    RET
+%endmacro
+
+BLOCKCOPY_SS_W16_H4_avx 16, 4
+BLOCKCOPY_SS_W16_H4_avx 16, 8
+BLOCKCOPY_SS_W16_H4_avx 16, 12
+BLOCKCOPY_SS_W16_H4_avx 16, 16
+BLOCKCOPY_SS_W16_H4_avx 16, 24
+BLOCKCOPY_SS_W16_H4_avx 16, 32
+BLOCKCOPY_SS_W16_H4_avx 16, 64
+
+;-----------------------------------------------------------------------------
 ; void blockcopy_ss_%1x%2(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride)
 ;-----------------------------------------------------------------------------
 %macro BLOCKCOPY_SS_W16_H8 2
diff -r fd435504f15e -r 2fb0a3286265 source/common/x86/blockcopy8.h
--- a/source/common/x86/blockcopy8.h	Mon Sep 22 13:14:54 2014 +0530
+++ b/source/common/x86/blockcopy8.h	Mon Sep 22 18:45:28 2014 +0530
@@ -182,6 +182,13 @@
 void x265_blockfill_s_8x8_sse2(int16_t *dst, intptr_t dstride, int16_t val);
 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_ss_16x4_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x8_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x12_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x16_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x24_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x32_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
+void x265_blockcopy_ss_16x64_avx(int16_t *dest, intptr_t deststride, int16_t *src, intptr_t srcstride);
 
 #undef BLOCKCOPY_COMMON
 #undef BLOCKCOPY_SS_PP


More information about the x265-devel mailing list