]> granicus.if.org Git - libvpx/commitdiff
ARF in 1 pass vbr: modify skip ref_frame in nonrd_pickmode.
authorMarco <marpan@google.com>
Mon, 2 Oct 2017 21:00:18 +0000 (14:00 -0700)
committerMarco <marpan@google.com>
Tue, 3 Oct 2017 02:04:03 +0000 (19:04 -0700)
Speedup of ~2-3% on 1080p clips speed 6.
Neutral/negligible loss in metrics on ytlive.

Change-Id: I7ac47a4d8b58c566920bae29a94a0e8d59c36dee

vp9/encoder/vp9_pickmode.c
vp9/encoder/vp9_ratectrl.c
vp9/encoder/vp9_ratectrl.h

index 21fe7027214ca1f02623353c2cd5c5aad35cc8b9..4528910f75d61b213f7ebf7523425c39df97442c 100644 (file)
@@ -1567,7 +1567,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
   }
 #endif
 
-  if (cpi->rc.frames_since_golden == 0 && !cpi->use_svc) {
+  if (cpi->rc.frames_since_golden == 0 && !cpi->use_svc &&
+      !cpi->rc.alt_ref_gf_group && !cpi->rc.last_frame_is_src_altref) {
     usable_ref_frame = LAST_FRAME;
   } else {
     usable_ref_frame = GOLDEN_FRAME;
@@ -1581,6 +1582,15 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
       skip_ref_find_pred[LAST_FRAME] = 1;
       skip_ref_find_pred[GOLDEN_FRAME] = 1;
     }
+    if (cm->show_frame == 0) {
+      usable_ref_frame = GOLDEN_FRAME;
+      skip_ref_find_pred[ALTREF_FRAME] = 1;
+      if (cpi->rc.frames_since_key == 1) {
+        usable_ref_frame = LAST_FRAME;
+        skip_ref_find_pred[GOLDEN_FRAME] = 1;
+        skip_ref_find_pred[ALTREF_FRAME] = 1;
+      }
+    }
   }
 
   // For svc mode, on spatial_layer_id > 0: if the reference has different scale
index 5a52131784240cffc887abd5a7033d899ebbc790..716eb1bc87616aeabe7f9ab2a3a681ecc5eb80d2 100644 (file)
@@ -353,6 +353,7 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) {
   rc->reset_high_source_sad = 0;
   rc->high_source_sad_lagindex = -1;
   rc->alt_ref_gf_group = 0;
+  rc->last_frame_is_src_altref = 0;
   rc->fac_active_worst_inter = 150;
   rc->fac_active_worst_gf = 100;
   rc->force_qpmin = 0;
@@ -1480,6 +1481,7 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
       compute_frame_low_motion(cpi);
       if (cpi->sf.use_altref_onepass) update_altref_usage(cpi);
     }
+    cpi->rc.last_frame_is_src_altref = cpi->rc.is_src_frame_alt_ref;
   }
   if (cm->frame_type != KEY_FRAME) rc->reset_high_source_sad = 0;
 }
index 17a852921f754a3b43dbecb1258a4bb3646c8b6a..bdae755429f5058b8bc9e23266f010b3865e1a5f 100644 (file)
@@ -164,6 +164,7 @@ typedef struct {
   uint64_t prev_avg_source_sad_lag;
   int high_source_sad_lagindex;
   int alt_ref_gf_group;
+  int last_frame_is_src_altref;
   int high_source_sad;
   int count_last_scene_change;
   int avg_frame_low_motion;