[x265] [PATCH] asm: 10bpp code for pixel_sub_6x8

murugan at multicorewareinc.com murugan at multicorewareinc.com
Thu Dec 5 13:49:48 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1386246769 -19800
#      Thu Dec 05 18:02:49 2013 +0530
# Node ID 94effcd1a8059a4e3822d74b15b644f170b666f3
# Parent  94c091c6d184680da9523fcc3aec5917e90787b0
asm: 10bpp code for pixel_sub_6x8

diff -r 94c091c6d184 -r 94effcd1a805 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Dec 05 16:51:32 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Dec 05 18:02:49 2013 +0530
@@ -577,6 +577,7 @@
     p.chroma[X265_CSP_I420].sub_ps[LUMA_8x8] = x265_pixel_sub_ps_4x4_sse2;
     p.chroma[X265_CSP_I420].sub_ps[LUMA_8x16] = x265_pixel_sub_ps_4x8_sse2;
     p.chroma[X265_CSP_I420].sub_ps[LUMA_8x32] = x265_pixel_sub_ps_4x16_sse2;
+    p.chroma[X265_CSP_I420].sub_ps[LUMA_12x16] = x265_pixel_sub_ps_6x8_sse2;
     }
     if (cpuMask & X265_CPU_SSSE3)
     {
diff -r 94c091c6d184 -r 94effcd1a805 source/common/x86/pixel-util8.asm
--- a/source/common/x86/pixel-util8.asm	Thu Dec 05 16:51:32 2013 +0530
+++ b/source/common/x86/pixel-util8.asm	Thu Dec 05 18:02:49 2013 +0530
@@ -2513,29 +2513,70 @@
 ; void pixel_sub_ps_c_%1x%2(int16_t *dest, intptr_t destride, pixel *src0, pixel *src1, intptr_t srcstride0, intptr_t srcstride1);
 ;-----------------------------------------------------------------------------
 %macro PIXELSUB_PS_W6_H4 2
-INIT_XMM sse4
 cglobal pixel_sub_ps_%1x%2, 6, 7, 8, dest, deststride, src0, src1, srcstride0, srcstride1
-
-add    r1,     r1
-mov    r6d,    %2/4
-
+    add    r1,     r1
+    mov    r6d,    %2/4
+%if HIGH_BIT_DEPTH
+    add         r4,    r4
+    add         r5,    r5
 .loop
-
+    movu        m0,    [r2]
+    movu        m1,    [r3]
+    movu        m2,    [r2 + r4]
+    movu        m3,    [r3 + r5]
+    mova        m4,    m0
+    mova        m5,    m1
+    mova        m6,    m2
+    mova        m7,    m3
+    punpckhqdq  m4,    m4
+    punpckhqdq  m5,    m5
+    punpckhqdq  m6,    m6
+    punpckhqdq  m7,    m7
+    psubw       m0,    m1
+    psubw       m2,    m3
+    psubw       m4,    m5
+    psubw       m6,    m7
+
+    lea      r2,    [r2 + 2 * r4]
+    lea      r3,    [r3 + 2 * r5]
+    movh     [r0],             m0
+    movd     [r0 + 8],         m4
+    movh     [r0 + r1],        m2
+    movd     [r0 + r1 + 8],    m6
+
+    movu        m0,    [r2]
+    movu        m1,    [r3]
+    movu        m2,    [r2 + r4]
+    movu        m3,    [r3 + r5]
+    mova        m4,    m0
+    mova        m5,    m1
+    mova        m6,    m2
+    mova        m7,    m3
+    punpckhqdq  m4,    m4
+    punpckhqdq  m5,    m5
+    punpckhqdq  m6,    m6
+    punpckhqdq  m7,    m7
+    psubw       m0,    m1
+    psubw       m2,    m3
+    psubw       m4,    m5
+    psubw       m6,    m7
+    lea      r0,    [r0 + 2 * r1]
+    movh     [r0],             m0
+    movd     [r0 + 8],         m4
+    movh     [r0 + r1],        m2
+    movd     [r0 + r1 + 8],    m6
+%else
+.loop
     movh        m0,    [r2]
     movh        m1,    [r3]
-
     movh        m2,    [r2 + r4]
     movh        m3,    [r3 + r5]
-
     movh        m4,    [r2 + 2 * r4]
     movh        m5,    [r3 + 2 * r5]
-
     lea         r2,    [r2 + 2 * r4]
     lea         r3,    [r3 + 2 * r5]
-
     movh        m6,    [r2 + r4]
     movh        m7,    [r3 + r5]
-
     pmovzxbw    m0,    m0
     pmovzxbw    m1,    m1
     pmovzxbw    m2,    m2
@@ -2544,7 +2585,6 @@
     pmovzxbw    m5,    m5
     pmovzxbw    m6,    m6
     pmovzxbw    m7,    m7
-
     psubw       m0,    m1
     psubw       m2,    m3
     psubw       m4,    m5
@@ -2556,25 +2596,25 @@
     pextrd    [r0 + r1 + 8],        m2,    2
     movh      [r0 + 2* r1],         m4
     pextrd    [r0 + 2 * r1 + 8],    m4,    2
-
     lea       r0,                   [r0 + 2 * r1]
-
     movh      [r0 + r1],            m6
     pextrd    [r0 + r1 + 8],        m6,    2
-
-    lea       r2,                   [r2 + 2 * r4]
-    lea       r3,                   [r3 + 2 * r5]
-    lea       r0,                   [r0 + 2 * r1]
-
-    dec     r6d
-
+%endif
+    dec    r6d
+    lea    r2,    [r2 + 2 * r4]
+    lea    r3,    [r3 + 2 * r5]
+    lea    r0,    [r0 + 2 * r1]
 jnz    .loop
-
 RET
 %endmacro
 
+%if HIGH_BIT_DEPTH
+INIT_XMM sse2
 PIXELSUB_PS_W6_H4 6, 8
-
+%else
+INIT_XMM sse4
+PIXELSUB_PS_W6_H4 6, 8
+%endif
 ;-----------------------------------------------------------------------------
 ; void pixel_sub_ps_c_8x2(int16_t *dest, intptr_t destride, pixel *src0, pixel *src1, intptr_t srcstride0, intptr_t srcstride1);
 ;-----------------------------------------------------------------------------


More information about the x265-devel mailing list