[FFmpeg-devel] [PATCH] avfilter/vf_threshold: add x86 SIMD

Martin Vignali martin.vignali at gmail.com
Fri Dec 1 22:00:30 EET 2017


Hello,

+
> +INIT_XMM sse4
>
Maybe use a macro (AVX2 can probably, be easy to add)


> +cglobal threshold8, 10, 13, 5, in, threshold, min, max, out, ilinesize,
> tlinesize, flinesize, slinesize, olinesize, w, h, x
> +    mov         wd, dword wm
> +    mov         hd, dword hm
>
Maybe you can use ptrdiff_t for w and h, so you can directly use it, using
wq, hq


> +    mova        m4, [pb_128]
> +    add        inq, wq
> +    add thresholdq, wq
> +    add       minq, wq
> +    add       maxq, wq
> +    add       outq, wq
> +    neg         wq
> +.nextrow:
> +    mov         xq, wq
> +
> +    .loop:
> +        movu            m1, [inq + xq]
> +        movu            m0, [thresholdq + xq]
> +        movu            m2, [minq + xq]
> +        movu            m3, [maxq + xq]
> +        pxor            m0, m4
> +        pxor            m1, m4
>
Do you need pxor m0, m4 and pxor m1, m4 ?


> +        pcmpgtb         m0, m1
> +        pblendvb        m3, m2, m0
> +        movu   [outq + xq], m3
> +        add             xq, mmsize
> +    jl .loop
> +
> +    add          inq, ilinesizeq
> +    add   thresholdq, tlinesizeq
> +    add         minq, flinesizeq
> +    add         maxq, slinesizeq
> +    add         outq, olinesizeq
> +    sub         hd, 1
> +    jg .nextrow
> +RET
>


Martin


More information about the ffmpeg-devel mailing list