#rgb #color-space #color #encoding #ycbcr #bt601 #rec709

no-std yuv

Conversion between various YUV (YCbCr) formats and RGB

3 releases

0.1.6 Apr 25, 2024
0.1.5 Sep 5, 2022
0.1.4 May 30, 2021
0.1.0 Sep 6, 2020

#20 in Multimedia

Download history 133/week @ 2024-01-26 69/week @ 2024-02-02 102/week @ 2024-02-09 155/week @ 2024-02-16 247/week @ 2024-02-23 160/week @ 2024-03-01 139/week @ 2024-03-08 73/week @ 2024-03-15 102/week @ 2024-03-22 186/week @ 2024-03-29 114/week @ 2024-04-05 143/week @ 2024-04-12 1311/week @ 2024-04-19 5034/week @ 2024-04-26 2154/week @ 2024-05-03 2273/week @ 2024-05-10

10,800 downloads per month
Used in 13 crates (6 directly)

BSD-2-Clause

35KB
956 lines

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?

lib.rs:

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.

Dependencies

~230KB