FFmpeg Lands AVX-512 Optimization: 1.372x Faster Pixel Conversion
FFmpeg gains a hand-tuned AVX-512 optimization using VPERMB instructions, speeding up RGB24 to RGBA pixel format conversion by 1.372x on 1920x1080 frames. The change benefits AMD Zen 4 and newer, plus select Intel CPUs.
On July 19, 2026, prominent FFmpeg developer Niklas Haas committed a hand-tuned AVX-512 optimization to the multimedia library's libswscale component, achieving 1.372x faster performance for RGB24 to RGBA pixel format conversions on modern Intel and AMD processors with AVX-512 support.
The optimization centers on the Vector Permute Byte (VPERMB) instruction, which enables full cross-lane byte permutation. In internal tests using 1920x1080 video frames, the reworked code showed a 37.2% speedup over the previous implementation. That gain matters for video scaling and transcoding pipelines, which frequently convert between color spaces.
How VPERMB Reshapes the Pixel Path
VPERMB is a single instruction that can rearrange bytes across all 64 bytes of a 512-bit register in a single cycle, something earlier SIMD instruction sets handled with multiple operations. For pixel format conversion, the problem is rearranging three-byte RGB triplets into four-byte RGBA quadruplets, a pattern that benefits from the flexible permutation VPERMB provides. Haas wrote the new code path in libswcale, FFmpeg's scaling and format conversion component, and it automatically activates when the CPU supports AVX-512.
- Commit author: Niklas Haas, a long-time FFmpeg contributor
- Hardware target: AMD Zen 4 and newer, Intel Xeon Sapphire Rapids and other AVX-512 capable Intel processors
- Workload: RGB24 (24-bit per pixel) to RGBA (32-bit with alpha channel) conversion at 1920x1080 resolution
- Performance gain: 1.372x, or roughly 37% faster
- Instruction used: VPERMB (Vector Permute Byte) from the AVX-512 VBMI instruction group
Broader Impact on Multimedia Workloads
FFmpeg underpins countless video processing applications, from media players and streaming servers to broadcast tools and scientific imaging. Every transcoding pipeline that touches pixel format conversion will benefit from this optimization wherever AVX-512 hardware is available. The instruction set appeared in AMD's Zen 4 cores and Intel's Xeon Scalable Sapphire Rapids, and Intel recently reintroduced AVX-512 in some desktop products as well. With AVX-512 becoming more widespread, hand-tuned code paths like this one grow in practical value. Haas' work is a specific, measurable improvement for a common pattern. Further FFmpeg components, such as the video filtering and encoding subsystems, could see similar gains if more developers apply the same instruction-level tuning. The commit is already merged into FFmpeg's main branch and will ship in the next release.
Fact check
-
The optimization was committed by developer Niklas Haas on July 19, 2026.
reported · source
-
Performance improvement is 1.372x (37.2% faster) for RGB24 to RGBA conversion at 1920x1080 resolution.
reported · source
-
The optimization uses the VPERMB instruction from AVX-512 VBMI.
reported · source
-
Supported CPUs include AMD Zen 4 and newer and Intel Xeon Sapphire Rapids and other select Intel CPUs with AVX-512.
reported · source
Source reporting (1)
Join the conversation
You need to be registered and logged in to comment on blog articles.
0 Comments
No comments yet
Be the first to share your thoughts on this article.