[x265] [PATCH] asm: intrapred dc8 sse2 high bit

dtyx265 at gmail.com dtyx265 at gmail.com
Fri Feb 27 06:04:56 CET 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1425013413 28800
# Node ID 30df8e0058c7ca1fe1a59a7e8bce344071348641
# Parent  fb806a6bebfa6312a2657b1978162f0c3e4ef2b9
asm: intrapred dc8 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 | grep 8x8
intra_dc_8x8[f=0]	1.64x 	 443.75   	 729.49
intra_dc_8x8[f=1]	1.61x 	 720.21   	 1160.18

diff -r fb806a6bebfa -r 30df8e0058c7 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Feb 26 18:59:18 2015 -0800
+++ b/source/common/x86/asm-primitives.cpp	Thu Feb 26 21:03:33 2015 -0800
@@ -869,6 +869,7 @@
         ALL_LUMA_TU_S(transpose, transpose, sse2);
 
         p.cu[BLOCK_4x4].intra_pred[DC_IDX] = x265_intra_pred_dc4_sse2;
+        p.cu[BLOCK_8x8].intra_pred[DC_IDX] = x265_intra_pred_dc8_sse2;
 
         p.cu[BLOCK_4x4].sse_ss = x265_pixel_ssd_ss_4x4_mmx2;
         ALL_LUMA_CU(sse_ss, pixel_ssd_ss, sse2);
diff -r fb806a6bebfa -r 30df8e0058c7 source/common/x86/intrapred16.asm
--- a/source/common/x86/intrapred16.asm	Thu Feb 26 18:59:18 2015 -0800
+++ b/source/common/x86/intrapred16.asm	Thu Feb 26 21:03:33 2015 -0800
@@ -165,6 +165,90 @@
 ;-----------------------------------------------------------------------------------
 ; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel* above, int, int filter)
 ;-----------------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal intra_pred_dc8, 5, 8, 2
+    add             r2,            2
+    add             r1,            r1
+    movu            m0,            [r2 + 32]
+    movu            m1,            [r2]
+
+    paddw           m0,            m1
+    movhlps         m1,            m0
+    paddw           m0,            m1
+    pshufd          m1,            m0, 1
+    paddw           m0,            m1
+    pmaddwd         m0,            [pw_1]
+
+    paddw           m0,            [pw_8]
+    psraw           m0,            4              ; sum = sum / 16
+    pshuflw         m0,            m0, 0
+    pshufd          m0,            m0, 0          ; m0 = word [dc_val ...]
+
+    test            r4d,           r4d
+
+    ; store DC 8x8
+    lea             r6,            [r1 + r1 * 2]
+    lea             r5,            [r6 + r1 * 2]
+    lea             r7,            [r6 + r1 * 4]
+    movu            [r0],          m0
+    movu            [r0 + r1],     m0
+    movu            [r0 + r1 * 2], m0
+    movu            [r0 + r6],     m0
+    movu            [r0 + r1 * 4], m0
+    movu            [r0 + r5],     m0
+    movu            [r0 + r6 * 2], m0
+    movu            [r0 + r7],     m0
+
+    ; Do DC Filter
+    jz              .end
+    mova            m1,            [pw_2]
+    pmullw          m1,            m0
+    paddw           m1,            [pw_2]
+    movd            r4d,           m1             ; r4d = DC * 2 + 2
+    paddw           m1,            m0             ; m1 = DC * 3 + 2
+    pshuflw         m1,            m1, 0
+    pshufd          m1,            m1, 0          ; m1 = pixDCx3
+
+    ; filter top
+    movu            m0,            [r2]
+    paddw           m0,            m1
+    psraw           m0,            2
+    movu            [r0],          m0
+
+    ; filter top-left
+    movzx           r4d,           r4w
+    movzx           r3d, word      [r2 + 32]
+    add             r4d,           r3d
+    movzx           r3d, word      [r2]
+    add             r3d,           r4d
+    shr             r3d,           2
+    mov             [r0],          r3w
+
+    ; filter left
+    movu            m0,            [r2 + 34]
+    paddw           m0,            m1
+    psraw           m0,            2
+    movh            r3,            m0
+    mov             [r0 + r1],     r3w
+    shr             r3,            16
+    mov             [r0 + r1 * 2], r3w
+    shr             r3,            16
+    mov             [r0 + r6],     r3w
+    shr             r3,            16
+    mov             [r0 + r1 * 4], r3w
+    pshufd          m0,            m0, 0x6E
+    movh            r3,            m0
+    mov             [r0 + r5],     r3w
+    shr             r3,            16
+    mov             [r0 + r6 * 2], r3w
+    shr             r3,            16
+    mov             [r0 + r7],     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