X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-itu%2Fsrc%2Fcodecs%2Fh264%2Ftypes.rs;h=6fe5aea9f00f40f4612e38dece654d24ccb4a029;hb=e6aaad5c5273cd814b5748b7faf3751835a37217;hp=319ebf5f5aafb9817aa75c04e0cb117c04f3c3c1;hpb=42005e259dd77147b77c7a0057aa3cf033e331d0;p=nihav.git diff --git a/nihav-itu/src/codecs/h264/types.rs b/nihav-itu/src/codecs/h264/types.rs index 319ebf5..6fe5aea 100644 --- a/nihav-itu/src/codecs/h264/types.rs +++ b/nihav-itu/src/codecs/h264/types.rs @@ -1,7 +1,7 @@ use nihav_core::frame::NASimpleVideoFrame; use nihav_codec_support::codecs::{MV, ZERO_MV}; use nihav_codec_support::data::GenericCache; -use super::FrameRefs; +use super::SliceRefs; use super::pic_ref::FrameMBInfo; #[repr(u8)] @@ -12,8 +12,9 @@ pub enum BMode { Bi, } -#[derive(Clone,Copy,Debug,PartialEq)] +#[derive(Clone,Copy,Debug,PartialEq,Default)] pub enum MBType { + #[default] Intra4x4, Intra8x8, Intra16x16(u8, u8, u8), @@ -106,16 +107,13 @@ impl MBType { } } -impl Default for MBType { - fn default() -> Self { MBType::Intra4x4 } -} - -#[derive(Clone,Copy,Debug,PartialEq)] +#[derive(Clone,Copy,Debug,PartialEq,Default)] pub enum SubMBType { P8x8, P8x4, P4x8, P4x4, + #[default] Direct8x8, B8x8(BMode), B8x4(BMode), @@ -159,12 +157,8 @@ impl SubMBType { } } -impl Default for SubMBType { - fn default() -> Self { SubMBType::Direct8x8 } -} - #[repr(u8)] -#[derive(Clone,Copy,Debug,PartialEq)] +#[derive(Clone,Copy,Debug,PartialEq,Default)] pub enum CompactMBType { Intra4x4, Intra8x8, @@ -185,6 +179,7 @@ pub enum CompactMBType { B8x8, BSkip, + #[default] None, } @@ -215,10 +210,6 @@ impl CompactMBType { } } -impl Default for CompactMBType { - fn default() -> Self { CompactMBType::None } -} - impl From for CompactMBType { fn from(mbtype: MBType) -> Self { match mbtype { @@ -243,7 +234,7 @@ impl From for CompactMBType { } #[repr(u8)] -#[derive(Clone,Copy,Debug,PartialEq)] +#[derive(Clone,Copy,Debug,PartialEq,Default)] pub enum IntraPredMode { Vertical, Horizontal, @@ -254,6 +245,7 @@ pub enum IntraPredMode { HorDown, VerLeft, HorUp, + #[default] None, } @@ -268,10 +260,6 @@ impl IntraPredMode { } } -impl Default for IntraPredMode { - fn default() -> Self { IntraPredMode::None } -} - impl From for IntraPredMode { fn from(val: u8) -> Self { match val { @@ -490,7 +478,7 @@ impl SliceState { } } } - pub fn fill_deblock(&mut self, frefs: &FrameRefs, deblock_mode: u8, is_s: bool) { + pub fn fill_deblock(&mut self, frefs: &SliceRefs, deblock_mode: u8, is_s: bool) { if deblock_mode == 1 { return; } @@ -744,7 +732,7 @@ impl SliceState { self.fill_mv (0, 0, 16, 16, 0, mv); self.fill_ref(0, 0, 16, 16, 0, ref_idx); } - pub fn predict_direct_mb(&mut self, frame_refs: &FrameRefs, temporal_mv: bool, direct_8x8: bool, cur_id: u16) { + pub fn predict_direct_mb(&mut self, frame_refs: &SliceRefs, temporal_mv: bool, direct_8x8: bool, cur_id: u16) { let (col_mb, r1_poc, r1_long) = frame_refs.get_colocated_info(self.mb_x, self.mb_y); if direct_8x8 { for blk4 in 0..16 { @@ -764,7 +752,7 @@ impl SliceState { } } } - pub fn predict_direct_sub(&mut self, frame_refs: &FrameRefs, temporal_mv: bool, direct8x8: bool, cur_id: u16, blk4: usize) { + pub fn predict_direct_sub(&mut self, frame_refs: &SliceRefs, temporal_mv: bool, direct8x8: bool, cur_id: u16, blk4: usize) { let src_blk = if !direct8x8 { blk4 } else { BLK4_TO_D8[blk4] }; let (mbi, r1_poc, r1_long) = frame_refs.get_colocated_info(self.mb_x, self.mb_y); let (mv0, ref0, mv1, ref1) = self.get_direct_mv(frame_refs, &mbi, r1_poc, r1_long, temporal_mv, cur_id, src_blk); @@ -772,7 +760,7 @@ impl SliceState { self.get_cur_blk8(blk4_to_blk8(blk4)).ref_idx = [ref0, ref1]; } #[allow(clippy::nonminimal_bool)] - pub fn get_direct_mv(&self, frame_refs: &FrameRefs, mbi: &FrameMBInfo, r1_poc: u16, r1_long: bool, temporal_mv: bool, cur_id: u16, blk4: usize) -> (MV, PicRef, MV, PicRef) { + pub fn get_direct_mv(&self, frame_refs: &SliceRefs, mbi: &FrameMBInfo, r1_poc: u16, r1_long: bool, temporal_mv: bool, cur_id: u16, blk4: usize) -> (MV, PicRef, MV, PicRef) { let blk8 = blk4_to_blk8(blk4); let (col_mv, r0_poc, col_idx) = if mbi.ref_poc[blk8] == [MISSING_POC; 2] { (ZERO_MV, MISSING_POC, MISSING_REF)