[x265] [PATCH] asm: ssse3 10bit code for chroma_p2s[4x2], [8x2], [8x6]

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Thu Apr 16 08:18:17 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1429105570 -19800
#      Wed Apr 15 19:16:10 2015 +0530
# Node ID fbfcf28a6485f61ea5ed707e4ca04b9e348f29e2
# Parent  42d5394a0eb22f7e1126aca2dfa98f5d01d373b0
asm: ssse3 10bit code for chroma_p2s[4x2],[8x2],[8x6]

     chroma_p2s[i420][4x2](2.52x), chroma_p2s[i420][8x2](3.59x),
     chroma_p2s[i420][8x6](5.09x)

diff -r 42d5394a0eb2 -r fbfcf28a6485 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Apr 15 19:04:04 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Apr 15 19:16:10 2015 +0530
@@ -974,6 +974,10 @@
         p.pu[LUMA_24x32].convert_p2s = x265_filterPixelToShort_24x32_ssse3;
         p.pu[LUMA_12x16].convert_p2s = x265_filterPixelToShort_12x16_ssse3;
         p.pu[LUMA_48x64].convert_p2s = x265_filterPixelToShort_48x64_ssse3;
+
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x2].p2s = x265_filterPixelToShort_4x2_ssse3;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x2].p2s = x265_filterPixelToShort_8x2_ssse3;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x6].p2s = x265_filterPixelToShort_8x6_ssse3;
     }
     if (cpuMask & X265_CPU_SSE4)
     {
diff -r 42d5394a0eb2 -r fbfcf28a6485 source/common/x86/ipfilter16.asm
--- a/source/common/x86/ipfilter16.asm	Wed Apr 15 19:04:04 2015 +0530
+++ b/source/common/x86/ipfilter16.asm	Wed Apr 15 19:16:10 2015 +0530
@@ -5569,6 +5569,24 @@
 ;-----------------------------------------------------------------------------
 ; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
 ;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal filterPixelToShort_4x2, 3, 4, 1
+    add        r1d, r1d
+    mov        r3d, r3m
+    add        r3d, r3d
+
+    movh       m0, [r0]
+    movhps     m0, [r0 + r1]
+    psllw      m0, 4
+    psubw      m0, [pw_2000]
+    movh       [r2 + r3 * 0], m0
+    movhps     [r2 + r3 * 1], m0
+
+    RET
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
 %macro P2S_H_8xN 1
 INIT_XMM ssse3
 cglobal filterPixelToShort_8x%1, 3, 7, 2
@@ -5622,6 +5640,76 @@
 ;-----------------------------------------------------------------------------
 ; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
 ;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal filterPixelToShort_8x2, 3, 4, 2
+    add        r1d, r1d
+    mov        r3d, r3m
+    add        r3d, r3d
+
+    movu       m0, [r0]
+    movu       m1, [r0 + r1]
+
+    psllw      m0, 4
+    psubw      m0, [pw_2000]
+    psllw      m1, 4
+    psubw      m1, [pw_2000]
+
+    movu       [r2 + r3 * 0], m0
+    movu       [r2 + r3 * 1], m1
+
+    RET
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal filterPixelToShort_8x6, 3, 7, 4
+    add        r1d, r1d
+    mov        r3d, r3m
+    add        r3d, r3d
+    lea        r4, [r1 * 3]
+    lea        r5, [r1 * 5]
+    lea        r6, [r3 * 3]
+
+    ; load constant
+    mova       m3, [pw_2000]
+
+    movu       m0, [r0]
+    movu       m1, [r0 + r1]
+    movu       m2, [r0 + r1 * 2]
+
+    psllw      m0, 4
+    psubw      m0, m3
+    psllw      m1, 4
+    psubw      m1, m3
+    psllw      m2, 4
+    psubw      m2, m3
+
+    movu       [r2 + r3 * 0], m0
+    movu       [r2 + r3 * 1], m1
+    movu       [r2 + r3 * 2], m2
+
+    movu       m0, [r0 + r4]
+    movu       m1, [r0 + r1 * 4]
+    movu       m2, [r0 + r5 ]
+
+    psllw      m0, 4
+    psubw      m0, m3
+    psllw      m1, 4
+    psubw      m1, m3
+    psllw      m2, 4
+    psubw      m2, m3
+
+    movu       [r2 + r6], m0
+    movu       [r2 + r3 * 4], m1
+    lea        r2, [r2 + r3 * 4]
+    movu       [r2 + r3], m2
+
+    RET
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
 %macro P2S_H_16xN 1
 INIT_XMM ssse3
 cglobal filterPixelToShort_16x%1, 3, 7, 3
diff -r 42d5394a0eb2 -r fbfcf28a6485 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Wed Apr 15 19:04:04 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Wed Apr 15 19:16:10 2015 +0530
@@ -315,9 +315,18 @@
 void x265_filterPixelToShort_12x16_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);
 
+#define SETUP_CHROMA_P2S_FUNC_DEF(W, H, cpu) \
+    void x265_filterPixelToShort_ ## W ## x ## H ## cpu(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+
+#define CHROMA_420_P2S_FILTERS_SSSE3(cpu) \
+    SETUP_CHROMA_P2S_FUNC_DEF(4, 2, cpu); \
+    SETUP_CHROMA_P2S_FUNC_DEF(8, 2, cpu); \
+    SETUP_CHROMA_P2S_FUNC_DEF(8, 6, cpu);
+
 CHROMA_420_VERT_FILTERS(_sse2);
 CHROMA_420_HORIZ_FILTERS(_sse4);
 CHROMA_420_VERT_FILTERS_SSE4(_sse4);
+CHROMA_420_P2S_FILTERS_SSSE3(_ssse3);
 
 CHROMA_422_VERT_FILTERS(_sse2);
 CHROMA_422_HORIZ_FILTERS(_sse4);


More information about the x265-devel mailing list