[x265] [PATCH] asm: sse4 8bpp code for convert_p2s[4xN]

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Wed Apr 1 15:11:04 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1427890518 -19800
#      Wed Apr 01 17:45:18 2015 +0530
# Node ID 5b77c75f87af668910020b52d3cd0bd88cdf5de9
# Parent  c26756d8ced6fe69e58b2bb77419b5f975a54de9
asm: sse4 8bpp code for convert_p2s[4xN]

     convert_p2s[4x4](2.95x), convert_p2s[4x8](3.22x), convert_p2s[4x16](3.59x)

diff -r c26756d8ced6 -r 5b77c75f87af source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Apr 01 17:27:13 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Apr 01 17:45:18 2015 +0530
@@ -1296,6 +1296,10 @@
         // MUST be done after LUMA_FILTERS() to overwrite default version
         p.pu[LUMA_8x8].luma_hvpp = x265_interp_8tap_hv_pp_8x8_sse4;
 
+        p.pu[LUMA_4x4].convert_p2s = x265_filterPixelToShort_4x4_sse4;
+        p.pu[LUMA_4x8].convert_p2s = x265_filterPixelToShort_4x8_sse4;
+        p.pu[LUMA_4x16].convert_p2s = x265_filterPixelToShort_4x16_sse4;
+
         LUMA_CU_BLOCKCOPY(ps, sse4);
         CHROMA_420_CU_BLOCKCOPY(ps, sse4);
         CHROMA_422_CU_BLOCKCOPY(ps, sse4);
diff -r c26756d8ced6 -r 5b77c75f87af source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Wed Apr 01 17:27:13 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Wed Apr 01 17:45:18 2015 +0530
@@ -7741,6 +7741,49 @@
 FILTER_V4_W16n_H2 48, 64
 FILTER_V4_W16n_H2 64, 16
 
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
+;-----------------------------------------------------------------------------
+%macro P2S_H_4xN 1
+INIT_XMM sse4
+cglobal filterPixelToShort_4x%1, 3, 6, 4
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r4, [r3 * 3]
+    lea         r5, [r1 * 3]
+
+    ; load constant
+    mova        m2, [pb_128]
+    mova        m3, [tab_c_64_n64]
+
+%assign x 0
+%rep %1/4
+    movd        m0, [r0]
+    pinsrd      m0, [r0 + r1], 1
+    punpcklbw   m0, m2
+    pmaddubsw   m0, m3
+
+    movd        m1, [r0 + r1 * 2]
+    pinsrd      m1, [r0 + r5], 1
+    punpcklbw   m1, m2
+    pmaddubsw   m1, m3
+
+    movq        [r2 + r3 * 0], m0
+    movq        [r2 + r3 * 2], m1
+    movhps      [r2 + r3 * 1], m0
+    movhps      [r2 + r4], m1
+%assign x x+1
+%if (x != %1/4)
+    lea         r0, [r0 + r1 * 4]
+    lea         r2, [r2 + r3 * 4]
+%endif
+%endrep
+    RET
+%endmacro
+P2S_H_4xN 4
+P2S_H_4xN 8
+P2S_H_4xN 16
+
 %macro PROCESS_LUMA_W4_4R 0
     movd        m0, [r0]
     movd        m1, [r0 + r1]
diff -r c26756d8ced6 -r 5b77c75f87af source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Wed Apr 01 17:27:13 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Wed Apr 01 17:45:18 2015 +0530
@@ -622,6 +622,9 @@
 LUMA_SP_FILTERS(_avx2);
 LUMA_SS_FILTERS(_avx2);
 void x265_interp_8tap_hv_pp_8x8_sse4(const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY);
+void x265_filterPixelToShort_4x4_sse4(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_4x8_sse4(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_4x16_sse4(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
 #undef LUMA_FILTERS
 #undef LUMA_SP_FILTERS
 #undef LUMA_SS_FILTERS


More information about the x265-devel mailing list