[x265] [PATCH] asm: avx2 10bit code for convert_p2s[32xN],[64xN]
rajesh at multicorewareinc.com
rajesh at multicorewareinc.com
Thu Apr 16 15:49:52 CEST 2015
# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1429174083 -19800
# Thu Apr 16 14:18:03 2015 +0530
# Node ID 925a29ed81a4697655d9716f93ff29b246a17756
# Parent 8d14e23666ec5fb90a85d90032f52d3fb3e6fe4a
asm: avx2 10bit code for convert_p2s[32xN],[64xN]
convert_p2s[32x8](15.77x), convert_p2s[32x16](19.15x),
convert_p2s[32x24](16.84x), convert_p2s[32x32](20.49x),
convert_p2s[32x64](21.19x), convert_p2s[64x16](18.99x),
convert_p2s[64x32](17.16x), convert_p2s[64x48](19.27x),
convert_p2s[64x64](16.86x)
diff -r 8d14e23666ec -r 925a29ed81a4 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Thu Apr 16 18:17:36 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp Thu Apr 16 14:18:03 2015 +0530
@@ -1230,6 +1230,15 @@
p.pu[LUMA_16x16].convert_p2s = x265_filterPixelToShort_16x16_avx2;
p.pu[LUMA_16x32].convert_p2s = x265_filterPixelToShort_16x32_avx2;
p.pu[LUMA_16x64].convert_p2s = x265_filterPixelToShort_16x64_avx2;
+ p.pu[LUMA_32x8].convert_p2s = x265_filterPixelToShort_32x8_avx2;
+ p.pu[LUMA_32x16].convert_p2s = x265_filterPixelToShort_32x16_avx2;
+ p.pu[LUMA_32x24].convert_p2s = x265_filterPixelToShort_32x24_avx2;
+ p.pu[LUMA_32x32].convert_p2s = x265_filterPixelToShort_32x32_avx2;
+ p.pu[LUMA_32x64].convert_p2s = x265_filterPixelToShort_32x64_avx2;
+ p.pu[LUMA_64x16].convert_p2s = x265_filterPixelToShort_64x16_avx2;
+ p.pu[LUMA_64x32].convert_p2s = x265_filterPixelToShort_64x32_avx2;
+ p.pu[LUMA_64x48].convert_p2s = x265_filterPixelToShort_64x48_avx2;
+ p.pu[LUMA_64x64].convert_p2s = x265_filterPixelToShort_64x64_avx2;
}
}
#else // if HIGH_BIT_DEPTH
diff -r 8d14e23666ec -r 925a29ed81a4 source/common/x86/ipfilter16.asm
--- a/source/common/x86/ipfilter16.asm Thu Apr 16 18:17:36 2015 +0530
+++ b/source/common/x86/ipfilter16.asm Thu Apr 16 14:18:03 2015 +0530
@@ -6037,6 +6037,79 @@
;-----------------------------------------------------------------------------
; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
;-----------------------------------------------------------------------------
+%macro P2S_H_32xN_avx2 1
+INIT_YMM avx2
+cglobal filterPixelToShort_32x%1, 3, 7, 3
+ add r1d, r1d
+ mov r3d, r3m
+ add r3d, r3d
+ lea r4, [r3 * 3]
+ lea r5, [r1 * 3]
+
+ ; load height
+ mov r6d, %1/4
+
+ ; load constant
+ mova m2, [pw_2000]
+
+.loop
+ movu m0, [r0]
+ movu m1, [r0 + r1]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0], m0
+ movu [r2 + r3 * 1], m1
+
+ movu m0, [r0 + r1 * 2]
+ movu m1, [r0 + r5]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2], m0
+ movu [r2 + r4], m1
+
+ movu m0, [r0 + 32]
+ movu m1, [r0 + r1 + 32]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0 + 32], m0
+ movu [r2 + r3 * 1 + 32], m1
+
+ movu m0, [r0 + r1 * 2 + 32]
+ movu m1, [r0 + r5 + 32]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2 + 32], m0
+ movu [r2 + r4 + 32], m1
+
+ lea r0, [r0 + r1 * 4]
+ lea r2, [r2 + r3 * 4]
+
+ dec r6d
+ jnz .loop
+ RET
+%endmacro
+P2S_H_32xN_avx2 32
+P2S_H_32xN_avx2 8
+P2S_H_32xN_avx2 16
+P2S_H_32xN_avx2 24
+P2S_H_32xN_avx2 64
+P2S_H_32xN_avx2 48
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
%macro P2S_H_64xN 1
INIT_XMM ssse3
cglobal filterPixelToShort_64x%1, 3, 7, 5
@@ -6212,6 +6285,117 @@
;-----------------------------------------------------------------------------
; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
;-----------------------------------------------------------------------------
+%macro P2S_H_64xN_avx2 1
+INIT_YMM avx2
+cglobal filterPixelToShort_64x%1, 3, 7, 3
+ add r1d, r1d
+ mov r3d, r3m
+ add r3d, r3d
+ lea r4, [r3 * 3]
+ lea r5, [r1 * 3]
+
+ ; load height
+ mov r6d, %1/4
+
+ ; load constant
+ mova m2, [pw_2000]
+
+.loop
+ movu m0, [r0]
+ movu m1, [r0 + r1]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0], m0
+ movu [r2 + r3 * 1], m1
+
+ movu m0, [r0 + r1 * 2]
+ movu m1, [r0 + r5]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2], m0
+ movu [r2 + r4], m1
+
+ movu m0, [r0 + 32]
+ movu m1, [r0 + r1 + 32]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0 + 32], m0
+ movu [r2 + r3 * 1 + 32], m1
+
+ movu m0, [r0 + r1 * 2 + 32]
+ movu m1, [r0 + r5 + 32]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2 + 32], m0
+ movu [r2 + r4 + 32], m1
+
+ movu m0, [r0 + 64]
+ movu m1, [r0 + r1 + 64]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0 + 64], m0
+ movu [r2 + r3 * 1 + 64], m1
+
+ movu m0, [r0 + r1 * 2 + 64]
+ movu m1, [r0 + r5 + 64]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2 + 64], m0
+ movu [r2 + r4 + 64], m1
+
+ movu m0, [r0 + 96]
+ movu m1, [r0 + r1 + 96]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 0 + 96], m0
+ movu [r2 + r3 * 1 + 96], m1
+
+ movu m0, [r0 + r1 * 2 + 96]
+ movu m1, [r0 + r5 + 96]
+ psllw m0, 4
+ psubw m0, m2
+ psllw m1, 4
+ psubw m1, m2
+
+ movu [r2 + r3 * 2 + 96], m0
+ movu [r2 + r4 + 96], m1
+
+ lea r0, [r0 + r1 * 4]
+ lea r2, [r2 + r3 * 4]
+
+ dec r6d
+ jnz .loop
+ RET
+%endmacro
+P2S_H_64xN_avx2 64
+P2S_H_64xN_avx2 16
+P2S_H_64xN_avx2 32
+P2S_H_64xN_avx2 48
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
%macro P2S_H_24xN 1
INIT_XMM ssse3
cglobal filterPixelToShort_24x%1, 3, 7, 5
diff -r 8d14e23666ec -r 925a29ed81a4 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h Thu Apr 16 18:17:36 2015 +0530
+++ b/source/common/x86/ipfilter8.h Thu Apr 16 14:18:03 2015 +0530
@@ -320,6 +320,15 @@
void x265_filterPixelToShort_16x16_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
void x265_filterPixelToShort_16x32_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
void x265_filterPixelToShort_16x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_32x8_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_32x16_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_32x24_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_32x32_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_32x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_64x16_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_64x32_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_64x48_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_64x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
#define SETUP_CHROMA_P2S_FUNC_DEF(W, H, cpu) \
void x265_filterPixelToShort_ ## W ## x ## H ## cpu(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
More information about the x265-devel
mailing list