[FFmpeg-devel] [PATCH v2 3/3] avfilter/vf_colordetect: add x86 SIMD implementation

Henrik Gramner henrik at gramner.com
Wed Jul 16 23:06:28 EEST 2025


On Wed, Jul 16, 2025 at 6:26 PM Niklas Haas <ffmpeg at haasn.xyz> wrote:
> +cglobal detect_range%1, 6, 7, 5, data, stride, width, height, mpeg_min, mpeg_max, x
> +    movd xm0, mpeg_mind
> +    movd xm1, mpeg_maxd
> +    vpbroadcast%1 m0, xm0
> +    vpbroadcast%1 m1, xm1

You could perhaps also do something like the following to shave off a
few instructions:

cglobal detect_range%1, 4, 7, 5, data, stride, width, height,
mpeg_min, mpeg_max, x
%if UNIX64 && notcpuflag(avx512)
    movd xm0, mpeg_mind
    movd xm1, mpeg_maxd
    vpbroadcast%1 m0, xm0
    vpbroadcast%1 m1, xm1
%else
    vpbroadcast%1 m0, mpeg_minm
    vpbroadcast%1 m0, mpeg_maxm
%endif


More information about the ffmpeg-devel mailing list