[x265] [PATCH] asm: avx2 8bpp code for convert_p2s[32xN]

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Tue Apr 7 15:36:55 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1428410141 -19800
#      Tue Apr 07 18:05:41 2015 +0530
# Node ID 5e1261b63eae3db9b3527c74c45adefeb2bb20fb
# Parent  095ed87526e5964ad45949ec81903704451d79f8
asm: avx2 8bpp code for convert_p2s[32xN]

     convert_p2s[32x8](11.11x), convert_p2s[32x16](11.01x),
     convert_p2s[32x24](11.03x), convert_p2s[32x32](11.00x),
     convert_p2s[32x64](11.06x)

diff -r 095ed87526e5 -r 5e1261b63eae source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Tue Apr 07 09:42:31 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Tue Apr 07 18:05:41 2015 +0530
@@ -2037,6 +2037,12 @@
 
         p.pu[LUMA_16x16].luma_hvpp = x265_interp_8tap_hv_pp_16x16_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;
+
         if ((cpuMask & X265_CPU_BMI1) && (cpuMask & X265_CPU_BMI2))
             p.findPosLast = x265_findPosLast_x64;
     }
diff -r 095ed87526e5 -r 5e1261b63eae source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Tue Apr 07 09:42:31 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Tue Apr 07 18:05:41 2015 +0530
@@ -8144,6 +8144,82 @@
 P2S_H_32xN 64
 P2S_H_32xN 48
 
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
+;-----------------------------------------------------------------------------
+%macro P2S_H_32xN_avx2 1
+INIT_YMM avx2
+cglobal filterPixelToShort_32x%1, 3, 7, 6
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r4, [r3 * 3]
+    lea         r5, [r1 * 3]
+
+    ; load height
+    mov         r6d, %1/4
+
+    ; load constant
+    vbroadcasti128   m4, [pb_128]
+    vbroadcasti128   m5, [tab_c_64_n64]
+
+.loop:
+    movu        m0, [r0]
+    punpcklbw   m1, m0, m4
+    punpckhbw   m2, m0, m4
+    pmaddubsw   m1, m5
+    pmaddubsw   m2, m5
+    vperm2i128  m3, m1, m2, q0301
+    vperm2i128  m2, m1, m2, q0200
+
+    movu        [r2 + r3 * 0], m2
+    movu        [r2 + r3 * 0 + 32], m3
+
+    movu        m0, [r0 + r1]
+    punpcklbw   m1, m0, m4
+    punpckhbw   m2, m0, m4
+    pmaddubsw   m1, m5
+    pmaddubsw   m2, m5
+    vperm2i128  m3, m1, m2, q0301
+    vperm2i128  m2, m1, m2, q0200
+
+    movu        [r2 + r3 * 1], m2
+    movu        [r2 + r3 * 1 + 32], m3
+
+    movu        m0, [r0 + r1 * 2]
+    punpcklbw   m1, m0, m4
+    punpckhbw   m2, m0, m4
+    pmaddubsw   m1, m5
+    pmaddubsw   m2, m5
+    vperm2i128  m3, m1, m2, q0301
+    vperm2i128  m2, m1, m2, q0200
+
+    movu        [r2 + r3 * 2], m2
+    movu        [r2 + r3 * 2 + 32], m3
+
+    movu        m0, [r0 + r5]
+    punpcklbw   m1, m0, m4
+    punpckhbw   m2, m0, m4
+    pmaddubsw   m1, m5
+    pmaddubsw   m2, m5
+    vperm2i128  m3, m1, m2, q0301
+    vperm2i128  m2, m1, m2, q0200
+
+    movu        [r2 + r4], m2
+    movu        [r2 + r4 + 32], m3
+
+    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
+
 ;-----------------------------------------------------------------------------
 ; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
 ;-----------------------------------------------------------------------------
diff -r 095ed87526e5 -r 5e1261b63eae source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Tue Apr 07 09:42:31 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Tue Apr 07 18:05:41 2015 +0530
@@ -675,6 +675,11 @@
 void x265_filterPixelToShort_12x16_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 void x265_filterPixelToShort_24x32_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 void x265_filterPixelToShort_48x64_ssse3(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);
 #undef LUMA_FILTERS
 #undef LUMA_SP_FILTERS
 #undef LUMA_SS_FILTERS


More information about the x265-devel mailing list