@@ -424,14 +424,15 @@ impl<T: Pixel> ContextInner<T> {
424
424
425
425
fn set_frame_properties (
426
426
& mut self , output_frameno : u64 ,
427
- ) -> Result < ( ) , EncoderStatus > {
427
+ ) -> Result < bool , EncoderStatus > {
428
428
let fi = self . build_frame_properties ( output_frameno) ?;
429
+ let valid = !fi. invalid ;
429
430
430
431
let frame =
431
432
self . frame_q . get ( & fi. input_frameno ) . as_ref ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) ;
432
433
self . frame_data . insert ( output_frameno, FrameData :: new ( fi, frame. clone ( ) ) ) ;
433
434
434
- Ok ( ( ) )
435
+ Ok ( valid )
435
436
}
436
437
437
438
#[ allow( unused) ]
@@ -780,12 +781,17 @@ impl<T: Pixel> ContextInner<T> {
780
781
781
782
#[ hawktracer( compute_frame_invariants) ]
782
783
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 )
784
786
{
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
+ }
789
795
}
790
796
self . next_lookahead_output_frameno += 1 ;
791
797
}
0 commit comments