yuv

Fast, pure-Rust conversion between YUV and RGB color formats with SIMD acceleration.

Library
Cargo
v0.8.17
122stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
72/100Good
Development Activity72
Maintenance84
Community64
Maturity48
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
82/100Excellent
Architecture86
Code Quality82
Innovation84
Learning Curve74

yuv (crate for the yuvutils-rs project) is a pure-Rust library for converting between YUV/YCbCr and RGB pixel formats. It targets performance on par with or slightly better than Google’s libyuv by using hand-written SIMD paths — AVX-512, AVX2, SSE, NEON, and WASM simd128 — selected at runtime based on the CPU’s available features.

It supports a broad range of color models and layouts, including YCbCr, YCgCo (and the reversible YCgCo-Re/Ro variants), YUY2, identity/GBR, and Sharp YUV, across RGB, BGR, RGBA, and BGRA buffers. Optional Rayon-based multithreading further accelerates conversion of large frames.

What You Get

  • Bidirectional conversion between YUV/YCbCr families and RGB/BGR/RGBA/BGRA buffers
  • Support for YCbCr, YCgCo, YCgCo-Re/Ro, YUY2, identity (GBR), and Sharp YUV models
  • Runtime SIMD dispatch across AVX-512, AVX2, SSE4.1, NEON, and WASM simd128
  • Optional Rayon multithreading for parallel conversion of large frames
  • Performance comparable to libyuv without a C dependency

Common Use Cases

  • Converting decoded video frames from YUV420 to RGBA for display or further processing
  • Encoding RGB image data into a YUV planar format before compression
  • Building cross-platform media pipelines that need fast, safe color conversion
  • Handling NV12/NV21 and packed YUY2 buffers from cameras or codecs

Under The Hood

Architecture - The crate exposes conversion functions per format pair (e.g. YUV420 to RGBA) that operate on caller-provided planar or packed buffers. Each function has a scalar fallback plus per-target SIMD implementations, and x86 paths use runtime feature detection to dispatch to SSE4.1, AVX2, or AVX-512 kernels; ARM uses NEON (with optional RDM) and WASM uses simd128. Optional Rayon feature-gates parallel row processing. Tech Stack - Pure Rust with architecture-specific intrinsics; AVX-512 support requires the nightly_avx512 feature on nightly Rust, while SSE/AVX2/NEON work on stable. Rayon is an optional dependency for multithreading. Code Quality - The project is actively developed and well maintained, versioned frequently (0.8.16), with CI builds across platforms and a large user base (3M+ downloads); the README documents supported formats and SIMD requirements precisely. API Design - The API is a flat set of well-named conversion functions taking source/destination slices, strides, dimensions, and a color range/matrix — familiar to anyone who has used libyuv — with no builder ceremony, keeping integration straightforward for media developers.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search