Skip to main content

mediaframe/source/
gbrap16.rs

1//! Planar GBR+A 16-bit (`AV_PIX_FMT_GBRAP16{LE,BE}`) — four full-resolution
2//! `u16` planes in **G, B, R, A** order (FFmpeg convention).
3//!
4//! All 16 bits of each `u16` element are active (full `u16` range).
5//! Alpha is real per-pixel α (1:1 with G); not padding.
6
7use crate::frame::{Gbrap16Frame, GbrapHighBitFrame};
8
9walker! {
10  planar4_bits_be {
11    /// Zero-sized marker for the planar GBR+A 16-bit source format
12    /// (`AV_PIX_FMT_GBRAP16{LE,BE}`). `<const BE: bool>` defaults to `false`.
13    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
14    marker: Gbrap16,
15    frame: Gbrap16Frame,
16    generic_frame: GbrapHighBitFrame,
17    bits: 16,
18    row: Gbrap16Row,
19    sink: Gbrap16Sink,
20    walker: gbrap16_to,
21    walker_endian: gbrap16_to_endian,
22    walker_inner: gbrap16_walker,
23    elem_type: u16,
24    row_doc: "One output row of a [`Gbrap16`] source — four full-width\n\
25              `u16` planes in G / B / R / A order (full 16-bit range).",
26    walker_doc: "Walks a [`Gbrap16Frame<'_, BE>`] row by row into the sink.",
27  }
28}
29
30impl<'a> Gbrap16Row<'a> {
31  /// Green plane row — full width, samples in [0, 65535].
32  #[cfg_attr(not(tarpaulin), inline(always))]
33  pub fn g(&self) -> &'a [u16] {
34    self.y()
35  }
36  /// Blue plane row — full width.
37  #[cfg_attr(not(tarpaulin), inline(always))]
38  pub fn b(&self) -> &'a [u16] {
39    self.u()
40  }
41  /// Red plane row — full width.
42  #[cfg_attr(not(tarpaulin), inline(always))]
43  pub fn r(&self) -> &'a [u16] {
44    self.v()
45  }
46  // Alpha row is already exposed as `self.a()` by the macro — no rename needed.
47}