Skip to content

Commit

Permalink
Improve generation from HDR10+ metadata with non-zero offset frame in…
Browse files Browse the repository at this point in the history
…dices

Some software such as Resolve creates metadata with SceneFirstFrameIndex values
that do not start from zero.
  • Loading branch information
quietvoid committed Aug 23, 2023
1 parent 1971745 commit 3ec01dc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/dovi/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,17 @@ fn parse_hdr10plus_for_l1<P: AsRef<Path>>(

let frame_count = metadata_root.scene_info.len();

let scene_first_frames = metadata_root.scene_info_summary.scene_first_frame_index;
let mut scene_first_frames = metadata_root.scene_info_summary.scene_first_frame_index;
let first_frame_index = scene_first_frames
.first()
.cloned()
.expect("Missing SceneFirstFrameIndex array");

// Offset indices according to first index, since they should start at 0
scene_first_frames
.iter_mut()
.for_each(|i| *i -= first_frame_index);

let scene_frame_lengths = metadata_root.scene_info_summary.scene_frame_numbers;

let mut hdr10plus_shots = Vec::with_capacity(scene_first_frames.len());
Expand Down

0 comments on commit 3ec01dc

Please sign in to comment.