[x265] [PATCH 259 of 307] x86: AVX512 interp_8tap_horiz_ps_8xN for high bit depth
mythreyi at multicorewareinc.com
mythreyi at multicorewareinc.com
Sat Apr 7 04:34:17 CEST 2018
# HG changeset patch
# User Jayashri Murugan <jayashri at multicorewareinc.com>
# Date 1512992616 -19800
# Mon Dec 11 17:13:36 2017 +0530
# Node ID d6873e0a0786cd732304a94812a28914978113e3
# Parent 73488dec74e1882a16751252398207007b3a0c29
x86: AVX512 interp_8tap_horiz_ps_8xN for high bit depth
Size | AVX2 performance | AVX512 performance
----------------------------------------------
8x4 | 6.88x | 12.85x
8x8 | 7.23x | 13.07x
8x16 | 6.66x | 13.77x
8x32 | 6.92x | 14.05x
diff -r 73488dec74e1 -r d6873e0a0786 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Mon Dec 11 16:22:35 2017 +0530
+++ b/source/common/x86/asm-primitives.cpp Mon Dec 11 17:13:36 2017 +0530
@@ -3028,7 +3028,11 @@
p.pu[LUMA_48x64].luma_hps = PFX(interp_8tap_horiz_ps_48x64_avx512);
//Luma_hps_24x32
p.pu[LUMA_24x32].luma_hps = PFX(interp_8tap_horiz_ps_24x32_avx512);
-
+ //Luma_hps_8xN
+ p.pu[LUMA_8x4].luma_hps = PFX(interp_8tap_horiz_ps_8x4_avx512);
+ p.pu[LUMA_8x8].luma_hps = PFX(interp_8tap_horiz_ps_8x8_avx512);
+ p.pu[LUMA_8x16].luma_hps = PFX(interp_8tap_horiz_ps_8x16_avx512);
+ p.pu[LUMA_8x32].luma_hps = PFX(interp_8tap_horiz_ps_8x32_avx512);
p.pu[LUMA_16x8].satd = PFX(pixel_satd_16x8_avx512);
p.pu[LUMA_16x16].satd = PFX(pixel_satd_16x16_avx512);
p.pu[LUMA_16x32].satd = PFX(pixel_satd_16x32_avx512);
diff -r 73488dec74e1 -r d6873e0a0786 source/common/x86/ipfilter16.asm
--- a/source/common/x86/ipfilter16.asm Mon Dec 11 16:22:35 2017 +0530
+++ b/source/common/x86/ipfilter16.asm Mon Dec 11 17:13:36 2017 +0530
@@ -11826,6 +11826,166 @@
jnz .loop
RET
%endif
+%macro PROCESS_IPFILTER_LUMA_PS_8x4_AVX512 0
+ ; register map
+ ; m0 , m1, m2, m3 - interpolate coeff table
+ ; m4 , m5 - load shuffle order table
+ ; m6 - INTERP_OFFSET_PS
+ ; m7 - store shuffle order table
+
+ movu xm8, [r0]
+ movu xm9, [r0 + 8]
+ movu xm10, [r0 + 16]
+
+ vinserti32x4 m8, [r0 + r1], 1
+ vinserti32x4 m9, [r0 + r1 + 8], 1
+ vinserti32x4 m10, [r0 + r1 + 16], 1
+
+ vinserti32x4 m8, [r0 + 2 * r1], 2
+ vinserti32x4 m9, [r0 + 2 * r1 + 8], 2
+ vinserti32x4 m10, [r0 + 2 * r1 + 16], 2
+
+ vinserti32x4 m8, [r0 + r6], 3
+ vinserti32x4 m9, [r0 + r6 + 8], 3
+ vinserti32x4 m10, [r0 + r6 + 16], 3
+
+ pshufb m11, m8, m5
+ pshufb m8, m4
+ pshufb m12, m9, m5
+ pshufb m9, m4
+ pshufb m13, m10, m5
+ pshufb m10, m4
+
+ pmaddwd m8, m0
+ pmaddwd m11, m1
+ paddd m8, m11
+ pmaddwd m11, m12, m3
+ pmaddwd m14, m9, m2
+ paddd m11, m14
+ paddd m8, m11
+ paddd m8, m6
+ psrad m8, INTERP_SHIFT_PS
+
+ pmaddwd m9, m0
+ pmaddwd m12, m1
+ paddd m9, m12
+ pmaddwd m13, m3
+ pmaddwd m10, m2
+ paddd m10, m13
+ paddd m9, m10
+ paddd m9, m6
+ psrad m9, INTERP_SHIFT_PS
+
+ packssdw m8, m9
+ pshufb m8, m7
+ movu [r2], xm8
+ vextracti32x4 [r2 + r3], m8, 1
+ vextracti32x4 [r2 + 2 * r3], m8, 2
+ vextracti32x4 [r2 + r7], m8, 3
+%endmacro
+
+%macro PROCESS_IPFILTER_LUMA_PS_8x3_AVX512 0
+ movu xm8, [r0]
+ movu xm9, [r0 + 8]
+ movu xm10, [r0 + 16]
+
+ vinserti32x4 m8, [r0 + r1], 1
+ vinserti32x4 m9, [r0 + r1 + 8], 1
+ vinserti32x4 m10, [r0 + r1 + 16], 1
+
+ vinserti32x4 m8, [r0 + 2 * r1], 2
+ vinserti32x4 m9, [r0 + 2 * r1 + 8], 2
+ vinserti32x4 m10, [r0 + 2 * r1 + 16], 2
+
+ pshufb m11, m8, m5
+ pshufb m8, m4
+ pshufb m12, m9, m5
+ pshufb m9, m4
+ pshufb m13, m10, m5
+ pshufb m10, m4
+
+ pmaddwd m8, m0
+ pmaddwd m11, m1
+ paddd m8, m11
+ pmaddwd m11, m12, m3
+ pmaddwd m14, m9, m2
+ paddd m11, m14
+ paddd m8, m11
+ paddd m8, m6
+ psrad m8, INTERP_SHIFT_PS
+
+ pmaddwd m9, m0
+ pmaddwd m12, m1
+ paddd m9, m12
+ pmaddwd m13, m3
+ pmaddwd m10, m2
+ paddd m10, m13
+ paddd m9, m10
+ paddd m9, m6
+ psrad m9, INTERP_SHIFT_PS
+
+ packssdw m8, m9
+ pshufb m8, m7
+ movu [r2], xm8
+ vextracti32x4 [r2 + r3], m8, 1
+ vextracti32x4 [r2 + 2 * r3], m8, 2
+%endmacro
+
+%macro IPFILTER_LUMA_PS_AVX512_8xN 1
+INIT_ZMM avx512
+cglobal interp_8tap_horiz_ps_8x%1, 4, 9, 15
+ add r1d, r1d
+ add r3d, r3d
+ mov r4d, r4m
+ mov r5d, r5m
+ shl r4d, 6
+
+ lea r6, [3 * r1]
+ lea r7, [3 * r3]
+
+%ifdef PIC
+ lea r8, [tab_LumaCoeffH_avx512]
+ vpbroadcastd m0, [r8 + r4]
+ vpbroadcastd m1, [r8 + r4 + 4]
+ vpbroadcastd m2, [r8 + r4 + 8]
+ vpbroadcastd m3, [r8 + r4 + 12]
+%else
+ vpbroadcastd m0, [tab_LumaCoeffH_avx512 + r4]
+ vpbroadcastd m1, [tab_LumaCoeffH_avx512 + r4 + 4]
+ vpbroadcastd m2, [tab_LumaCoeffH_avx512 + r4 + 8]
+ vpbroadcastd m3, [tab_LumaCoeffH_avx512 + r4 + 12]
+%endif
+ vbroadcasti32x8 m4, [interp8_hpp_shuf1_load_avx512]
+ vbroadcasti32x8 m5, [interp8_hpp_shuf2_load_avx512]
+ vbroadcasti32x4 m6, [INTERP_OFFSET_PS]
+ vbroadcasti32x8 m7, [interp8_hpp_shuf1_store_avx512]
+
+ sub r0, 6
+ mov r4d, %1
+ test r5d, r5d
+ jz .loop
+ sub r0, r6
+ add r4d, 7
+ PROCESS_IPFILTER_LUMA_PS_8x3_AVX512
+ lea r0, [r0 + r6]
+ lea r2, [r2 + r7]
+ sub r4d, 3
+
+.loop:
+ PROCESS_IPFILTER_LUMA_PS_8x4_AVX512
+ lea r0, [r0 + 4 * r1]
+ lea r2, [r2 + 4 * r3]
+ sub r4d, 4
+ jnz .loop
+ RET
+%endmacro
+
+%if ARCH_X86_64
+ IPFILTER_LUMA_PS_AVX512_8xN 4
+ IPFILTER_LUMA_PS_AVX512_8xN 8
+ IPFILTER_LUMA_PS_AVX512_8xN 16
+ IPFILTER_LUMA_PS_AVX512_8xN 32
+%endif
;-------------------------------------------------------------------------------------------------------------
;avx512 luma_hps code end
More information about the x265-devel
mailing list