[x265] [PATCH] asm:intra pred dc32 sse2

dtyx265 at gmail.com dtyx265 at gmail.com
Tue Mar 3 05:02:46 CET 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1425354731 28800
# Node ID b70e945ad4ce15461b1c0187dc0023b5d4a640f4
# Parent  a89ced7112fdff2c1a586f29f6bfbf584ec2f697
asm:intra pred dc32 sse2

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

64-bit

./test/TestBench --testbench intrapred | grep 32x32
intra_dc_32x32[f=0]	7.41x 	 1862.41  	 13808.68

32-bit

./test/TestBench --testbench intrapred | grep 32x32
intra_dc_32x32[f=0]	4.24x 	 1765.02  	 7474.88

diff -r a89ced7112fd -r b70e945ad4ce source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Mar 02 14:32:14 2015 -0800
+++ b/source/common/x86/asm-primitives.cpp	Mon Mar 02 19:52:11 2015 -0800
@@ -1207,6 +1207,7 @@
         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_16x16].intra_pred[DC_IDX] = x265_intra_pred_dc16_sse2;
+        p.cu[BLOCK_32x32].intra_pred[DC_IDX] = x265_intra_pred_dc32_sse2;
 
         p.cu[BLOCK_4x4].calcresidual = x265_getResidual4_sse2;
         p.cu[BLOCK_8x8].calcresidual = x265_getResidual8_sse2;
diff -r a89ced7112fd -r b70e945ad4ce source/common/x86/intrapred.h
--- a/source/common/x86/intrapred.h	Mon Mar 02 14:32:14 2015 -0800
+++ b/source/common/x86/intrapred.h	Mon Mar 02 19:52:11 2015 -0800
@@ -29,6 +29,7 @@
 void x265_intra_pred_dc4_sse2(pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
 void x265_intra_pred_dc8_sse2(pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
 void x265_intra_pred_dc16_sse2(pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
+void x265_intra_pred_dc32_sse2(pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
 void x265_intra_pred_dc4_sse4(pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
 void x265_intra_pred_dc8_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
 void x265_intra_pred_dc16_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
diff -r a89ced7112fd -r b70e945ad4ce source/common/x86/intrapred8.asm
--- a/source/common/x86/intrapred8.asm	Mon Mar 02 14:32:14 2015 -0800
+++ b/source/common/x86/intrapred8.asm	Mon Mar 02 19:52:11 2015 -0800
@@ -494,6 +494,48 @@
 ;---------------------------------------------------------------------------------------------
 ; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter)
 ;---------------------------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal intra_pred_dc32, 3, 3, 5
+    pxor            m0,            m0
+    movu            m1,            [r2 + 1]
+    movu            m2,            [r2 + 17]
+    movu            m3,            [r2 + 65]
+    movu            m4,            [r2 + 81]
+    psadbw          m1,            m0
+    psadbw          m2,            m0
+    psadbw          m3,            m0
+    psadbw          m4,            m0
+    paddw           m1,            m2
+    paddw           m3,            m4
+    paddw           m1,            m3
+    pshufd          m2,            m1, 2
+    paddw           m1,            m2
+
+    movd            r2d,           m1
+    add             r2d,           32
+    shr             r2d,           6     ; sum = sum / 64
+    movd            m1,            r2d
+    pmullw          m1,            [pw_257]
+    pshuflw         m1,            m1, 0x00       ; m1 = byte [dc_val ...]
+    pshufd          m1,            m1, 0x00
+
+%assign x 0
+%rep 16
+    ; store DC 16x16
+    movu            [r0],          m1
+    movu            [r0 + r1],     m1
+    movu            [r0 + 16],     m1
+    movu            [r0 + r1 + 16],m1
+%if x < 16
+    lea             r0,            [r0 + 2 * r1]
+%endif
+%assign x x+1
+%endrep
+    RET
+
+;---------------------------------------------------------------------------------------------
+; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter)
+;---------------------------------------------------------------------------------------------
 INIT_XMM sse4
 cglobal intra_pred_dc4, 5,5,3
     inc         r2


More information about the x265-devel mailing list