Skip to content

Commit 53fc05b

Browse files
committed
Explicitly skip processing non-valid frame invariants
1 parent 9626214 commit 53fc05b

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
@@ -424,14 +424,15 @@ impl<T: Pixel> ContextInner<T> {
424424

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

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

434-
Ok(())
435+
Ok(valid)
435436
}
436437

437438
#[allow(unused)]
@@ -780,12 +781,17 @@ impl<T: Pixel> ContextInner<T> {
780781

781782
#[hawktracer(compute_frame_invariants)]
782783
pub fn compute_frame_invariants(&mut self) {
783-
while self.set_frame_properties(self.next_lookahead_output_frameno).is_ok()
784+
while let Ok(valid) =
785+
self.set_frame_properties(self.next_lookahead_output_frameno)
784786
{
785-
self
786-
.compute_lookahead_motion_vectors(self.next_lookahead_output_frameno);
787-
if self.config.temporal_rdo() {
788-
self.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
787+
if valid {
788+
self.compute_lookahead_motion_vectors(
789+
self.next_lookahead_output_frameno,
790+
);
791+
if self.config.temporal_rdo() {
792+
self
793+
.compute_lookahead_intra_costs(self.next_lookahead_output_frameno);
794+
}
789795
}
790796
self.next_lookahead_output_frameno += 1;
791797
}

0 commit comments

Comments
 (0)