Skip to main content

gamut_color/
lib.rs

1//! Color primitives for the gamut codecs: pixel formats, bit depths, chroma subsampling, the
2//! CICP code points carried in nclx / AV1 sequence headers, and planar buffers.
3//!
4//! The M0 AVIF encoder uses only a narrow slice — 8-bit RGB in, mapped to identity (`mc = 0`)
5//! 4:4:4 planes. The enums here intentionally model the wider spec surface (more formats, bit
6//! depths, subsamplings, and CICP code points) so later milestones (M2 pixel formats, M4 HDR;
7//! see `gamut-avif/STATUS.md`) extend without reshaping the types.
8//!
9//! On top of that metadata layer, the [`transfer`], [`oklab`], [`matrix`], [`gamut_map`], and
10//! [`profile`] modules add `f64` colour science — encoder-exact EOTFs, OKLab transforms with
11//! per-gamut matrices (derived from chromaticities via Bradford adaptation), gamut clamping, and
12//! source-profile bundles over the CICP axes. This math is **Tier-1** (correctness only): it uses
13//! `std` `f64`, so it is not bit-reproducible across platforms — see `references/color/README.md`.
14#![forbid(unsafe_code)]
15
16pub mod cicp;
17mod format;
18pub mod gamut_map;
19mod linalg;
20pub mod matrix;
21pub mod oklab;
22mod pixel;
23mod planar;
24pub mod profile;
25pub mod transfer;
26mod ycbcr;
27
28pub use cicp::{ColorRange, ColourPrimaries, MatrixCoefficients, TransferCharacteristics};
29pub use format::{BitDepth, ChromaSubsampling};
30pub use pixel::{clip_pixel, clip_pixel8};
31pub use planar::Planar8;
32pub use ycbcr::{Bt601Range, Yuv420, rgb_to_ycbcr, ycbcr_to_rgb};