@@ -439,14 +439,15 @@ impl<T: Pixel> ContextInner<T> {
439
439
440
440
fn set_frame_properties (
441
441
& mut self , output_frameno : u64 ,
442
- ) -> Result < ( ) , EncoderStatus > {
442
+ ) -> Result < bool , EncoderStatus > {
443
443
let fi = self . build_frame_properties ( output_frameno) ?;
444
+ let valid = !fi. invalid ;
444
445
445
446
let frame =
446
447
self . frame_q . get ( & fi. input_frameno ) . as_ref ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) ;
447
448
self . frame_data . insert ( output_frameno, FrameData :: new ( fi, frame. clone ( ) ) ) ;
448
449
449
- Ok ( ( ) )
450
+ Ok ( valid )
450
451
}
451
452
452
453
#[ allow( unused) ]
@@ -795,12 +796,17 @@ impl<T: Pixel> ContextInner<T> {
795
796
796
797
#[ hawktracer( compute_frame_invariants) ]
797
798
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 )
799
801
{
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
+ }
804
810
}
805
811
self . next_lookahead_output_frameno += 1 ;
806
812
}
0 commit comments