[x265] [PATCH] asm: intrapred dc4 sse2
Steve Borho
steve at borho.org
Wed Feb 25 23:30:37 CET 2015
On Wed, Feb 25, 2015 at 7:34 AM, chen <chenm003 at 163.com> wrote:
> it's right, just move pw_257 into const.asm in future
I pushed this one, but then realized that the -m32 build is broken on
LInux. It looks to be caused by the usage of r4b
http://pastie.org/9982589
> At 2015-02-25 04:53:04,dtyx265 at gmail.com wrote:
>># HG changeset patch
>># User David T Yuen <dtyx265 at gmail.com>
>># Date 1424810386 28800
>># Node ID 8528fea56a4202c871544621d5806ee686e671fc
>># Parent 7252c10278a1e1aeddbe489180aad35196262919
>>asm: intrapred dc4 sse2
>>
>>This replaces c code for systems using ssse3 to sse2 processors
>>The code is backported from intrapred dc4 sse4
>>
>>./test/TestBench --testbench intrapred
>>Testing only harnesses that match name <intrapred>
>>Using random seed 54ECE101 8bpp
>>Testing primitives: SSE2
>>Testing primitives: SSE3
>>
>>Test performance improvement with full optimizations
>>== intrapred primitives ==
>>intra_dc_4x4[f=0] 1.26x 192.96 242.35
>>intra_dc_4x4[f=1] 1.25x 409.99 512.69
>>
>>diff -r 7252c10278a1 -r 8528fea56a42 source/common/x86/asm-primitives.cpp
>>--- a/source/common/x86/asm-primitives.cpp Mon Feb 23 23:11:49 2015 -0600
>>+++ b/source/common/x86/asm-primitives.cpp Tue Feb 24 12:39:46 2015 -0800
>>@@ -1071,6 +1071,8 @@
>> ALL_LUMA_TU_S(cpy1Dto2D_shr, cpy1Dto2D_shr_, sse2);
>> ALL_LUMA_TU_S(ssd_s, pixel_ssd_s_, sse2);
>>
>>+ p.cu[BLOCK_4x4].intra_pred[DC_IDX] = x265_intra_pred_dc4_sse2;
>>+
>> p.cu[BLOCK_4x4].calcresidual = x265_getResidual4_sse2;
>> p.cu[BLOCK_8x8].calcresidual = x265_getResidual8_sse2;
>>
>>diff -r 7252c10278a1 -r 8528fea56a42 source/common/x86/intrapred.h
>>--- a/source/common/x86/intrapred.h Mon Feb 23 23:11:49 2015 -0600
>>+++ b/source/common/x86/intrapred.h Tue Feb 24 12:39:46 2015 -0800
>>@@ -26,6 +26,7 @@
>> #ifndef X265_INTRAPRED_H
>> #define X265_INTRAPRED_H
>>
>>+void x265_intra_pred_dc4_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 7252c10278a1 -r 8528fea56a42 source/common/x86/intrapred8.asm
>>--- a/source/common/x86/intrapred8.asm Mon Feb 23 23:11:49 2015 -0600
>>+++ b/source/common/x86/intrapred8.asm Tue Feb 24 12:39:46 2015 -0800
>>@@ -65,6 +65,8 @@
>> pw_planar32_L: dw 31, 30, 29, 28, 27, 26, 25, 24
>> pw_planar32_H: dw 23, 22, 21, 20, 19, 18, 17, 16
>>
>>+pw_257: times 8 dw 257
>>+
>> const ang_table
>> %assign x 0
>> %rep 32
>>@@ -89,6 +91,71 @@
>>
>> ;---------------------------------------------------------------------------------------------
>> ; void intra_pred_dc(pixel* dst, intptr_t dstStride, pixel *srcPix, int
>> dirMode, int bFilter)
>>
>> ;---------------------------------------------------------------------------------------------
>>+INIT_XMM sse2
>>+cglobal intra_pred_dc4, 5,5,3
>>+ inc r2
>>+ pxor m0, m0
>>+ movu m1, [r2]
>>+ pshufd m1, m1, 0xF8
>>+ psadbw m1, m0 ; m1 = sum
>>+
>>+ test r4d, r4d
>>+
>>+ paddw m1, [pw_4]
>>+ psraw m1, 3
>>+ movd r4d, m1 ; r4d = dc_val
>>+ pmullw m1, [pw_257]
>>+ pshuflw m1, m1, 0x00
>>+
>>+ ; store DC 4x4
>>+ lea r3, [r1 * 3]
>>+ movd [r0], m1
>>+ movd [r0 + r1], m1
>>+ movd [r0 + r1 * 2], m1
>>+ movd [r0 + r3], m1
>>+
>>+ ; do DC filter
>>+ jz .end
>>+ lea r3d, [r4d * 2 + 2] ; r3d = DC * 2 + 2
>>+ add r4d, r3d ; r4d = DC * 3 + 2
>>+ movd m1, r4d
>>+ pshuflw m1, m1, 0 ; m1 = pixDCx3
>>+
>>+ ; filter top
>>+ movd m2, [r2]
>>+ punpcklbw m2, m0
>>+ paddw m2, m1
>>+ psraw m2, 2
>>+ packuswb m2, m2
>>+ movd [r0], m2 ; overwrite top-left pixel, we will
>> update it later
>>+
>>+ ; filter top-left
>>+ movzx r4d, byte [r2 + 8]
>>+ add r3d, r4d
>>+ movzx r4d, byte [r2]
>>+ add r3d, r4d
>>+ shr r3d, 2
>>+ mov [r0], r3b
>>+
>>+ ; filter left
>>+ add r0, r1
>>+ movq m2, [r2 + 9]
>>+ punpcklbw m2, m0
>>+ paddw m2, m1
>>+ psraw m2, 2
>>+ packuswb m2, m2
>>+ movq r4, m2
>>+ mov [r0], r4b
>>+ shr r4, 8
>>+ mov [r0 + r1], r4b
>>+ shr r4, 8
>>+ mov [r0 + r1 * 2], r4b
>>+.end:
>>+ 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
>>_______________________________________________
>>x265-devel mailing list
>>x265-devel at videolan.org
>>https://mailman.videolan.org/listinfo/x265-devel
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
--
Steve Borho
More information about the x265-devel
mailing list