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

murugan at multicorewareinc.com murugan at multicorewareinc.com
Fri Dec 6 15:26:29 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1386339955 -19800
#      Fri Dec 06 19:55:55 2013 +0530
# Node ID 317974188e984a63ea8e525b77c4842d2a711b1e
# Parent  9446f063e216ccf9e118371125ccce636860f16d
asm: 10bpp code for pixel_add_ps_2xN

diff -r 9446f063e216 -r 317974188e98 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Fri Dec 06 19:27:37 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp	Fri Dec 06 19:55:55 2013 +0530
@@ -663,6 +663,9 @@
 
         CHROMA_PIXELSUB_PS(_sse2);
         LUMA_PIXELSUB(_sse2);
+
+        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;
     }
     if (cpuMask & X265_CPU_SSSE3)
     {
diff -r 9446f063e216 -r 317974188e98 source/common/x86/pixeladd8.asm
--- a/source/common/x86/pixeladd8.asm	Fri Dec 06 19:27:37 2013 +0530
+++ b/source/common/x86/pixeladd8.asm	Fri Dec 06 19:55:55 2013 +0530
@@ -22,16 +22,54 @@
 ;*****************************************************************************/
 
 %include "x86inc.asm"
+%include "x86util.asm"
 
 SECTION_RODATA 32
 
 SECTION .text
 
-
+cextern pw_pixel_max
 
 ;-----------------------------------------------------------------------------
 ; void pixel_add_ps_2x4(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_2x4, 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]
+
+    movd     m0,    [r2]
+    movd     m1,    [r3]
+    movd     m2,    [r2 + r4]
+    movd     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movd     [r0],           m0
+    movd     [r0 + r1],      m2
+
+    lea      r2,    [r2 + 2 * r4]
+    lea      r3,    [r3 + 2 * r5]
+    lea      r0,    [r0 + 2 * r1]
+
+    movd     m0,    [r2]
+    movd     m1,    [r3]
+    movd     m2,    [r2 + r4]
+    movd     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movd     [r0],           m0
+    movd     [r0 + r1],      m2
+%else
 INIT_XMM sse4
 cglobal pixel_add_ps_2x4, 6, 6, 2, dest, destride, src0, scr1, srcStride0, srcStride1
 
@@ -72,7 +110,7 @@
 packuswb    m0,            m0
 
 pextrw      [r0 + r1],     m0,     0
-
+%endif
 RET
 
 
@@ -80,6 +118,44 @@
 ; 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_W2_H4 2
+%if HIGH_BIT_DEPTH
+INIT_XMM sse2
+cglobal pixel_add_ps_%1x%2, 6, 7, 6, dest, destride, src0, scr1, srcStride0, srcStride1
+    add      r1,    r1
+    add      r4,    r4
+    add      r5,    r5
+    pxor     m4,    m4
+    mov      r6d,   %2/4
+    mova     m5,    [pw_pixel_max]
+.loop
+    movd     m0,    [r2]
+    movd     m1,    [r3]
+    movd     m2,    [r2 + r4]
+    movd     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movd     [r0],           m0
+    movd     [r0 + r1],      m2
+
+    lea      r2,    [r2 + 2 * r4]
+    lea      r3,    [r3 + 2 * r5]
+    lea      r0,    [r0 + 2 * r1]
+
+    movd     m0,    [r2]
+    movd     m1,    [r3]
+    movd     m2,    [r2 + r4]
+    movd     m3,    [r3 + r5]
+    paddw    m0,    m1
+    paddw    m2,    m3
+    CLIPW    m0,    m4,    m5
+    CLIPW    m2,    m4,    m5
+
+    movd     [r0],           m0
+    movd     [r0 + r1],      m2
+%else
 INIT_XMM sse4
 cglobal pixel_add_ps_%1x%2, 6, 7, 2, dest, destride, src0, scr1, srcStride0, srcStride1
 
@@ -123,7 +199,7 @@
       packuswb    m0,            m0
 
       pextrw      [r0 + r1],     m0,      0
-
+%endif
       lea         r0,            [r0 + 2 * r1]
       lea         r2,            [r2 + 2 * r4]
       lea         r3,            [r3 + 2 * r5]


More information about the x265-devel mailing list