[FFmpeg-devel] [PATCH 1/3] avfilter/vf_colordetect: add new color range detection filter

Niklas Haas ffmpeg at haasn.xyz
Wed Jul 16 18:48:56 EEST 2025


On Wed, 16 Jul 2025 17:25:49 +0200 Niklas Haas <ffmpeg at haasn.xyz> wrote:
> From: Niklas Haas <git at haasn.dev>
>
> This filter can detect various properties about the image, including
> whether or not there are out-of-range values, or whether the input appears
> to use straight or premultiplied alpha.
>
> Of course, these can only be heuristics, with "undetermined" as the base
> case. While we can definitely prove the existence of full range or
> straight alpha colors, we can never infer the opposite.

Upon further testing, I realized that this logic (both C and SIMD) overflows
for 16-bit inputs. Will fix and resubmit.

I also found that the C versions can be made slightly faster by returning out
of the inner loop, which generates a shorter scalar version that is faster
than the auto-vectorized abomination that was generated before.


More information about the ffmpeg-devel mailing list