[x265] [PATCH] asm: code for input pixel upShift/downShift

murugan at multicorewareinc.com murugan at multicorewareinc.com
Fri Mar 14 14:06:53 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1394784843 -19800
#      Fri Mar 14 13:44:03 2014 +0530
# Node ID 52d837842dbbcfca3609ecc6f1494ae7ddd82257
# Parent  ea43e61d88dacb1942f491d630e6fcd11a2e658e
asm: code for input pixel upShift/downShift

diff -r ea43e61d88da -r 52d837842dbb source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Mar 13 13:35:12 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Fri Mar 14 13:44:03 2014 +0530
@@ -1048,6 +1048,7 @@
         p.intra_pred[BLOCK_8x8][1] = x265_intra_pred_dc8_sse4;
         p.intra_pred[BLOCK_16x16][1] = x265_intra_pred_dc16_sse4;
         p.intra_pred[BLOCK_32x32][1] = x265_intra_pred_dc32_sse4;
+        p.upShift = x265_upShift_sse4;
 
         INTRA_ANG_SSE4_COMMON(sse4);
         INTRA_ANG_SSE4_HIGH(sse4);
@@ -1166,6 +1167,7 @@
         p.idct[IDCT_4x4] = x265_idct4_sse2;
         p.idct[IDST_4x4] = x265_idst4_sse2;
         p.count_nonzero = x265_count_nonzero_sse2;
+        p.downShift = x265_downShift_sse2;
     }
     if (cpuMask & X265_CPU_SSSE3)
     {
diff -r ea43e61d88da -r 52d837842dbb source/common/x86/pixel-a.asm
--- a/source/common/x86/pixel-a.asm	Thu Mar 13 13:35:12 2014 +0530
+++ b/source/common/x86/pixel-a.asm	Fri Mar 14 13:44:03 2014 +0530
@@ -6356,3 +6356,68 @@
     RET
 %endif ; HIGH_BIT_DEPTH
 
+; Input 16bpp, Output 8bpp, width is multiple of 16
+;------------------------------------------------------------------------------------------------------------------------
+;void downShift(uint16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, int shift, uint16_t mask)
+;------------------------------------------------------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal downShift, 7,7,3
+    movd        m0, r6d        ; m0 = shift
+    sub         r1d, r4d
+    sub         r3d, r4d
+    add         r1, r1
+.loopH:
+    mov         r6d, r4d
+    shr         r6d, 4
+.loopW:
+    movu        m1, [r0]
+    movu        m2, [r0 + mmsize]
+    psrlw       m1, m0
+    psrlw       m2, m0
+    packuswb    m1, m2
+    movu        [r2], m1
+
+    add         r0, 2 * mmsize
+    add         r2, mmsize
+    dec         r6d
+    jnz        .loopW
+
+    ; move to next row
+    add         r0, r1
+    add         r2, r3
+    dec         r5d
+    jnz        .loopH
+    RET
+
+; Input 8bpp, Output 16bpp, width is multiple of 16
+;-----------------------------------------------------------------------------------------------------
+;void upShift(uint8_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height)
+;-----------------------------------------------------------------------------------------------------
+INIT_XMM sse4
+cglobal upShift, 6,7,2
+
+    sub         r1d, r4d
+    sub         r3d, r4d
+    add         r3, r3
+.loopH:
+    mov         r6d, r4d
+    shr         r6d, 4
+.loopW:
+    pmovzxbw    m0,[r0]
+    pmovzxbw    m1,[r0 + 8]
+    psllw       m0, 2
+    psllw       m1, 2
+    movu        [r2], m0
+    movu        [r2 + mmsize], m1
+
+    add         r0, mmsize
+    add         r2, 2 * mmsize
+    dec         r6d
+    jnz        .loopW
+
+    ; move to next row
+    add         r0, r1
+    add         r2, r3
+    dec         r5d
+    jnz        .loopH
+    RET
diff -r ea43e61d88da -r 52d837842dbb source/common/x86/pixel.h
--- a/source/common/x86/pixel.h	Thu Mar 13 13:35:12 2014 +0530
+++ b/source/common/x86/pixel.h	Fri Mar 14 13:44:03 2014 +0530
@@ -200,6 +200,9 @@
 ADDAVG(addAvg_64x48)
 ADDAVG(addAvg_64x64)
 
+void x265_downShift_sse2(uint16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, int shift, uint16_t mask);
+void x265_upShift_sse4(uint8_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height);
+
 #undef DECL_PIXELS
 #undef DECL_HEVC_SSD
 #undef DECL_X1


More information about the x265-devel mailing list