#yuv #format-conversion #rgb2yuv

yuvutils-rs

High performance utilities for YUV format handling and conversion

23 releases

0.3.0 Jun 15, 2024
0.2.7 Jun 8, 2024
0.2.6 May 31, 2024
0.1.13 May 23, 2024

#106 in Images

Download history 370/week @ 2024-05-11 797/week @ 2024-05-18 890/week @ 2024-05-25 131/week @ 2024-06-01 218/week @ 2024-06-08 143/week @ 2024-06-15

1,453 downloads per month
Used in 2 crates

Apache-2.0 OR BSD-3-Clause

645KB
14K SLoC

Rust utilities for YUV format handling and conversion.

Fast and simple YUV approximation conversion in pure Rust. At most the same as libyuv does. Performance will be equal to libyuv or slightly higher on platforms where SIMD is implemented. Otherwise equal or slower.

Mostly implemented AVX-512, AVX2, SSE, NEON

X86 targets with SSE and AVX uses runtime dispatch to detect available cpu features.

Supports:

  • YCbCr ( aka YUV )
  • YCgCo

SIMD

rustc avx2, avx512f, avx512bw, neon, sse4.1 features should be set when you expect than code will run on supported device.

For AVX-512 target feature avx512bw is required along with feature nightly_avx512 and nightly rust channel compiler.

Adding to project

cargo add yuvutils-rs

RGB to 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 to 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 To 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 to RGB

ycgco420_to_rgb(&y_plane, y_stride, 
                &cg_plane, cg_stride,
                &co_plane, co_stride,
                &mut rgb, rgb_stride,
                width, height, 
                YuvRange::TV);

No runtime deps

Features