mediaframe/source/bgr48/mod.rs
1//! Packed BGR48 source (`AV_PIX_FMT_BGR48{LE,BE}`) — 16 bits per channel,
2//! `u16` element order `B, G, R`. Stride in u16 elements (≥ `3 * width`).
3//!
4//! The marker carries `<const BE: bool = false>`: `Bgr48` (= `Bgr48<false>`)
5//! is the LE source; `Bgr48<true>` is the BE source. The walker
6//! [`bgr48_to::<BE>`] propagates `BE` from [`Bgr48Frame<'_, BE>`] into the
7//! sinker dispatch.
8//!
9//! Outputs (Tier 8 finish):
10//! - `with_rgb` — swap B↔R, narrow each channel `>> 8`, pack as R, G, B.
11//! - `with_rgba` — same swap + narrow + alpha = `0xFF`.
12//! - `with_rgb_u16` — swap B↔R, native u16 passthrough (R, G, B output order).
13//! - `with_rgba_u16` — swap B↔R, native u16 passthrough + alpha = `0xFFFF`.
14//! - `with_luma` — Y′ from R/G/B after channel swap and narrowing to u8.
15//! - `with_luma_u16` — Y′ computed at u8 precision (matching `with_luma`'s
16//! output, with the same B↔R swap applied first) and zero-extended to
17//! u16. Same convention as the 8-bit-source family; not native 16-bit
18//! luma precision.
19//! - `with_hsv` — HSV via u8 RGB staging.
20
21use crate::frame::Bgr48Frame;
22
23walker! {
24 packed_be {
25 /// Zero-sized marker for the packed **BGR48** source format
26 /// (`AV_PIX_FMT_BGR48{LE,BE}`). `<const BE: bool>` defaults to `false`
27 /// (LE); the alias `Bgr48` resolves to `Bgr48<false>`.
28 #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
29 marker: Bgr48,
30 frame: Bgr48Frame,
31 row: Bgr48Row,
32 sink: Bgr48Sink,
33 walker: bgr48_to,
34 walker_endian: bgr48_to_endian,
35 buf_field: bgr48,
36 elem_type: u16,
37 row_elems: |w| w * 3,
38 row_doc: "One row of a [`Bgr48`] source — `width * 3` u16 elements \
39 (`B, G, R` per pixel, each channel 16 bits). Endianness is \
40 recorded on the parent [`Bgr48Frame<'_, BE>`] / sinker, not on \
41 the Row itself.",
42 walker_doc: "Walks a [`Bgr48Frame<'_, BE>`] row by row into the sink. \
43 Propagates `<const BE: bool>` from the frame into \
44 [`Bgr48Sink<BE>`].",
45 }
46}
47
48#[cfg(all(test, feature = "std"))]
49mod tests;