Skip to content

Commit

Permalink
Fix variable-name confusion error.
Browse files Browse the repository at this point in the history
According to the spec, the two values pic_size_in_map_units_minus1 and
num_slice_groups_minus1 should be used the other way around.

Fixes #57
  • Loading branch information
dholroyd committed Feb 26, 2024
1 parent 5670413 commit 21a5cbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nal/pps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ impl SliceGroup {
) -> Result<Vec<u32>, 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(pic_size_in_map_units_minus1)).log2()) as u32;
let size = ((1f64 + f64::from(num_slice_groups_minus1)).log2()) as u32;
let mut run_length_minus1 = Vec::with_capacity(num_slice_groups_minus1 as usize + 1);
for _ in 0..num_slice_groups_minus1 + 1 {
for _ in 0..pic_size_in_map_units_minus1 + 1 {
run_length_minus1.push(r.read_u32(size, "slice_group_id")?);
}
Ok(run_length_minus1)
Expand Down

0 comments on commit 21a5cbe

Please sign in to comment.