@@ -442,8 +442,9 @@ impl<T: Pixel> ContextInner<T> {
442
442
443
443
fn set_frame_properties (
444
444
& mut self , output_frameno : u64 ,
445
- ) -> Result < ( ) , EncoderStatus > {
445
+ ) -> Result < bool , EncoderStatus > {
446
446
let fi = self . build_frame_properties ( output_frameno) ?;
447
+ let valid = !fi. invalid ;
447
448
448
449
let frame =
449
450
self . frame_q . get ( & fi. input_frameno ) . as_ref ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) ;
@@ -452,7 +453,7 @@ impl<T: Pixel> ContextInner<T> {
452
453
FrameData :: new ( output_frameno, fi, frame. clone ( ) ) ,
453
454
) ;
454
455
455
- Ok ( ( ) )
456
+ Ok ( valid )
456
457
}
457
458
458
459
#[ allow( unused) ]
@@ -801,12 +802,17 @@ impl<T: Pixel> ContextInner<T> {
801
802
802
803
#[ hawktracer( compute_frame_invariants) ]
803
804
pub fn compute_frame_invariants ( & mut self ) {
804
- while self . set_frame_properties ( self . next_lookahead_output_frameno ) . is_ok ( )
805
+ while let Ok ( valid) =
806
+ self . set_frame_properties ( self . next_lookahead_output_frameno )
805
807
{
806
- self
807
- . compute_lookahead_motion_vectors ( self . next_lookahead_output_frameno ) ;
808
- if self . config . temporal_rdo ( ) {
809
- self . compute_lookahead_intra_costs ( self . next_lookahead_output_frameno ) ;
808
+ if valid {
809
+ self . compute_lookahead_motion_vectors (
810
+ self . next_lookahead_output_frameno ,
811
+ ) ;
812
+ if self . config . temporal_rdo ( ) {
813
+ self
814
+ . compute_lookahead_intra_costs ( self . next_lookahead_output_frameno ) ;
815
+ }
810
816
}
811
817
self . next_lookahead_output_frameno += 1 ;
812
818
}
0 commit comments