pub struct AlphHeader {
pub compression: AlphCompression,
pub filtering: AlphFiltering,
pub preprocessing: AlphPreprocessing,
pub reserved: u8,
pub info_byte: u8,
}Expand description
Decoded §2.7.1.2 ALPH info byte plus the offset at which the
alpha bitstream begins inside the chunk payload.
Constructed via AlphHeader::parse. The actual alpha bitstream
(raw or VP8L-compressed) is not decoded — this layer’s job is
to surface the 2-bit Rsv / P / F / C decomposition. The
payload after byte 0 — payload[1..] — is the §2.7.1.2 “Alpha
bitstream” of Chunk Size - 1 bytes; callers that need it should
slice the chunk payload at Self::bitstream_offset.
Fields§
§compression: AlphCompressionC field — compression method (§2.7.1.2).
filtering: AlphFilteringF field — filtering method (§2.7.1.2).
preprocessing: AlphPreprocessingP field — preprocessing hint (§2.7.1.2).
reserved: u8Rsv field — raw 2-bit value from bits 7..6 of the info byte.
§2.7.1.2 says “MUST be 0. Readers MUST ignore this field.” —
we surface the raw value for observability without rejecting.
info_byte: u8Raw info byte, preserved for round-trip and trace assertions.
Implementations§
Source§impl AlphHeader
impl AlphHeader
Sourcepub fn parse(payload: &[u8]) -> Result<Self, AlphError>
pub fn parse(payload: &[u8]) -> Result<Self, AlphError>
Parse the ALPH chunk payload’s §2.7.1.2 info byte.
payload is the whole §2.3 chunk payload (i.e. the slice
returned by crate::container::WebpChunk::payload for a
chunk whose FourCC is crate::container::fourcc::ALPH). Only
the first byte is consumed by this layer; the remainder is the
alpha bitstream callers must hand off to a later VP8L or raw
decode pass.
Sourcepub const fn bitstream_offset(&self) -> usize
pub const fn bitstream_offset(&self) -> usize
Offset (within the ALPH chunk payload) at which the alpha bitstream begins. Always 1 per §2.7.1.2 — the info byte is followed immediately by the bitstream.
Trait Implementations§
Source§impl Clone for AlphHeader
impl Clone for AlphHeader
Source§fn clone(&self) -> AlphHeader
fn clone(&self) -> AlphHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AlphHeader
Source§impl Debug for AlphHeader
impl Debug for AlphHeader
impl Eq for AlphHeader
Source§impl PartialEq for AlphHeader
impl PartialEq for AlphHeader
Source§fn eq(&self, other: &AlphHeader) -> bool
fn eq(&self, other: &AlphHeader) -> bool
self and other values to be equal, and is used by ==.