Crates.io | pixelfmt |
lib.rs | pixelfmt |
version | 0.1.0 |
source | src |
created_at | 2024-10-22 23:10:35.068155 |
updated_at | 2024-10-22 23:10:35.068155 |
description | Pixel format conversions in pure Rust with SIMD optimizations |
homepage | |
repository | https://github.com/infiniteathlete/pixelfmt |
max_upload_size | |
id | 1419425 |
size | 3,312,524 |
Pixel format conversions in pure Rust with SIMD optimizations on x86_64 and aarch64. The performance goal is to approximately reach the memory bandwidth limit and thus optimal performance when the input and output are not already in CPU cache.
Limitations and future work:
You may find the notes in docs/simd.md
helpful if you are new
to SIMD and thinking of contributing.
The main alternative to pixelfmt
is Chrome's C++
libyuv library.
Rust bindings are available via the yuv-sys
or libyuv
crates.
Some reasons to prefer pixelfmt
:
pixelfmt
is pure Rust and thus may be easier and quicker to build,
particularly when cross-compiling.pixelfmt
is less total code.pixelfmt
's uyvy_to_i420
implementation benchmarks as slightly faster than
libyuv
's. This appears to come down to design choices: libyuv
has
separate routines to extract the Y and U+V planes, where pixelfmt
gains
some performance by doing it all with a single read of the UYVY data.
pixelfmt
also has a hand-optimized conversion function where libyuv
uses a more generalized autovectorization approach.pixelfmt
uses safe Rust when possible, where libyuv
is entirely written
in (unsafe) C++. That said, pixelfmt
still has a fair bit of unsafe
logic for vendor SIMD intrinsics.Some reasons to prefer libyuv
:
libyuv
is much more widely used.libyuv
is much more comprehensive and flexible.SPDX-License-Identifier: MIT OR Apache-2.0
See LICENSE-MIT.txt or LICENSE-APACHE, respectively.