Skip to content

Commit ea5daae

Browse files
committed
Explicitly skip processing non-valid frame invariants
1 parent ecce9c1 commit ea5daae

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/api/internal.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,15 @@ impl<T: Pixel> ContextInner<T> {
439439

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

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

449-
Ok(())
450+
Ok(valid)
450451
}
451452

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

796797
#[hawktracer(compute_frame_invariants)]
797798
pub fn compute_frame_invariants(&mut self) {
798-
while self.set_frame_properties(self.next_lookahead_output_frameno).is_ok()
799+
while let Ok(valid) =
800+
self.set_frame_properties(self.next_lookahead_output_frameno)
799801
{
800-
self
801-
.compute_lookahead_motion_vectors(self.next_lookahead_output_frameno);
802-
if self.config.temporal_rdo() {
803-
self.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
802+
if valid {
803+
self.compute_lookahead_motion_vectors(
804+
self.next_lookahead_output_frameno,
805+
);
806+
if self.config.temporal_rdo() {
807+
self
808+
.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
809+
}
804810
}
805811
self.next_lookahead_output_frameno += 1;
806812
}

0 commit comments

Comments
 (0)