Skip to content

Commit

Permalink
Explicitly skip processing non-valid frame invariants
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Mar 17, 2021
1 parent ecce9c1 commit ea5daae
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/api/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,15 @@ impl<T: Pixel> ContextInner<T> {

fn set_frame_properties(
&mut self, output_frameno: u64,
) -> Result<(), EncoderStatus> {
) -> Result<bool, EncoderStatus> {
let fi = self.build_frame_properties(output_frameno)?;
let valid = !fi.invalid;

let frame =
self.frame_q.get(&fi.input_frameno).as_ref().unwrap().as_ref().unwrap();
self.frame_data.insert(output_frameno, FrameData::new(fi, frame.clone()));

Ok(())
Ok(valid)
}

#[allow(unused)]
Expand Down Expand Up @@ -795,12 +796,17 @@ impl<T: Pixel> ContextInner<T> {

#[hawktracer(compute_frame_invariants)]
pub fn compute_frame_invariants(&mut self) {
while self.set_frame_properties(self.next_lookahead_output_frameno).is_ok()
while let Ok(valid) =
self.set_frame_properties(self.next_lookahead_output_frameno)
{
self
.compute_lookahead_motion_vectors(self.next_lookahead_output_frameno);
if self.config.temporal_rdo() {
self.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
if valid {
self.compute_lookahead_motion_vectors(
self.next_lookahead_output_frameno,
);
if self.config.temporal_rdo() {
self
.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
}
}
self.next_lookahead_output_frameno += 1;
}
Expand Down

0 comments on commit ea5daae

Please sign in to comment.