[x265] [PATCH] avx2: 'integral4h' HIGH_BIT_DEPTH asm code -> 5.37x faster than 'C' version

Ashok Kumar Mishra ashok at multicorewareinc.com
Thu Jun 15 15:03:18 CEST 2017


pushed

On Wed, Jun 14, 2017 at 1:35 PM, <jayashri at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Jayashri Murugan <jayashri at multicorewareinc.com>
> # Date 1497421166 -19800
> #      Wed Jun 14 11:49:26 2017 +0530
> # Node ID 0e11a209ad118de136971184fcdf026fa275f9f2
> # Parent  65e038ecbbf63a2f449ccf52358c5fbbec408b27
> avx2: 'integral4h' HIGH_BIT_DEPTH asm code -> 5.37x faster than 'C' version
>
>     integral_init4h  5.37x    457.68          2456.91
>
> diff -r 65e038ecbbf6 -r 0e11a209ad11 source/common/x86/asm-primitives.cpp
> --- a/source/common/x86/asm-primitives.cpp      Wed Jun 14 12:03:44 2017
> +0530
> +++ b/source/common/x86/asm-primitives.cpp      Wed Jun 14 11:49:26 2017
> +0530
> @@ -2164,6 +2164,7 @@
>          p.integral_initv[INTEGRAL_16] = PFX(integral16v_avx2);
>          p.integral_initv[INTEGRAL_24] = PFX(integral24v_avx2);
>          p.integral_initv[INTEGRAL_32] = PFX(integral32v_avx2);
> +        p.integral_inith[INTEGRAL_4] = PFX(integral4h_avx2);
>
>          /* TODO: This kernel needs to be modified to work with
> HIGH_BIT_DEPTH only
>          p.planeClipAndMax = PFX(planeClipAndMax_avx2); */
> diff -r 65e038ecbbf6 -r 0e11a209ad11 source/common/x86/seaintegral.asm
> --- a/source/common/x86/seaintegral.asm Wed Jun 14 12:03:44 2017 +0530
> +++ b/source/common/x86/seaintegral.asm Wed Jun 14 11:49:26 2017 +0530
> @@ -172,10 +172,55 @@
>      paddw      xm0, xm1
>  %endmacro
>
> +%macro INTEGRAL_FOUR_HORIZONTAL_8_HBD 0
> +    pmovzxwd       m0, [r1]
> +    pmovzxwd       m1, [r1 + 2]
> +    paddd          m0, m1
> +    pmovzxwd       m1, [r1 + 4]
> +    paddd          m0, m1
> +    pmovzxwd       m1, [r1 + 6]
> +    paddd          m0, m1
> +%endmacro
> +
> +%macro INTEGRAL_FOUR_HORIZONTAL_4_HBD 0
> +    pmovzxwd       xm0, [r1]
> +    pmovzxwd       xm1, [r1 + 2]
> +    paddd          xm0, xm1
> +    pmovzxwd       xm1, [r1 + 4]
> +    paddd          xm0, xm1
> +    pmovzxwd       xm1, [r1 + 6]
> +    paddd          xm0, xm1
> +%endmacro
> +
>  ;-----------------------------------------------------------
> ------------------
>  ;static void integral_init4h(uint32_t *sum, pixel *pix, intptr_t stride)
>  ;-----------------------------------------------------------
> ------------------
>  INIT_YMM avx2
> +%if HIGH_BIT_DEPTH
> +cglobal integral4h, 3, 5, 3
> +    lea            r3, [4 * r2]
> +    sub            r0, r3
> +    sub            r2, 4                      ;stride - 4
> +    mov            r4, r2
> +    shr            r4, 3
> +
> +.loop_8:
> +    INTEGRAL_FOUR_HORIZONTAL_8_HBD
> +    movu           m1, [r0]
> +    paddd          m0, m1
> +    movu           [r0 + r3], m0
> +    add            r1, 16
> +    add            r0, 32
> +    sub            r2, 8
> +    sub            r4, 1
> +    jnz            .loop_8
> +    INTEGRAL_FOUR_HORIZONTAL_4_HBD
> +    movu           xm1, [r0]
> +    paddd          xm0, xm1
> +    movu           [r0 + r3], xm0
> +    RET
> +
> +%else
>  cglobal integral4h, 3, 5, 3
>      lea            r3, [4 * r2]
>      sub            r0, r3
> @@ -227,6 +272,7 @@
>
>  .end
>      RET
> +%endif
>
>  ;-----------------------------------------------------------
> ------------------
>  ;static void integral_init8h_c(uint32_t *sum, pixel *pix, intptr_t stride)
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170615/a776bbf7/attachment.html>


More information about the x265-devel mailing list