use crate::internal::bpg_hevc_decode::hevc::slice::IntraPredMode;
#[derive(Clone, Debug)]
pub(super) struct CodedBlock {
pub(super) levels: Vec<i16>,
pub(super) cbf: bool,
pub(super) frac_bits: u64,
}
#[derive(Debug)]
pub(super) struct LeafTu {
pub(super) log2_size: u8,
pub(super) chroma_log2: u8,
pub(super) trafo_depth: u8,
pub(super) luma_mode: u8,
pub(super) chroma_mode: u8,
pub(super) luma: CodedBlock,
pub(super) cb: CodedBlock,
pub(super) cr: CodedBlock,
pub(super) cb1: CodedBlock,
pub(super) cr1: CodedBlock,
}
#[derive(Debug)]
pub(super) struct ParentChromaTu {
pub(super) log2_size: u8,
pub(super) chroma_mode: u8,
pub(super) cb: CodedBlock,
pub(super) cb1: CodedBlock,
pub(super) cr: CodedBlock,
pub(super) cr1: CodedBlock,
}
#[derive(Debug)]
pub(super) enum Tt {
Split {
log2_size: u8,
trafo_depth: u8,
cbf_cb: bool,
cbf_cr: bool,
cbf_cb1: bool,
cbf_cr1: bool,
parent_chroma: Option<ParentChromaTu>,
kids: Vec<Tt>,
},
Leaf(LeafTu),
}
impl Tt {
pub(super) fn cbf_cb(&self) -> bool {
match self {
Tt::Split { cbf_cb, .. } => *cbf_cb,
Tt::Leaf(l) => l.cb.cbf,
}
}
pub(super) fn cbf_cr(&self) -> bool {
match self {
Tt::Split { cbf_cr, .. } => *cbf_cr,
Tt::Leaf(l) => l.cr.cbf,
}
}
pub(super) fn cbf_cb1(&self) -> bool {
match self {
Tt::Split { cbf_cb1, .. } => *cbf_cb1,
Tt::Leaf(l) => l.cb1.cbf,
}
}
pub(super) fn cbf_cr1(&self) -> bool {
match self {
Tt::Split { cbf_cr1, .. } => *cbf_cr1,
Tt::Leaf(l) => l.cr1.cbf,
}
}
}
#[derive(Debug)]
pub(super) struct NxnInfo {
pub(super) luma_modes: [u8; 4],
pub(super) mpms: [[IntraPredMode; 3]; 4],
pub(super) chroma_mode_idx: [u8; 4],
}
#[derive(Debug)]
pub(super) struct CuLeaf {
pub(super) mpm: [IntraPredMode; 3],
pub(super) luma_mode: u8,
pub(super) chroma_mode_idx: u8,
pub(super) tt: Tt,
pub(super) nxn: Option<NxnInfo>,
}
#[derive(Debug)]
pub(super) enum CuNode {
Split { kids: Vec<CuNode> },
Leaf(CuLeaf),
}