Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Change #275116

Category ffmpeg
Changed by Niklas Haas <gitohnoyoudont@haasn.dev>
Changed at Fri 17 Jul 2026 15:23:21
Repository https://git.ffmpeg.org/ffmpeg.git
Project ffmpeg
Branch master
Revision 8fdafc8198c7aac078b4a9c550ac50e32ae3ec2b

Comments

swscale/x86/ops: rewrite packed_shuffle() in terms of uops macro
This is mostly the same, with the added complication of now needing to handle
the case of clearing to a nonzero value, which we do using `pblendb` on SSE4,
and respectively `vpblendb` / `vpblendmb` on AVX-2 and AVX-512.

Since `pblendb` hard-codes XMM0 implicitly, we have to flip the order of `m0`
and `m1` in the rest of the code as well; though that's not a huge deal.

The bigger complication comes from the fact that the macro gives us the size
for a size 16 mask, which may need to be rounded up for the lane-aligned
AVX-2 / AVX-512 paths, so we need to recreate this logic in the NASM macro
itself. Fortunately, it's fairly straightforward.

The big upside is that we now gain a fast path for e.g. rgb24 -> rgba, which
is arguably more common than rgb24 -> rgb0:

  rgb24 1920x1080 -> rgba 1920x1080, speedup=7.106x faster

It's worth pointing out that, because checkasm sometimes generates weird ops
that don't occur in real pixel formats, it's not a guarantee that we will
actually implement all paths that the optimizer spits out.

This should be improved by a future checkasm refactor; but for now, we need
to return ENOTSUP in the case that we encounter a shuffle mask combination
that doesn't actually exist. (In practice, this only happens for degenerate
no-op tests like 1->1 shuffles)

Signed-off-by: Niklas Haas <git@haasn.dev>

Changed files