diff --git a/src/codec/av1/parser.rs b/src/codec/av1/parser.rs index 19cded1b..5a33e870 100644 --- a/src/codec/av1/parser.rs +++ b/src/codec/av1/parser.rs @@ -249,7 +249,7 @@ pub struct DecoderModelInfo { pub num_units_in_decoding_tick: u32, /// Plus 1 specifies the length of the buffer_removal_time syntax element, /// in bits. - pub buffer_removal_time_length_minus_1: u32, + pub buffer_removal_time_length_minus_1: u8, /// Plus 1 specifies the length of the frame_presentation_time syntax /// element, in bits. pub frame_presentation_time_length_minus_1: u32, @@ -1691,7 +1691,7 @@ impl Parser { fn parse_decoder_model_info(dmi: &mut DecoderModelInfo, r: &mut Reader) -> anyhow::Result<()> { dmi.buffer_delay_length_minus_1 = r.read_bits(5)? as u8; dmi.num_units_in_decoding_tick = r.read_bits(32)?; - dmi.buffer_removal_time_length_minus_1 = r.read_bits(5)?; + dmi.buffer_removal_time_length_minus_1 = r.read_bits(5)? as u8; dmi.frame_presentation_time_length_minus_1 = r.read_bits(5)?; Ok(()) } @@ -3297,7 +3297,7 @@ impl Parser { if op_pt_idc == 0 || (in_temporal_layer && in_spatial_layer) { let n = buffer_removal_time_length_minus_1 + 1; - fh.buffer_removal_time[op_num] = r.read_bits(n.try_into().unwrap())?; + fh.buffer_removal_time[op_num] = r.read_bits(n)?; } } } diff --git a/src/codec/av1/synthesizer.rs b/src/codec/av1/synthesizer.rs index 5bd04a60..347246fc 100644 --- a/src/codec/av1/synthesizer.rs +++ b/src/codec/av1/synthesizer.rs @@ -788,12 +788,12 @@ where (op.idc >> (self.obu.obu_header.spatial_id + 8)) & 1 != 0; if op.idc == 0 || (in_temporal_layer && in_spatial_layer) { - let n = usize::try_from( + let n = usize::from( sequence .decoder_model_info .buffer_removal_time_length_minus_1 + 1, - )?; + ); self.f(n, op.decoder_buffer_delay)?; }