X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-itu%2Fsrc%2Fcodecs%2Fh264%2Fslice.rs;h=ad1d244afe5cfd84b29fbe0060697971491c0558;hb=932ae27bc58abef098a4be6f05fdd731d47a7653;hp=5c7072908951084788299a2d35177ff1ce31ae6c;hpb=495b7ec009b39e925ba204a61014ab316883cf66;p=nihav.git diff --git a/nihav-itu/src/codecs/h264/slice.rs b/nihav-itu/src/codecs/h264/slice.rs index 5c70729..ad1d244 100644 --- a/nihav-itu/src/codecs/h264/slice.rs +++ b/nihav-itu/src/codecs/h264/slice.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use nihav_core::codecs::{DecoderResult, DecoderError}; use nihav_core::frame::FrameType; use nihav_core::io::bitreader::*; @@ -18,23 +20,14 @@ pub enum SliceType { impl SliceType { pub fn is_intra(self) -> bool { - match self { - SliceType::I | SliceType::SI => true, - _ => false, - } + matches!(self, SliceType::I | SliceType::SI) } pub fn is_p(self) -> bool { - match self { - SliceType::P | SliceType::SP => true, - _ => false, - } + matches!(self, SliceType::P | SliceType::SP) } pub fn is_b(self) -> bool { self == SliceType::B } pub fn is_s(self) -> bool { - match self { - SliceType::SI | SliceType::SP => true, - _ => false, - } + matches!(self, SliceType::SI | SliceType::SP) } pub fn to_frame_type(self) -> FrameType { match self { @@ -162,7 +155,8 @@ pub fn parse_slice_header_minimal(br: &mut BitReader) -> DecoderResult<(usize, S } #[allow(clippy::cognitive_complexity)] -pub fn parse_slice_header(br: &mut BitReader, sps_arr: &[SeqParameterSet], pps_arr: &[PicParameterSet], is_idr: bool, nal_ref_idc: u8) -> DecoderResult { +#[allow(clippy::manual_range_contains)] +pub fn parse_slice_header(br: &mut BitReader, sps_arr: &[Arc], pps_arr: &[Arc], is_idr: bool, nal_ref_idc: u8) -> DecoderResult { let mut hdr: SliceHeader = unsafe { std::mem::zeroed() }; hdr.first_mb_in_slice = br.read_ue()? as usize;