[x265] [PATCH] asm: ssse3 8bpp code for convert_p2s[12x16](9.82x), convert_p2s[24x32](13.61x)

Rajesh Paulraj rajesh at multicorewareinc.com
Mon Apr 6 11:12:09 CEST 2015


please ignore this patch ,need to modify this to support for 12xN, 24xN
sizes. I will resend it.

2015-04-06 10:40 GMT+05:30 <rajesh at multicorewareinc.com>:

> # HG changeset patch
> # User Rajesh Paulraj<rajesh at multicorewareinc.com>
> # Date 1428296987 -19800
> #      Mon Apr 06 10:39:47 2015 +0530
> # Node ID 6e9471155dec62e653db0a96df14e62df53041bd
> # Parent  ebe5e57c4b45b45338035a1009b64585f21d66d5
> asm: ssse3 8bpp code for convert_p2s[12x16](9.82x),
> convert_p2s[24x32](13.61x)
>                          convert_p2s[48x64](11.12x)
>
> diff -r ebe5e57c4b45 -r 6e9471155dec source/common/x86/asm-primitives.cpp
> --- a/source/common/x86/asm-primitives.cpp      Sat Apr 04 15:11:39 2015
> -0500
> +++ b/source/common/x86/asm-primitives.cpp      Mon Apr 06 10:39:47 2015
> +0530
> @@ -1332,6 +1332,9 @@
>          p.pu[LUMA_64x32].convert_p2s =
> x265_filterPixelToShort_64x32_ssse3;
>          p.pu[LUMA_64x48].convert_p2s =
> x265_filterPixelToShort_64x48_ssse3;
>          p.pu[LUMA_64x64].convert_p2s =
> x265_filterPixelToShort_64x64_ssse3;
> +        p.pu[LUMA_12x16].convert_p2s =
> x265_filterPixelToShort_12x16_ssse3;
> +        p.pu[LUMA_24x32].convert_p2s =
> x265_filterPixelToShort_24x32_ssse3;
> +        p.pu[LUMA_48x64].convert_p2s =
> x265_filterPixelToShort_48x64_ssse3;
>
>          p.chroma[X265_CSP_I420].pu[CHROMA_420_8x2].p2s =
> x265_filterPixelToShort_8x2_ssse3;
>          p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].p2s =
> x265_filterPixelToShort_8x4_ssse3;
> diff -r ebe5e57c4b45 -r 6e9471155dec source/common/x86/ipfilter8.asm
> --- a/source/common/x86/ipfilter8.asm   Sat Apr 04 15:11:39 2015 -0500
> +++ b/source/common/x86/ipfilter8.asm   Mon Apr 06 10:39:47 2015 +0530
> @@ -8248,6 +8248,274 @@
>  P2S_H_64xN 32
>  P2S_H_64xN 48
>
>
> +;-----------------------------------------------------------------------------
> +; void filterPixelToShort(pixel src, intptr_t srcStride, int16_t dst,
> int16_t dstStride)
>
> +;-----------------------------------------------------------------------------
> +INIT_XMM ssse3
> +cglobal filterPixelToShort_12x16, 3, 7, 6
> +    mov         r3d, r3m
> +    add         r3d, r3d
> +    lea         r4, [r1 * 3]
> +    lea         r6, [r3 * 3]
> +    mov         r5d, 4
> +
> +    ; load constant
> +    mova        m4, [pb_128]
> +    mova        m5, [tab_c_64_n64]
> +
> +.loop:
> +    movu        m0, [r0]
> +    punpcklbw   m1, m0, m4
> +    punpckhbw   m0, m4
> +    pmaddubsw   m0, m5
> +    pmaddubsw   m1, m5
> +
> +    movu        m2, [r0 + r1]
> +    punpcklbw   m3, m2, m4
> +    punpckhbw   m2, m4
> +    pmaddubsw   m2, m5
> +    pmaddubsw   m3, m5
> +
> +    movu        [r2 + r3 * 0], m1
> +    movu        [r2 + r3 * 1], m3
> +
> +    movh        [r2 + r3 * 0 + 16], m0
> +    movh        [r2 + r3 * 1 + 16], m2
> +
> +    movu        m0, [r0 + r1 * 2]
> +    punpcklbw   m1, m0, m4
> +    punpckhbw   m0, m4
> +    pmaddubsw   m0, m5
> +    pmaddubsw   m1, m5
> +
> +    movu        m2, [r0 + r4]
> +    punpcklbw   m3, m2, m4
> +    punpckhbw   m2, m4
> +    pmaddubsw   m2, m5
> +    pmaddubsw   m3, m5
> +
> +    movu        [r2 + r3 * 2], m1
> +    movu        [r2 + r6], m3
> +
> +    movh        [r2 + r3 * 2 + 16], m0
> +    movh        [r2 + r6 + 16], m2
> +
> +    lea         r0, [r0 + r1 * 4]
> +    lea         r2, [r2 + r3 * 4]
> +
> +    dec         r5d
> +    jnz         .loop
> +    RET
> +
>
> +;-----------------------------------------------------------------------------
> +; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst,
> int16_t dstStride)
>
> +;-----------------------------------------------------------------------------
> +INIT_XMM ssse3
> +cglobal filterPixelToShort_24x32, 3, 7, 5
> +    mov         r3d, r3m
> +    add         r3d, r3d
> +    lea         r4, [r1 * 3]
> +    lea         r5, [r3 * 3]
> +    mov         r6d, 8
> +
> +    ; load constant
> +    mova        m3, [pb_128]
> +    mova        m4, [tab_c_64_n64]
> +
> +.loop:
> +    movu        m0, [r0]
> +    punpcklbw   m1, m0, m3
> +    punpckhbw   m0, m3
> +    pmaddubsw   m0, m4
> +    pmaddubsw   m1, m4
> +
> +    movu        m2, [r0 + 16]
> +    punpcklbw   m2, m3
> +    pmaddubsw   m2, m4
> +
> +    movu        [r2 +  r3 * 0], m1
> +    movu        [r2 +  r3 * 0 + 16], m0
> +    movu        [r2 +  r3 * 0 + 32], m2
> +
> +    movu        m0, [r0 + r1]
> +    punpcklbw   m1, m0, m3
> +    punpckhbw   m0, m3
> +    pmaddubsw   m0, m4
> +    pmaddubsw   m1, m4
> +
> +    movu        m2, [r0 + r1 + 16]
> +    punpcklbw   m2, m3
> +    pmaddubsw   m2, m4
> +
> +    movu        [r2 +  r3 * 1], m1
> +    movu        [r2 +  r3 * 1 + 16], m0
> +    movu        [r2 +  r3 * 1 + 32], m2
> +
> +    movu        m0, [r0 + r1 * 2]
> +    punpcklbw   m1, m0, m3
> +    punpckhbw   m0, m3
> +    pmaddubsw   m0, m4
> +    pmaddubsw   m1, m4
> +
> +    movu        m2, [r0 + r1 * 2 + 16]
> +    punpcklbw   m2, m3
> +    pmaddubsw   m2, m4
> +
> +    movu        [r2 +  r3 * 2], m1
> +    movu        [r2 +  r3 * 2 + 16], m0
> +    movu        [r2 +  r3 * 2 + 32], m2
> +
> +    movu        m0, [r0 + r4]
> +    punpcklbw   m1, m0, m3
> +    punpckhbw   m0, m3
> +    pmaddubsw   m0, m4
> +    pmaddubsw   m1, m4
> +
> +    movu        m2, [r0 + r4 + 16]
> +    punpcklbw   m2, m3
> +    pmaddubsw   m2, m4
> +    movu        [r2 +  r5], m1
> +    movu        [r2 +  r5 + 16], m0
> +    movu        [r2 +  r5 + 32], m2
> +
> +    lea         r0, [r0 + r1 * 4]
> +    lea         r2, [r2 + r3 * 4]
> +
> +    dec         r6d
> +    jnz         .loop
> +    RET
> +
>
> +;-----------------------------------------------------------------------------
> +; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst,
> int16_t dstStride)
>
> +;-----------------------------------------------------------------------------
> +INIT_XMM ssse3
> +cglobal filterPixelToShort_48x64, 3, 7, 4
> +    mov         r3d, r3m
> +    add         r3d, r3d
> +    lea         r4, [r1 * 3]
> +    lea         r5, [r3 * 3]
> +    mov         r6d, 16
> +
> +    ; load constant
> +    mova        m2, [pb_128]
> +    mova        m3, [tab_c_64_n64]
> +
> +.loop:
> +    movu        m0, [r0]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 0], m1
> +    movu        [r2 +  r3 * 0 + 16], m0
> +
> +    movu        m0, [r0 + 16]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 0 + 32], m1
> +    movu        [r2 +  r3 * 0 + 48], m0
> +
> +    movu        m0, [r0 + 32]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 0 + 64], m1
> +    movu        [r2 +  r3 * 0 + 80], m0
> +
> +    movu        m0, [r0 + r1]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 1], m1
> +    movu        [r2 +  r3 * 1 + 16], m0
> +
> +    movu        m0, [r0 + r1 + 16]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 1 + 32], m1
> +    movu        [r2 +  r3 * 1 + 48], m0
> +
> +    movu        m0, [r0 + r1 + 32]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 1 + 64], m1
> +    movu        [r2 +  r3 * 1 + 80], m0
> +
> +    movu        m0, [r0 + r1 * 2]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 2], m1
> +    movu        [r2 +  r3 * 2 + 16], m0
> +
> +    movu        m0, [r0 + r1 * 2 + 16]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 2 + 32], m1
> +    movu        [r2 +  r3 * 2 + 48], m0
> +
> +    movu        m0, [r0 + r1 * 2 + 32]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r3 * 2 + 64], m1
> +    movu        [r2 +  r3 * 2 + 80], m0
> +
> +    movu        m0, [r0 + r4]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r5], m1
> +    movu        [r2 +  r5 + 16], m0
> +
> +    movu        m0, [r0 + r4 + 16]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r5 + 32], m1
> +    movu        [r2 +  r5 + 48], m0
> +
> +    movu        m0, [r0 + r4 + 32]
> +    punpcklbw   m1, m0, m2
> +    punpckhbw   m0, m2
> +    pmaddubsw   m0, m3
> +    pmaddubsw   m1, m3
> +
> +    movu        [r2 +  r5 + 64], m1
> +    movu        [r2 +  r5 + 80], m0
> +
> +    lea         r0, [r0 + r1 * 4]
> +    lea         r2, [r2 + r3 * 4]
> +
> +    dec         r6d
> +    jnz         .loop
> +    RET
> +
>  %macro PROCESS_LUMA_W4_4R 0
>      movd        m0, [r0]
>      movd        m1, [r0 + r1]
> diff -r ebe5e57c4b45 -r 6e9471155dec source/common/x86/ipfilter8.h
> --- a/source/common/x86/ipfilter8.h     Sat Apr 04 15:11:39 2015 -0500
> +++ b/source/common/x86/ipfilter8.h     Mon Apr 06 10:39:47 2015 +0530
> @@ -654,6 +654,9 @@
>  void x265_filterPixelToShort_64x32_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
>  void x265_filterPixelToShort_64x48_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
>  void x265_filterPixelToShort_64x64_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
> +void x265_filterPixelToShort_12x16_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
> +void x265_filterPixelToShort_24x32_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
> +void x265_filterPixelToShort_48x64_ssse3(const pixel* src, intptr_t
> srcStride, int16_t* dst, intptr_t dstStride);
>  #undef LUMA_FILTERS
>  #undef LUMA_SP_FILTERS
>  #undef LUMA_SS_FILTERS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20150406/99ed8c51/attachment.html>


More information about the x265-devel mailing list