[x265] [PATCH] asm: interp_4tap_vert_pp sse2

dave dtyx265 at gmail.com
Wed May 6 06:33:01 CEST 2015


Ignore this, I will be sending a better version.

On 05/05/2015 06:32 PM, dtyx265 at gmail.com wrote:
> # HG changeset patch
> # User David T Yuen <dtyx265 at gmail.com>
> # Date 1430875749 25200
> # Node ID 9452c826eb205682647ee0db4d8d445785bb7a1a
> # Parent  f32e6464225afa02983af1b1905f50cdccae5244
> asm: interp_4tap_vert_pp sse2
>
> This replaces c code for 2x4, 2x8 and 2x16
>
> 64-bit
>
> ./test/TestBench --testbench interp | grep vpp
> chroma_vpp[  2x4]	1.69x 	 687.46   	 1159.98
> chroma_vpp[  2x8]	1.60x 	 1294.95  	 2067.48
> chroma_vpp[  2x8]	1.59x 	 1297.45  	 2067.48
> chroma_vpp[ 2x16]	1.85x 	 2427.45  	 4480.14
>
> 32-bit
>
> ./test/TestBench --testbench interp | grep vpp
> chroma_vpp[  2x4]	1.84x 	 798.74   	 1469.75
> chroma_vpp[  2x8]	2.02x 	 1379.99  	 2787.42
> chroma_vpp[  2x8]	2.02x 	 1379.98  	 2787.42
> chroma_vpp[ 2x16]	2.35x 	 2623.63  	 6178.26
>
> diff -r f32e6464225a -r 9452c826eb20 source/common/x86/asm-primitives.cpp
> --- a/source/common/x86/asm-primitives.cpp	Mon May 04 15:15:42 2015 -0500
> +++ b/source/common/x86/asm-primitives.cpp	Tue May 05 18:29:09 2015 -0700
> @@ -1343,6 +1343,11 @@
>           CHROMA_422_VSP_FILTERS(_sse2);
>           CHROMA_444_VSP_FILTERS(_sse2);
>   
> +        p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_vpp = x265_interp_4tap_vert_pp_2x4_sse2;
> +        p.chroma[X265_CSP_I420].pu[CHROMA_420_2x8].filter_vpp = x265_interp_4tap_vert_pp_2x8_sse2;
> +        p.chroma[X265_CSP_I422].pu[CHROMA_422_2x8].filter_vpp = x265_interp_4tap_vert_pp_2x8_sse2;
> +        p.chroma[X265_CSP_I422].pu[CHROMA_422_2x16].filter_vpp = x265_interp_4tap_vert_pp_2x16_sse2;
> +
>           ALL_LUMA_PU(luma_hpp, interp_8tap_horiz_pp, sse2);
>           p.pu[LUMA_4x4].luma_hpp = x265_interp_8tap_horiz_pp_4x4_sse2;
>           ALL_LUMA_PU(luma_hps, interp_8tap_horiz_ps, sse2);
> diff -r f32e6464225a -r 9452c826eb20 source/common/x86/ipfilter8.asm
> --- a/source/common/x86/ipfilter8.asm	Mon May 04 15:15:42 2015 -0500
> +++ b/source/common/x86/ipfilter8.asm	Tue May 05 18:29:09 2015 -0700
> @@ -74,6 +74,15 @@
>                           dw -2, 16, 54, -4
>                           dw -2, 10, 58, -2
>   
> +const tabw_ChromaCoeffV, times 2 dw  0,  0, 64,  0
> +                         times 2 dw -2, 10, 58, -2
> +                         times 2 dw -4, 16, 54, -2
> +                         times 2 dw -6, 28, 46, -4
> +                         times 2 dw -4, 36, 36, -4
> +                         times 2 dw -4, 46, 28, -6
> +                         times 2 dw -2, 54, 16, -4
> +                         times 2 dw -2, 58, 10, -2
> +
>   const tab_ChromaCoeff_V, times 8 db 0, 64
>                            times 8 db 0,  0
>   
> @@ -296,6 +305,7 @@
>   
>   SECTION .text
>   
> +cextern pb_0
>   cextern pb_128
>   cextern pw_1
>   cextern pw_32
> @@ -1043,6 +1053,126 @@
>       IPFILTER_LUMA_sse2 16, 64, ps
>   
>   ;-----------------------------------------------------------------------------
> +; void interp_4tap_vert_pp_2xn(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
> +;-----------------------------------------------------------------------------
> +%macro FILTER_V4_W2_H4_sse2 1
> +INIT_XMM sse2
> +cglobal interp_4tap_vert_pp_2x%1, 4, 6, 8
> +
> +    mov         r4d,       r4m
> +    sub         r0,        r1
> +    add         r4d,       r4d
> +
> +%ifdef PIC
> +    lea         r5,        [tabw_ChromaCoeffV]
> +    mova        m0,        [r5 + r4 * 8]
> +%else
> +    mova        m0,        [tabw_ChromaCoeffV + r4 * 8]
> +%endif
> +
> +    mova        m1,        [pw_32]
> +    lea         r5,        [3 * r1]
> +
> +%assign x 1
> +%rep %1/4
> +    movd        m2,        [r0]
> +    movd        m3,        [r0 + r1]
> +    movd        m4,        [r0 + 2 * r1]
> +    movd        m5,        [r0 + r5]
> +
> +    punpcklbw   m2,        m3
> +    punpcklbw   m6,        m4,        m5
> +    punpcklbw   m2,        m6
> +
> +    punpcklbw   m2,        [pb_0]
> +    pmaddwd     m2,        m0
> +
> +    lea         r0,        [r0 + 4 * r1]
> +    movd        m6,        [r0]
> +
> +    punpcklbw   m3,        m4
> +    punpcklbw   m7,        m5,        m6
> +    punpcklbw   m3,        m7
> +
> +    punpcklbw   m3,        [pb_0]
> +    pmaddwd     m3,        m0
> +
> +    pshufd      m7,        m2,        q2301
> +    paddd       m2,        m7
> +    pshufd      m7,        m3,        q2301
> +    paddd       m3,        m7
> +    pshufd      m2,        m2,        q2020
> +    pshufd      m3,        m3,        q2020
> +    punpcklqdq  m2,        m3
> +
> +    movd        m7,        [r0 + r1]
> +
> +    punpcklbw   m4,        m5
> +    punpcklbw   m3,        m6,        m7
> +    punpcklbw   m4,        m3
> +
> +    punpcklbw   m4,        [pb_0]
> +    pmaddwd     m4,        m0
> +
> +    movd        m3,        [r0 + 2 * r1]
> +
> +    punpcklbw   m5,        m6
> +    punpcklbw   m7,        m3
> +    punpcklbw   m5,        m7
> +
> +    punpcklbw   m5,        [pb_0]
> +    pmaddwd     m5,        m0
> +
> +    pshufd      m7,        m4,        q2301
> +    paddd       m4,        m7
> +    pshufd      m7,        m5,        q2301
> +    paddd       m5,        m7
> +    pshufd      m4,        m4,        q2020
> +    pshufd      m5,        m5,        q2020
> +    punpcklqdq  m4,        m5
> +
> +    packssdw    m2,        m4
> +    paddw       m2,        m1
> +    psraw       m2,        6
> +    packuswb    m2,        m2
> +
> +%if ARCH_X86_64
> +    movq        r4,        m2
> +    mov         [r2],      r4w
> +    shr         r4,        16
> +    mov         [r2 + r3], r4w
> +    lea         r2,        [r2 + 2 * r3]
> +    shr         r4,        16
> +    mov         [r2],      r4w
> +    shr         r4,        16
> +    mov         [r2 + r3], r4w
> +%else
> +    movd        r4,        m2
> +    mov         [r2],      r4w
> +    shr         r4,        16
> +    mov         [r2 + r3], r4w
> +    lea         r2,        [r2 + 2 * r3]
> +    psrldq      m2,        4
> +    movd        r4,        m2
> +    mov         [r2],      r4w
> +    shr         r4,        16
> +    mov         [r2 + r3], r4w
> +%endif
> +
> +%if x < %1/4
> +    lea         r2,        [r2 + 2 * r3]
> +%endif
> +%assign x x+1
> +%endrep
> +    RET
> +
> +%endmacro
> +
> +    FILTER_V4_W2_H4_sse2 4
> +    FILTER_V4_W2_H4_sse2 8
> +    FILTER_V4_W2_H4_sse2 16
> +
> +;-----------------------------------------------------------------------------
>   ; void interp_4tap_horiz_pp_2x4(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
>   ;-----------------------------------------------------------------------------
>   INIT_XMM sse4
> diff -r f32e6464225a -r 9452c826eb20 source/common/x86/ipfilter8.h
> --- a/source/common/x86/ipfilter8.h	Mon May 04 15:15:42 2015 -0500
> +++ b/source/common/x86/ipfilter8.h	Tue May 05 18:29:09 2015 -0700
> @@ -905,6 +905,9 @@
>   void x265_interp_8tap_horiz_ps_64x48_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx, int isRowExt);
>   void x265_interp_8tap_horiz_ps_64x64_sse2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx, int isRowExt);
>   void x265_interp_8tap_hv_pp_8x8_sse3(const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY);
> +void x265_interp_4tap_vert_pp_2x4_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
> +void x265_interp_4tap_vert_pp_2x8_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
> +void x265_interp_4tap_vert_pp_2x16_sse2(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
>   #undef LUMA_FILTERS
>   #undef LUMA_SP_FILTERS
>   #undef LUMA_SS_FILTERS



More information about the x265-devel mailing list