[x265] [PATCH] asm code for blockcopy_sp, 4xN blocks
praveen at multicorewareinc.com
praveen at multicorewareinc.com
Wed Nov 6 08:36:31 CET 2013
# HG changeset patch
# User Praveen Tiwari
# Date 1383723375 -19800
# Node ID 6f9534cb74935fb1593a84a96b495f3ea30ccec4
# Parent 49db88288b33314b7157793c3a71ef613bfe5f21
asm code for blockcopy_sp, 4xN blocks
diff -r 49db88288b33 -r 6f9534cb7493 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Wed Nov 06 12:04:35 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp Wed Nov 06 13:06:15 2013 +0530
@@ -330,6 +330,10 @@
//This function pointer initaliztion is temprory will be remove later with macro definitions.
//It is used to avoid linker error until all partion are coded and commit smaller patches, easier to review.
+ p.chroma_copy_sp[CHROMA_4x2] = x265_blockcopy_sp_4x2_sse2;
+ p.chroma_copy_sp[CHROMA_4x4] = x265_blockcopy_sp_4x4_sse2;
+ p.chroma_copy_sp[CHROMA_4x8] = x265_blockcopy_sp_4x8_sse2;
+ p.chroma_copy_sp[CHROMA_4x16] = x265_blockcopy_sp_4x16_sse2;
p.chroma_copy_sp[CHROMA_8x2] = x265_blockcopy_sp_8x2_sse2;
p.chroma_copy_sp[CHROMA_8x4] = x265_blockcopy_sp_8x4_sse2;
p.chroma_copy_sp[CHROMA_8x6] = x265_blockcopy_sp_8x6_sse2;
diff -r 49db88288b33 -r 6f9534cb7493 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm Wed Nov 06 12:04:35 2013 +0530
+++ b/source/common/x86/blockcopy8.asm Wed Nov 06 13:06:15 2013 +0530
@@ -799,6 +799,162 @@
BLOCKCOPY_PP_W64_H2 64, 48
BLOCKCOPY_PP_W64_H2 64, 64
+
+;-----------------------------------------------------------------------------
+; void blockcopy_sp_4x2(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal blockcopy_sp_4x2, 4, 4, 3, dest, destStride, src, srcStride
+
+add r3, r3
+
+mova m0, [tab_Vm]
+
+movh m1, [r2]
+movh m2, [r2 + r3]
+
+pshufb m1, m0
+pshufb m2, m0
+
+movd [r0], m1
+movd [r0 + r1], m2
+
+RET
+
+;-----------------------------------------------------------------------------
+; void blockcopy_sp_4x4(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal blockcopy_sp_4x4, 4, 5, 5, dest, destStride, src, srcStride
+
+add r3, r3
+
+mova m0, [tab_Vm]
+
+movh m1, [r2]
+movh m2, [r2 + r3]
+movh m3, [r2 + 2 * r3]
+lea r4, [r2 + 2 * r3]
+movh m4, [r4 + r3]
+
+pshufb m1, m0
+pshufb m2, m0
+pshufb m3, m0
+pshufb m4, m0
+
+movd [r0], m1
+movd [r0 + r1], m2
+movd [r0 + 2 * r1], m3
+lea r4, [r0 + 2 * r1]
+movd [r4 + r1], m4
+
+RET
+
+;-----------------------------------------------------------------------------
+; void blockcopy_sp_4x8(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal blockcopy_sp_4x8, 4, 6, 8, dest, destStride, src, srcStride
+
+add r3, r3
+
+mova m0, [tab_Vm]
+
+movh m1, [r2]
+movh m2, [r2 + r3]
+movh m3, [r2 + 2 * r3]
+lea r4, [r2 + 2 * r3]
+movh m4, [r4 + r3]
+movh m5, [r4 + 2 * r3]
+lea r4, [r4 + 2 * r3]
+movh m6, [r4 + r3]
+movh m7, [r4 + 2 * r3]
+lea r5, [r4 + 2 * r3]
+
+pshufb m1, m0
+pshufb m2, m0
+pshufb m3, m0
+pshufb m4, m0
+pshufb m5, m0
+pshufb m6, m0
+pshufb m7, m0
+
+movd [r0], m1
+movd [r0 + r1], m2
+movd [r0 + 2 * r1], m3
+lea r4, [r0 + 2 * r1]
+movd [r4 + r1], m4
+movd [r4 + 2 * r1], m5
+lea r4, [r4 + 2 * r1]
+movd [r4 + r1], m6
+movd [r4 + 2 * r1], m7
+
+movh m1, [r5 + r3]
+pshufb m1, m0
+lea r4, [r4 + 2 * r1]
+movd [r4 + r1], m1
+
+RET
+
+;-----------------------------------------------------------------------------
+; void blockcopy_sp_%1x%2(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+%macro BLOCKCOPY_SP_W4_H8 2
+INIT_XMM sse2
+cglobal blockcopy_sp_%1x%2, 4, 7, 8, dest, destStride, src, srcStride
+
+mov r6d, %2
+
+add r3, r3
+
+mova m0, [tab_Vm]
+
+.loop
+ movh m1, [r2]
+ movh m2, [r2 + r3]
+ movh m3, [r2 + 2 * r3]
+ lea r4, [r2 + 2 * r3]
+ movh m4, [r4 + r3]
+ movh m5, [r4 + 2 * r3]
+ lea r4, [r4 + 2 * r3]
+ movh m6, [r4 + r3]
+ movh m7, [r4 + 2 * r3]
+ lea r5, [r4 + 2 * r3]
+
+ pshufb m1, m0
+ pshufb m2, m0
+ pshufb m3, m0
+ pshufb m4, m0
+ pshufb m5, m0
+ pshufb m6, m0
+ pshufb m7, m0
+
+ movd [r0], m1
+ movd [r0 + r1], m2
+ movd [r0 + 2 * r1], m3
+ lea r4, [r0 + 2 * r1]
+ movd [r4 + r1], m4
+ movd [r4 + 2 * r1], m5
+ lea r4, [r4 + 2 * r1]
+ movd [r4 + r1], m6
+ movd [r4 + 2 * r1], m7
+
+ movh m1, [r5 + r3]
+ pshufb m1, m0
+ lea r4, [r4 + 2 * r1]
+ movd [r4 + r1], m1
+
+ lea r0, [r0 + 8 * r1]
+ lea r2, [r2 + 8 * r3]
+
+ sub r6d, 8
+ jnz .loop
+
+RET
+%endmacro
+
+BLOCKCOPY_SP_W4_H8 4, 16
+
;-----------------------------------------------------------------------------
; void blockcopy_sp_8x2(pixel *dest, intptr_t destStride, int16_t *src, intptr_t srcStride)
;-----------------------------------------------------------------------------
More information about the x265-devel
mailing list