[x265] [PATCH] asm:intra pred dc4 sse2 high bit

dtyx265 at gmail.com dtyx265 at gmail.com
Fri Feb 27 03:07:27 CET 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1425002675 28800
# Node ID 49f5199f9f2599bd9acc69c8236313806bbb6142
# Parent  394c2f94a2dc5d0e9e6d1c063361b19b86b88cf6
asm:intra pred dc4 sse2 high bit

This replaces c code for systems using ssse3 to sse2 processors
The code is backported from intrapred dc8 sse4 high bit

./test/TestBench --testbench intrapred
Testing only harnesses that match name <intrapred>
Using random seed 54EFCF77 16bpp
Testing primitives: SSE2
Testing primitives: SSE3

Test performance improvement with full optimizations
== intrapred primitives ==
intra_dc_4x4[f=0]	1.57x 	 162.76   	 254.85
intra_dc_4x4[f=1]	1.18x 	 405.17   	 477.99

diff -r 394c2f94a2dc -r 49f5199f9f25 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Feb 26 15:26:39 2015 -0600
+++ b/source/common/x86/asm-primitives.cpp	Thu Feb 26 18:04:35 2015 -0800
@@ -868,6 +868,8 @@
         ALL_LUMA_TU_S(calcresidual, getResidual, sse2);
         ALL_LUMA_TU_S(transpose, transpose, sse2);
 
+        p.cu[BLOCK_4x4].intra_pred[DC_IDX] = x265_intra_pred_dc4_sse2;
+
         p.cu[BLOCK_4x4].sse_ss = x265_pixel_ssd_ss_4x4_mmx2;
         ALL_LUMA_CU(sse_ss, pixel_ssd_ss, sse2);
 
diff -r 394c2f94a2dc -r 49f5199f9f25 source/common/x86/intrapred16.asm
--- a/source/common/x86/intrapred16.asm	Thu Feb 26 15:26:39 2015 -0600
+++ b/source/common/x86/intrapred16.asm	Thu Feb 26 18:04:35 2015 -0800
@@ -82,6 +82,7 @@
 SECTION .text
 
 cextern pw_1
+cextern pw_2
 cextern pw_4
 cextern pw_8
 cextern pw_16
@@ -99,6 +100,71 @@
 ;-----------------------------------------------------------------------------------
 ; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* above, int, int filter)
 ;-----------------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal intra_pred_dc4, 5,6,2
+    lea         r3,             [r2 + 18]
+    add         r2,             2
+
+    movh        m0,             [r3]           ; sumAbove
+    movh        m1,             [r2]           ; sumLeft
+
+    paddw       m0,             m1
+    pshuflw     m1,             m0, 0x4E
+    paddw       m0,             m1
+    pshuflw     m1,             m0, 0x1B
+    paddw       m0,             m1
+
+    test        r4d,            r4d
+
+    paddw       m0,             [pw_4]
+    psraw       m0,             3
+
+    ; store DC 4x4
+    movh        [r0],           m0
+    movh        [r0 + r1 * 2],  m0
+    movh        [r0 + r1 * 4],  m0
+    lea         r5,             [r0 + r1 * 4]
+    movh        [r5 + r1 * 2],  m0
+
+    ; do DC filter
+    jz          .end
+    movh        m1,             [pw_2]
+    pmullw      m1,             m0
+    paddw       m1,             [pw_2]
+    movd        r5d,            m1
+    paddw       m0,             m1
+    ; filter top
+    movh        m1,             [r2]
+    paddw       m1,             m0
+    psraw       m1,             2
+    movh        [r0],           m1             ; overwrite top-left pixel, we will update it later
+
+    ; filter top-left
+    movzx       r5d,            r5w
+    movzx       r4d, word       [r3]
+    add         r5d,            r4d
+    movzx       r4d, word       [r2]
+    add         r4d,            r5d
+    shr         r4d,            2
+    mov         [r0],           r4w
+
+    ; filter left
+    lea         r0,             [r0 + r1 * 2]
+    movu        m1,             [r3 + 2]
+    paddw       m1,             m0
+    psraw       m1,             2
+    movd        r3d,            m1
+    mov         [r0],           r3w
+    shr         r3d,            16
+    mov         [r0 + r1 * 2],  r3w
+    pextrw      r3d,  m1, 2
+    mov         [r0 + r1 * 4],  r3w
+.end:
+    RET
+
+;-----------------------------------------------------------------------------------
+; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* above, int, int filter)
+;-----------------------------------------------------------------------------------
 INIT_XMM sse4
 cglobal intra_pred_dc4, 5,6,2
     lea         r3,             [r2 + 18]


More information about the x265-devel mailing list