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

murugan at multicorewareinc.com murugan at multicorewareinc.com
Thu Dec 5 12:26:56 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1386242492 -19800
#      Thu Dec 05 16:51:32 2013 +0530
# Node ID 94c091c6d184680da9523fcc3aec5917e90787b0
# Parent  4f17d311db3e0a58dac851533e5db16b874d6bc2
asm: 10bpp code for pixel_sub_4xN

diff -r 4f17d311db3e -r 94c091c6d184 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Dec 05 15:58:08 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Dec 05 16:51:32 2013 +0530
@@ -573,6 +573,10 @@
 
     p.chroma[X265_CSP_I420].sub_ps[LUMA_4x8] = x265_pixel_sub_ps_2x4_sse2;
     p.chroma[X265_CSP_I420].sub_ps[LUMA_4x16] = x265_pixel_sub_ps_2x8_sse2;
+    p.chroma[X265_CSP_I420].sub_ps[LUMA_8x4] = x265_pixel_sub_ps_4x2_sse2;
+    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;
     }
     if (cpuMask & X265_CPU_SSSE3)
     {
diff -r 4f17d311db3e -r 94c091c6d184 source/common/x86/pixel-util8.asm
--- a/source/common/x86/pixel-util8.asm	Thu Dec 05 15:58:08 2013 +0530
+++ b/source/common/x86/pixel-util8.asm	Thu Dec 05 16:51:32 2013 +0530
@@ -2392,6 +2392,22 @@
 ;-----------------------------------------------------------------------------
 ; void pixel_sub_sp_c_4x2(int16_t *dest, intptr_t destride, pixel *src0, pixel *src1, intptr_t srcstride0, intptr_t srcstride1);
 ;-----------------------------------------------------------------------------
+%if HIGH_BIT_DEPTH
+INIT_XMM sse2
+cglobal pixel_sub_ps_4x2, 6, 6, 8, dest, deststride, src0, src1, srcstride0, srcstride1
+    add      r1,    r1
+    add      r4,    r4
+    add      r5,    r5
+    movh     m0,    [r2]
+    movh     m1,    [r3]
+    movh     m2,    [r2 + r4]
+    movh     m3,    [r3 + r5]
+    psubw    m0,    m1
+    psubw    m2,    m3
+
+    movh     [r0],         m0
+    movh     [r0 + r1],    m2
+%else
 INIT_XMM sse4
 cglobal pixel_sub_ps_4x2, 6, 6, 4, dest, deststride, src0, src1, srcstride0, srcstride1
 
@@ -2412,117 +2428,87 @@
 
 movlps    [r0],         m0
 movhps    [r0 + r1],    m0
-
-RET
-
-;-----------------------------------------------------------------------------
-; void pixel_sub_ps_c_4x4(int16_t *dest, intptr_t destride, pixel *src0, pixel *src1, intptr_t srcstride0, intptr_t srcstride1);
-;-----------------------------------------------------------------------------
-INIT_XMM sse4
-cglobal pixel_sub_ps_4x4, 6, 6, 8, dest, deststride, src0, src1, srcstride0, srcstride1
-
-add          r1,    r1
-
-movd         m0,    [r2]
-movd         m1,    [r3]
-
-movd         m2,    [r2 + r4]
-movd         m3,    [r3 + r5]
-
-movd         m4,    [r2 + 2 * r4]
-movd         m5,    [r3 + 2 * r5]
-
-lea          r2,    [r2 + 2 * r4]
-lea          r3,    [r3 + 2 * r5]
-
-movd         m6,    [r2 + r4]
-movd         m7,    [r3 + r5]
-
-punpckldq    m0,    m2
-punpckldq    m1,    m3
-punpckldq    m4,    m6
-punpckldq    m5,    m7
-
-pmovzxbw     m0,    m0
-pmovzxbw     m1,    m1
-pmovzxbw     m4,    m4
-pmovzxbw     m5,    m5
-
-psubw        m0,    m1
-psubw        m4,    m5
-
-movlps    [r0],             m0
-movhps    [r0 + r1],        m0
-movlps    [r0 + 2 * r1],    m4
-
-lea       r0,               [r0 + 2 * r1]
-
-movhps    [r0 + r1],        m4
-
+%endif
 RET
 
 ;-----------------------------------------------------------------------------
 ; 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_W4_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
-
+    mov    r6d,    %2/4
+    add          r1,    r1
+%if HIGH_BIT_DEPTH
+    add      r4,    r4
+    add      r5,    r5
 .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]
+    psubw    m0,    m1
+    psubw    m2,    m3
+    psubw    m4,    m5
+    psubw    m6,    m7
+
+    movh     [r0],           m0
+    movh     [r0 + r1],      m2
+    movh     [r0 + 2 * r1],  m4
+    lea      r0,             [r0 + 2 * r1]
+    movh     [r0 + r1],      m6
+%else
+.loop
     movd         m0,    [r2]
     movd         m1,    [r3]
-
     movd         m2,    [r2 + r4]
     movd         m3,    [r3 + r5]
-
     movd         m4,    [r2 + 2 * r4]
     movd         m5,    [r3 + 2 * r5]
-
     lea          r2,    [r2 + 2 * r4]
     lea          r3,    [r3 + 2 * r5]
-
     movd         m6,    [r2 + r4]
     movd         m7,    [r3 + r5]
-
     punpckldq    m0,    m2
     punpckldq    m1,    m3
     punpckldq    m4,    m6
     punpckldq    m5,    m7
-
     pmovzxbw     m0,    m0
     pmovzxbw     m1,    m1
     pmovzxbw     m4,    m4
     pmovzxbw     m5,    m5
-
     psubw        m0,    m1
     psubw        m4,    m5
 
     movlps    [r0],             m0
     movhps    [r0 + r1],        m0
     movlps    [r0 + 2 * r1],    m4
-
     lea       r0,               [r0 + 2 * r1]
-
     movhps    [r0 + r1],        m4
-
-    lea       r2,               [r2 + 2 * r4]
-    lea       r3,               [r3 + 2 * r5]
-    lea       r0,               [r0 + 2 * r1]
-
-    dec       r6d
-
-jnz    .loop
-
+%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_W4_H4 4, 4
 PIXELSUB_PS_W4_H4 4, 8
 PIXELSUB_PS_W4_H4 4, 16
-
+%else
+INIT_XMM sse4
+PIXELSUB_PS_W4_H4 4, 4
+PIXELSUB_PS_W4_H4 4, 8
+PIXELSUB_PS_W4_H4 4, 16
+%endif
 ;-----------------------------------------------------------------------------
 ; void pixel_sub_ps_c_%1x%2(int16_t *dest, intptr_t destride, pixel *src0, pixel *src1, intptr_t srcstride0, intptr_t srcstride1);
 ;-----------------------------------------------------------------------------


More information about the x265-devel mailing list