[x265] [PATCH] asm: avx2 asm code for 8bpp and 16bpp vesion of scale1D_128to64 module
murugan at multicorewareinc.com
murugan at multicorewareinc.com
Mon Oct 20 16:24:40 CEST 2014
# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1413814135 -19800
# Mon Oct 20 19:38:55 2014 +0530
# Node ID 209386a43ffd9d0db2fb84f9f27f660492f724b8
# Parent 7eab67ffff81a44cc67c388dc4fcae2468979fae
asm: avx2 asm code for 8bpp and 16bpp vesion of scale1D_128to64 module
diff -r 7eab67ffff81 -r 209386a43ffd source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Mon Oct 20 15:37:50 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp Mon Oct 20 19:38:55 2014 +0530
@@ -1444,6 +1444,7 @@
p.quant = x265_quant_avx2;
p.nquant = x265_nquant_avx2;
p.dequant_normal = x265_dequant_normal_avx2;
+ p.scale1D_128to64 = x265_scale1D_128to64_avx2;
#if X86_64
p.dct[DCT_8x8] = x265_dct8_avx2;
p.dct[DCT_16x16] = x265_dct16_avx2;
@@ -1788,6 +1789,7 @@
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;
+ p.scale1D_128to64 = x265_scale1D_128to64_avx2;
#if X86_64
p.dct[DCT_8x8] = x265_dct8_avx2;
diff -r 7eab67ffff81 -r 209386a43ffd source/common/x86/pixel-util.h
--- a/source/common/x86/pixel-util.h Mon Oct 20 15:37:50 2014 +0530
+++ b/source/common/x86/pixel-util.h Mon Oct 20 19:38:55 2014 +0530
@@ -70,6 +70,7 @@
float x265_pixel_ssim_end4_avx(int sum0[5][4], int sum1[5][4], int width);
void x265_scale1D_128to64_ssse3(pixel *, pixel *, intptr_t);
+void x265_scale1D_128to64_avx2(pixel *, pixel *, intptr_t);
void x265_scale2D_64to32_ssse3(pixel *, pixel *, intptr_t);
#define SETUP_CHROMA_PIXELSUB_PS_FUNC(W, H, cpu) \
diff -r 7eab67ffff81 -r 209386a43ffd source/common/x86/pixel-util8.asm
--- a/source/common/x86/pixel-util8.asm Mon Oct 20 15:37:50 2014 +0530
+++ b/source/common/x86/pixel-util8.asm Mon Oct 20 19:38:55 2014 +0530
@@ -42,13 +42,15 @@
mask_ff: times 16 db 0xff
times 16 db 0
deinterleave_shuf: db 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15
-deinterleave_word_shuf: db 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 15, 15
+deinterleave_word_shuf: db 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15
hmul_16p: times 16 db 1
times 8 db 1, -1
hmulw_16p: times 8 dw 1
times 4 dw 1, -1
trans8_shuf: dd 0, 4, 1, 5, 2, 6, 3, 7
+scale1D_shuf: times 2 db 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15
+scale1D_shuf_word: times 2 db 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15
SECTION .text
@@ -3451,6 +3453,75 @@
%endif
RET
+INIT_YMM avx2
+%if HIGH_BIT_DEPTH == 1
+cglobal scale1D_128to64, 2, 2, 4
+ mova m3, [scale1D_shuf_word]
+ movu m0, [r1]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 32]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgw m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0], m0
+
+ movu m0, [r1 + 64]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 96]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgw m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0 + 32], m0
+
+ movu m0, [r1 + 128]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 160]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgw m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0 + 64], m0
+
+ movu m0, [r1 + 192]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 224]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgw m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0 + 96], m0
+ RET
+%else ; HIGH_BIT_DEPTH == 0
+cglobal scale1D_128to64, 2, 2, 4
+ mova m3, [scale1D_shuf]
+ movu m0, [r1]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 32]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgb m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0], m0
+
+ movu m0, [r1 + 64]
+ pshufb m0, m0, m3
+ movu m1, [r1 + 96]
+ pshufb m1, m1, m3
+ punpcklqdq m2, m0, m1
+ punpckhqdq m0, m1
+ pavgb m0, m2
+ vpermq m0, m0, 0xD8
+ movu [r0 + 32], m0
+ RET
+%endif
+
;-----------------------------------------------------------------
; void scale2D_64to32(pixel *dst, pixel *src, intptr_t stride)
;-----------------------------------------------------------------
More information about the x265-devel
mailing list