[x265] [PATCH] asm: ssse3 10bit code for convert_p2s[12xN], [48x64]

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


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1429104844 -19800
#      Wed Apr 15 19:04:04 2015 +0530
# Node ID 42d5394a0eb22f7e1126aca2dfa98f5d01d373b0
# Parent  f9c0e1f233cc15ccce4eb96adef11583af082f33
asm: ssse3 10bit code for convert_p2s[12xN],[48x64]

     convert_p2s[12x16](11.37x), convert_p2s[48x64](10.50x)

diff -r f9c0e1f233cc -r 42d5394a0eb2 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Apr 15 16:20:27 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Apr 15 19:04:04 2015 +0530
@@ -972,6 +972,8 @@
         p.pu[LUMA_64x48].convert_p2s = x265_filterPixelToShort_64x48_ssse3;
         p.pu[LUMA_64x64].convert_p2s = x265_filterPixelToShort_64x64_ssse3;
         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;
     }
     if (cpuMask & X265_CPU_SSE4)
     {
diff -r f9c0e1f233cc -r 42d5394a0eb2 source/common/x86/ipfilter16.asm
--- a/source/common/x86/ipfilter16.asm	Wed Apr 15 16:20:27 2015 +0530
+++ b/source/common/x86/ipfilter16.asm	Wed Apr 15 19:04:04 2015 +0530
@@ -6055,3 +6055,201 @@
 %endmacro
 P2S_H_24xN 32
 P2S_H_24xN 64
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
+%macro P2S_H_12xN 1
+INIT_XMM ssse3
+cglobal filterPixelToShort_12x%1, 3, 7, 3
+    add        r1d, r1d
+    mov        r3d, r3m
+    add        r3d, r3d
+    lea        r4, [r3 * 3]
+    lea        r5, [r1 * 3]
+
+    ; load height
+    mov        r6d, %1/4
+
+    ; load constant
+    mova       m2, [pw_2000]
+
+.loop
+    movu       m0, [r0]
+    movu       m1, [r0 + r1]
+    psllw      m0, 4
+    psubw      m0, m2
+    psllw      m1, 4
+    psubw      m1, m2
+
+    movu       [r2 + r3 * 0], m0
+    movu       [r2 + r3 * 1], m1
+
+    movu       m0, [r0 + r1 * 2]
+    movu       m1, [r0 + r5]
+    psllw      m0, 4
+    psubw      m0, m2
+    psllw      m1, 4
+    psubw      m1, m2
+
+    movu       [r2 + r3 * 2], m0
+    movu       [r2 + r4], m1
+
+    movh       m0, [r0 + 16]
+    movhps     m0, [r0 + r1 + 16]
+    psllw      m0, 4
+    psubw      m0, m2
+
+    movh       [r2 + r3 * 0 + 16], m0
+    movhps     [r2 + r3 * 1 + 16], m0
+
+    movh       m0, [r0 + r1 * 2 + 16]
+    movhps     m0, [r0 + r5 + 16]
+    psllw      m0, 4
+    psubw      m0, m2
+
+    movh       [r2 + r3 * 2 + 16], m0
+    movhps     [r2 + r4 + 16], m0
+
+    lea        r0, [r0 + r1 * 4]
+    lea        r2, [r2 + r3 * 4]
+
+    dec        r6d
+    jnz        .loop
+    RET
+%endmacro
+P2S_H_12xN 16
+P2S_H_12xN 32
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride)
+;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal filterPixelToShort_48x64, 3, 7, 5
+    add        r1d, r1d
+    mov        r3d, r3m
+    add        r3d, r3d
+    lea        r4, [r3 * 3]
+    lea        r5, [r1 * 3]
+
+    ; load height
+    mov        r6d, 16
+
+    ; load constant
+    mova       m4, [pw_2000]
+
+.loop
+    movu       m0, [r0]
+    movu       m1, [r0 + r1]
+    movu       m2, [r0 + r1 * 2]
+    movu       m3, [r0 + r5]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0], m0
+    movu       [r2 + r3 * 1], m1
+    movu       [r2 + r3 * 2], m2
+    movu       [r2 + r4], m3
+
+    movu       m0, [r0 + 16]
+    movu       m1, [r0 + r1 + 16]
+    movu       m2, [r0 + r1 * 2 + 16]
+    movu       m3, [r0 + r5 + 16]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0 + 16], m0
+    movu       [r2 + r3 * 1 + 16], m1
+    movu       [r2 + r3 * 2 + 16], m2
+    movu       [r2 + r4 + 16], m3
+
+    movu       m0, [r0 + 32]
+    movu       m1, [r0 + r1 + 32]
+    movu       m2, [r0 + r1 * 2 + 32]
+    movu       m3, [r0 + r5 + 32]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0 + 32], m0
+    movu       [r2 + r3 * 1 + 32], m1
+    movu       [r2 + r3 * 2 + 32], m2
+    movu       [r2 + r4 + 32], m3
+
+    movu       m0, [r0 + 48]
+    movu       m1, [r0 + r1 + 48]
+    movu       m2, [r0 + r1 * 2 + 48]
+    movu       m3, [r0 + r5 + 48]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0 + 48], m0
+    movu       [r2 + r3 * 1 + 48], m1
+    movu       [r2 + r3 * 2 + 48], m2
+    movu       [r2 + r4 + 48], m3
+
+    movu       m0, [r0 + 64]
+    movu       m1, [r0 + r1 + 64]
+    movu       m2, [r0 + r1 * 2 + 64]
+    movu       m3, [r0 + r5 + 64]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0 + 64], m0
+    movu       [r2 + r3 * 1 + 64], m1
+    movu       [r2 + r3 * 2 + 64], m2
+    movu       [r2 + r4 + 64], m3
+
+    movu       m0, [r0 + 80]
+    movu       m1, [r0 + r1 + 80]
+    movu       m2, [r0 + r1 * 2 + 80]
+    movu       m3, [r0 + r5 + 80]
+    psllw      m0, 4
+    psubw      m0, m4
+    psllw      m1, 4
+    psubw      m1, m4
+    psllw      m2, 4
+    psubw      m2, m4
+    psllw      m3, 4
+    psubw      m3, m4
+
+    movu       [r2 + r3 * 0 + 80], m0
+    movu       [r2 + r3 * 1 + 80], m1
+    movu       [r2 + r3 * 2 + 80], m2
+    movu       [r2 + r4 + 80], m3
+
+    lea        r0, [r0 + r1 * 4]
+    lea        r2, [r2 + r3 * 4]
+
+    dec        r6d
+    jnz        .loop
+    RET
diff -r f9c0e1f233cc -r 42d5394a0eb2 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Wed Apr 15 16:20:27 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Wed Apr 15 19:04:04 2015 +0530
@@ -312,6 +312,8 @@
 void x265_filterPixelToShort_64x48_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 void x265_filterPixelToShort_64x64_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_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);
 
 CHROMA_420_VERT_FILTERS(_sse2);
 CHROMA_420_HORIZ_FILTERS(_sse4);


More information about the x265-devel mailing list