pub struct AvifGainMap {
pub metadata: GainMapMetadata,
pub gain_map_data: Vec<u8>,
pub alt_color_info: Option<ColorInformation>,
}Expand description
Gain map information extracted from an AVIF container.
Bundles the ISO 21496-1 metadata, the raw AV1-encoded gain map image data, and the alternate rendition’s color information into a single type.
The gain_map_data field contains an AV1 bitstream that can be decoded
with any AV1 decoder (e.g., rav1d) to obtain the gain map pixel values.
§Example
let bytes = std::fs::read("hdr.avif").unwrap();
let parser = zenavif_parse::AvifParser::from_bytes(&bytes).unwrap();
if let Some(Ok(gm)) = parser.gain_map() {
println!("Gain map: {} bytes", gm.gain_map_data.len());
println!("Multichannel: {}", gm.metadata.is_multichannel);
}Fields§
§metadata: GainMapMetadataISO 21496-1 gain map metadata (parsed from the tmap item payload).
gain_map_data: Vec<u8>Raw AV1 bitstream of the gain map image. Decode with an AV1 decoder to obtain the gain map pixel values.
alt_color_info: Option<ColorInformation>Color information for the alternate (typically HDR) rendition,
from the tmap item’s colr property.
Trait Implementations§
Source§impl Clone for AvifGainMap
impl Clone for AvifGainMap
Source§fn clone(&self) -> AvifGainMap
fn clone(&self) -> AvifGainMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AvifGainMap
impl RefUnwindSafe for AvifGainMap
impl Send for AvifGainMap
impl Sync for AvifGainMap
impl Unpin for AvifGainMap
impl UnsafeUnpin for AvifGainMap
impl UnwindSafe for AvifGainMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more