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

murugan at multicorewareinc.com murugan at multicorewareinc.com
Fri Dec 6 19:07:23 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1386353230 -19800
#      Fri Dec 06 23:37:10 2013 +0530
# Node ID f0cafd206c81a2bcd20b9e828f7742eb282c4d2b
# Parent  c093e78470257bbaecb9e3b03707a598e1b6ef69
asm: 10bpp code for pixel_add_ps_4xN

diff -r c093e7847025 -r f0cafd206c81 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Fri Dec 06 22:41:10 2013 +0550
+++ b/source/common/x86/asm-primitives.cpp	Fri Dec 06 23:37:10 2013 +0530
@@ -666,6 +666,10 @@
 
         p.chroma[X265_CSP_I420].add_ps[CHROMA_2x4] = x265_pixel_add_ps_2x4_sse2;
         p.chroma[X265_CSP_I420].add_ps[CHROMA_2x8] = x265_pixel_add_ps_2x8_sse2;
+        p.chroma[X265_CSP_I420].add_ps[CHROMA_4x2] = x265_pixel_add_ps_4x2_sse2;
+        p.chroma[X265_CSP_I420].add_ps[CHROMA_4x4] = x265_pixel_add_ps_4x4_sse2;
+        p.chroma[X265_CSP_I420].add_ps[CHROMA_4x8] = x265_pixel_add_ps_4x8_sse2;
+        p.chroma[X265_CSP_I420].add_ps[CHROMA_4x16] = x265_pixel_add_ps_4x16_sse2;
     }
     if (cpuMask & X265_CPU_SSSE3)
     {
diff -r c093e7847025 -r f0cafd206c81 source/common/x86/pixeladd8.asm
--- a/source/common/x86/pixeladd8.asm	Fri Dec 06 22:41:10 2013 +0550
+++ b/source/common/x86/pixeladd8.asm	Fri Dec 06 23:37:10 2013 +0530
@@ -215,6 +215,27 @@
 ;-----------------------------------------------------------------------------
 ; void pixel_add_ps_4x2(pixel *dest, intptr_t destride, pixel *src0, int16_t *scr1, intptr_t srcStride0, intptr_t srcStride1)
 ;-----------------------------------------------------------------------------
+%if HIGH_BIT_DEPTH
+INIT_XMM sse2
+cglobal pixel_add_ps_4x2, 6, 6, 6, dest, destride, src0, scr1, srcStride0, srcStride1
+    add      r1,    r1
+    add      r4,    r4
+    add      r5,    r5
+    pxor     m4,    m4
+    mova     m5,    [pw_pixel_max]
+
+    movh     m0,    [r2]
+    movh     m1,    [r3]
+    movh     m2,    [r2 + r4]
+    movh     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movh     [r0],           m0
+    movh     [r0 + r1],      m2
+%else
 INIT_XMM sse4
 cglobal pixel_add_ps_4x2, 6, 6, 2, dest, destride, src0, scr1, srcStride0, srcStride1
 
@@ -235,59 +256,51 @@
 packuswb    m0,            m0
 
 movd        [r0 + r1],     m0
-
-RET
-
-;-----------------------------------------------------------------------------
-; void pixel_add_ps_4x4(pixel *dest, intptr_t destride, pixel *src0, int16_t *scr1, intptr_t srcStride0, intptr_t srcStride1)
-;-----------------------------------------------------------------------------
-INIT_XMM sse4
-cglobal pixel_add_ps_4x4, 6, 6, 2, dest, destride, src0, scr1, srcStride0, srcStride1
-
-add         r5,            r5
-
-pmovzxbw    m0,            [r2]
-movh        m1,            [r3]
-
-paddw       m0,            m1
-packuswb    m0,            m0
-
-movd        [r0],          m0
-
-pmovzxbw    m0,            [r2 + r4]
-movh        m1,            [r3 + r5]
-
-paddw       m0,            m1
-packuswb    m0,            m0
-
-movd        [r0 + r1],     m0
-
-pmovzxbw    m0,            [r2 + 2 * r4]
-movh        m1,            [r3 + 2 * r5]
-
-paddw       m0,            m1
-packuswb    m0,            m0
-
-movd        [r0 + 2 * r1], m0
-
-lea         r0,            [r0 + 2 * r1]
-lea         r2,            [r2 + 2 * r4]
-lea         r3,            [r3 + 2 * r5]
-
-pmovzxbw    m0,            [r2 + r4]
-movh        m1,            [r3 + r5]
-
-paddw       m0,            m1
-packuswb    m0,            m0
-
-movd        [r0 + r1],     m0
-
+%endif
 RET
 
 ;-----------------------------------------------------------------------------
 ; void pixel_add_ps_%1x%2(pixel *dest, intptr_t destride, pixel *src0, int16_t *scr1, intptr_t srcStride0, intptr_t srcStride1)
 ;-----------------------------------------------------------------------------
 %macro PIXEL_ADD_PS_W4_H4 2
+%if HIGH_BIT_DEPTH
+INIT_XMM sse2
+cglobal pixel_add_ps_%1x%2, 6, 7, 6, dest, destride, src0, scr1, srcStride0, srcStride1
+    mov     r6d,    %2/4
+    add      r1,    r1
+    add      r4,    r4
+    add      r5,    r5
+    pxor     m4,    m4
+    mova     m5,    [pw_pixel_max]
+.loop
+    movh     m0,    [r2]
+    movh     m1,    [r3]
+    movh     m2,    [r2 + r4]
+    movh     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movh     [r0],           m0
+    movh     [r0 + r1],      m2
+
+    lea      r2,    [r2 + 2 * r4]
+    lea      r3,    [r3 + 2 * r5]
+    lea      r0,    [r0 + 2 * r1]
+
+    movh     m0,    [r2]
+    movh     m1,    [r3]
+    movh     m2,    [r2 + r4]
+    movh     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movh     [r0],           m0
+    movh     [r0 + r1],      m2
+%else
 INIT_XMM sse4
 cglobal pixel_add_ps_%1x%2, 6, 7, 2, dest, destride, src0, scr1, srcStride0, srcStride1
 
@@ -296,52 +309,53 @@
 mov         r6d,           %2/4
 
 .loop
-      pmovzxbw    m0,            [r2]
-      movh        m1,            [r3]
 
-      paddw       m0,            m1
-      packuswb    m0,            m0
+    pmovzxbw    m0,            [r2]
+    movh        m1,            [r3]
 
-      movd        [r0],          m0
+    paddw       m0,            m1
+    packuswb    m0,            m0
 
-      pmovzxbw    m0,            [r2 + r4]
-      movh        m1,            [r3 + r5]
+    movd        [r0],          m0
 
-      paddw       m0,            m1
-      packuswb    m0,            m0
+    pmovzxbw    m0,            [r2 + r4]
+    movh        m1,            [r3 + r5]
 
-      movd        [r0 + r1],     m0
+    paddw       m0,            m1
+    packuswb    m0,            m0
 
-      pmovzxbw    m0,            [r2 + 2 * r4]
-      movh        m1,            [r3 + 2 * r5]
+    movd        [r0 + r1],     m0
 
-      paddw       m0,            m1
-      packuswb    m0,            m0
+    pmovzxbw    m0,            [r2 + 2 * r4]
+    movh        m1,            [r3 + 2 * r5]
 
-      movd        [r0 + 2 * r1], m0
+    paddw       m0,            m1
+    packuswb    m0,            m0
 
-      lea         r0,            [r0 + 2 * r1]
-      lea         r2,            [r2 + 2 * r4]
-      lea         r3,            [r3 + 2 * r5]
+    movd        [r0 + 2 * r1], m0
 
-      pmovzxbw    m0,            [r2 + r4]
-      movh        m1,            [r3 + r5]
+    lea         r0,            [r0 + 2 * r1]
+    lea         r2,            [r2 + 2 * r4]
+    lea         r3,            [r3 + 2 * r5]
 
-      paddw       m0,            m1
-      packuswb    m0,            m0
+    pmovzxbw    m0,            [r2 + r4]
+    movh        m1,            [r3 + r5]
 
-      movd        [r0 + r1],     m0
+    paddw       m0,            m1
+    packuswb    m0,            m0
 
-      lea         r0,            [r0 + 2 * r1]
-      lea         r2,            [r2 + 2 * r4]
-      lea         r3,            [r3 + 2 * r5]
-
-      dec         r6d
-      jnz         .loop
+    movd        [r0 + r1],     m0
+%endif
+    dec         r6d
+    lea         r0,            [r0 + 2 * r1]
+    lea         r2,            [r2 + 2 * r4]
+    lea         r3,            [r3 + 2 * r5]
+    jnz         .loop
 
 RET
 %endmacro
 
+PIXEL_ADD_PS_W4_H4   4,  4
 PIXEL_ADD_PS_W4_H4   4,  8
 PIXEL_ADD_PS_W4_H4   4, 16
 


More information about the x265-devel mailing list