#rgb #ycbcr #pixel #color #bt601 #rec709

no-std yuv

Conversion between various YUV (YCbCr) formats and RGB

4 releases

0.1.9 Oct 17, 2024
0.1.8 Aug 4, 2024
0.1.7 Jul 7, 2024
0.1.6 Apr 25, 2024
0.1.0 Sep 6, 2020

#616 in Images

Download history 261/week @ 2024-12-23 2154/week @ 2024-12-30 19154/week @ 2025-01-06 17928/week @ 2025-01-13 8876/week @ 2025-01-20 10246/week @ 2025-01-27 11400/week @ 2025-02-03 13272/week @ 2025-02-10 9022/week @ 2025-02-17 19740/week @ 2025-02-24 14415/week @ 2025-03-03 22257/week @ 2025-03-10 13575/week @ 2025-03-17 13960/week @ 2025-03-24 13499/week @ 2025-03-31 16692/week @ 2025-04-07

58,350 downloads per month
Used in 13 crates (6 directly)

BSD-2-Clause

26KB
517 lines

This crate contains two things:

  1. color enums that can be used to describe color spaces in image and video formats, as defined in ISO/IEC 23091-4/ITU-T H.273
  2. Routines to convert between YUV family of color spaces and RGB.

YUV formats

This crate implements conversions from YUV/YCbCr formats to RGB. It also contains enums/constants for describing color spaces common in video formats.

Currently it's in an early stage, implementing subset needed for decoding AV1/AVIF.

Implemented

  • Matrix conversion for BT601, BT709, FCC, BT470BG, SMPTE240
  • YCgCo (untested)
  • Identity pass-through (GBR)
  • Studio and full range colors
  • 8-bit, and 10/12 to 16-bit conversions

Planned

  • Gamma conversion
  • Color primaries conversion
  • Chroma upsampling
  • RGB to YUV conversion
  • YUV pixel convenience functions, like in rgb
  • 8-to-16-bit expanding conversion
  • HDR to SDR conversion?
  • Maybe HDR support?

Dependencies

~290KB