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

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Fri Apr 10 07:53:03 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1428643174 -19800
#      Fri Apr 10 10:49:34 2015 +0530
# Node ID 3ff907035681742e9c21e73ce287810b3d2c3584
# Parent  984e254f93f7cedc5a9b00851d2e14b49dc94e91
asm: avx2 8bpp code for convert_p2s[24xN]

     convert_p2s[24x32](16.21x)

diff -r 984e254f93f7 -r 3ff907035681 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Apr 09 11:48:08 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Fri Apr 10 10:49:34 2015 +0530
@@ -2070,6 +2070,7 @@
         p.pu[LUMA_64x48].convert_p2s = x265_filterPixelToShort_64x48_avx2;
         p.pu[LUMA_64x64].convert_p2s = x265_filterPixelToShort_64x64_avx2;
         p.pu[LUMA_48x64].convert_p2s = x265_filterPixelToShort_48x64_avx2;
+        p.pu[LUMA_24x32].convert_p2s = x265_filterPixelToShort_24x32_avx2;
 
         if ((cpuMask & X265_CPU_BMI1) && (cpuMask & X265_CPU_BMI2))
             p.findPosLast = x265_findPosLast_x64;
diff -r 984e254f93f7 -r 3ff907035681 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Thu Apr 09 11:48:08 2015 -0500
+++ b/source/common/x86/ipfilter8.asm	Fri Apr 10 10:49:34 2015 +0530
@@ -8705,6 +8705,74 @@
 ;-----------------------------------------------------------------------------
 ; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
 ;-----------------------------------------------------------------------------
+%macro P2S_H_24xN_avx2 1
+INIT_YMM avx2
+cglobal filterPixelToShort_24x%1, 3, 7, 4
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r4, [r1 * 3]
+    lea         r5, [r3 * 3]
+    mov         r6d, %1/4
+
+    ; load constant
+    vpbroadcastd m1, [pw_2000]
+    vpbroadcastd m2, [pb_128]
+    vpbroadcastd m3, [tab_c_64_n64]
+
+.loop:
+    pmovzxbw    m0, [r0]
+    psllw       m0, 6
+    psubw       m0, m1
+    movu        [r2], m0
+
+    movu        m0, [r0 + mmsize/2]
+    punpcklbw   m0, m2
+    pmaddubsw   m0, m3
+    movu        [r2 +  r3 * 0 + mmsize], xm0
+
+    pmovzxbw    m0, [r0 + r1]
+    psllw       m0, 6
+    psubw       m0, m1
+    movu        [r2 + r3], m0
+
+    movu        m0, [r0 + r1 + mmsize/2]
+    punpcklbw   m0, m2
+    pmaddubsw   m0, m3
+    movu        [r2 +  r3 * 1 + mmsize], xm0
+
+    pmovzxbw    m0, [r0 + r1 * 2]
+    psllw       m0, 6
+    psubw       m0, m1
+    movu        [r2 + r3 * 2], m0
+
+    movu        m0, [r0 + r1 * 2 + mmsize/2]
+    punpcklbw   m0, m2
+    pmaddubsw   m0, m3
+    movu        [r2 +  r3 * 2 + mmsize], xm0
+
+    pmovzxbw    m0, [r0 + r4]
+    psllw       m0, 6
+    psubw       m0, m1
+    movu        [r2 + r5], m0
+
+    movu        m0, [r0 + r4 + mmsize/2]
+    punpcklbw   m0, m2
+    pmaddubsw   m0, m3
+    movu        [r2 + r5 + mmsize], xm0
+
+    lea         r0, [r0 + r1 * 4]
+    lea         r2, [r2 + r3 * 4]
+
+    dec         r6d
+    jnz         .loop
+    RET
+%endmacro
+P2S_H_24xN_avx2 32
+P2S_H_24xN_avx2 64
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
+;-----------------------------------------------------------------------------
 INIT_XMM ssse3
 cglobal filterPixelToShort_48x64, 3, 7, 4
     mov         r3d, r3m
diff -r 984e254f93f7 -r 3ff907035681 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Thu Apr 09 11:48:08 2015 -0500
+++ b/source/common/x86/ipfilter8.h	Fri Apr 10 10:49:34 2015 +0530
@@ -689,6 +689,7 @@
 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);
 void x265_filterPixelToShort_48x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_filterPixelToShort_24x32_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