mediaframe/source/bayer16.rs
1//! 10 / 12 / 14 / 16-bit Bayer — single-plane mosaic source marker.
2//!
3//! `Bayer16<const BITS: u32>` covers the full family of high-bit-depth
4//! Bayer formats (10, 12, 14, and 16-bit low-packed `u16` planes).
5//!
6//! # Design note
7//!
8//! The walker function (`colconv::raw::bayer16_to`) and the row borrow
9//! type (`colconv::raw::BayerRow16`) live in `colconv::raw` because they
10//! require demosaic parameters (`BayerDemosaic`, `WhiteBalance`,
11//! `ColorCorrectionMatrix`) that are colconv processing-layer types.
12//! Only the zero-sized [`Bayer16`] marker lives here so that:
13//!
14//! - `Bayer16<BITS>` can implement `mediaframe::SourceFormat`, and
15//! - downstream crates that need to name the source format type do not
16//! need to depend on `colconv`.
17
18marker! {
19 /// Zero-sized marker for the high-bit-depth Bayer source family.
20 ///
21 /// Parameterized on the active bit depth `BITS` ∈ {10, 12, 14, 16}.
22 /// Samples are low-packed `u16` — active bits in positions
23 /// `[BITS-1 : 0]`, remaining high bits are zero.
24 #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
25 struct Bayer16<const BITS: u32>;
26}
27
28/// Type alias for the 10-bit Bayer source marker.
29pub type Bayer10 = Bayer16<10>;
30/// Type alias for the 12-bit Bayer source marker.
31pub type Bayer12 = Bayer16<12>;
32/// Type alias for the 14-bit Bayer source marker.
33pub type Bayer14 = Bayer16<14>;
34/// Type alias for the 16-bit Bayer source marker (full-range `u16`).
35pub type Bayer16Bit = Bayer16<16>;