From 531df4322cce4abbb1c3e12a6b8e1b19fc2f5112 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Fri, 23 Feb 2024 18:17:37 +0000 Subject: [PATCH] Spec specifies ceil(); implementation lacked it --- src/nal/pps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nal/pps.rs b/src/nal/pps.rs index 3254972..f8784aa 100644 --- a/src/nal/pps.rs +++ b/src/nal/pps.rs @@ -130,7 +130,7 @@ impl SliceGroup { ) -> Result, PpsError> { let pic_size_in_map_units_minus1 = r.read_ue("pic_size_in_map_units_minus1")?; // TODO: avoid any panics due to failed conversions - let size = ((1f64 + f64::from(num_slice_groups_minus1)).log2()) as u32; + let size = (1f64 + f64::from(num_slice_groups_minus1)).log2().ceil() as u32; let mut run_length_minus1 = Vec::with_capacity(num_slice_groups_minus1 as usize + 1); for _ in 0..pic_size_in_map_units_minus1 + 1 { run_length_minus1.push(r.read_u32(size, "slice_group_id")?);