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

murugan at multicorewareinc.com murugan at multicorewareinc.com
Thu Mar 13 11:46:13 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1394698174 -19800
#      Thu Mar 13 13:39:34 2014 +0530
# Node ID 40cd2a0c4eb2a0cfe51b9b70cf60e46dfb0f248b
# Parent  ce89e417aaf51d29a44020c8834bf54fb17f2ea5
asm: code for input pixel upShif/downShift

diff -r ce89e417aaf5 -r 40cd2a0c4eb2 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	Thu Mar 13 13:39:34 2014 +0530
@@ -1047,6 +1047,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);
@@ -1165,6 +1166,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 ce89e417aaf5 -r 40cd2a0c4eb2 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	Thu Mar 13 13:39:34 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 ce89e417aaf5 -r 40cd2a0c4eb2 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	Thu Mar 13 13:39:34 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