24 个版本
0.3.1 | 2024年7月13日 |
---|---|
0.3.0 | 2024年6月15日 |
0.2.7 | 2024年6月8日 |
0.2.6 | 2024年5月31日 |
0.1.13 | 2024年5月23日 |
#180 in 图像
每月下载量 149
在 2 crate 中使用
730KB
16K SLoC
Rust 用于处理和转换 YUV 格式的实用工具。
纯 Rust 实现的快速简单 YUV 近似转换。最多与 libyuv 相同。在支持 SIMD 的平台上,性能将与 libyuv 相等或略高。否则等于或较慢。
主要实现 AVX-512、AVX2、SSE、NEON
具有 SSE 和 AVX 的 X86 目标使用运行时调度来检测可用的 CPU 功能。
支持
- YCbCr(即 YUV)
- YCgCo
- YCgCo-R
- YUY2
SIMD
当您预期代码将在支持设备上运行时,应设置 rustc 的 avx2
、avx512f
、avx512bw
、neon
、sse4.1
功能。
对于 AVX-512 目标功能,需要 avx512bw
,以及 nightly_avx512
和 nightly
rust 编译器的 nightly
频道。
添加到项目
cargo add yuvutils-rs
RGB 到 YCbCr
rgb_to_yuv422(&mut y_plane, y_stride,
&mut u_plane, u_width,
&mut v_plane, v_width,
&rgb, rgb_stride,
width, height,
YuvRange::Full, YuvStandardMatrix::Bt709);
YCbCr 到 RGB
yuv422_to_rgb(&y_plane, y_stride,
&u_plane, u_stride,
&v_plane, v_stride,
&mut rgb, rgb_stride,
width, height,
YuvRange::Full, YuvStandardMatrix::Bt709);
RGB 转YCgCo
rgb_to_ycgco420(&mut y_plane, y_stride,
&mut cg_plane, cg_width,
&mut cg_plane, cg_width,
&rgb, rgb_stride,
width, height,
YuvRange::TV);
YCgCo 到 RGB
ycgco420_to_rgb(&y_plane, y_stride,
&cg_plane, cg_stride,
&co_plane, co_stride,
&mut rgb, rgb_stride,
width, height,
YuvRange::TV);