mod import;
pub use import::*;
use hang::catalog::AV1;
pub(crate) fn av1_from_av1c(av1c: &mp4_atom::Av1c) -> AV1 {
AV1 {
profile: av1c.seq_profile,
level: av1c.seq_level_idx_0,
bitdepth: bitdepth(av1c.twelve_bit, av1c.high_bitdepth),
mono_chrome: av1c.monochrome,
chroma_subsampling_x: av1c.chroma_subsampling_x,
chroma_subsampling_y: av1c.chroma_subsampling_y,
chroma_sample_position: av1c.chroma_sample_position,
..Default::default()
}
}
pub(crate) fn bitdepth(twelve_bit: bool, high_bitdepth: bool) -> u8 {
8 + 2 * u8::from(high_bitdepth) + 2 * u8::from(twelve_bit)
}
#[cfg(test)]
mod tests {
use super::bitdepth;
#[test]
fn maps_bitdepth_flags() {
assert_eq!(bitdepth(false, false), 8);
assert_eq!(bitdepth(false, true), 10);
assert_eq!(bitdepth(true, true), 12);
assert_eq!(bitdepth(true, false), 10);
}
}