summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2018-06-07 16:35:44 -0700
committerMarco Paniconi <marpan@google.com>2018-06-11 08:57:20 -0700
commit7d97790438b796620a48dd2cfa6f2c6fe1f16871 (patch)
treef8294e06ec62bb562beec33db5f85db321ecd6a7 /vp9
parent3ac2b57015000dde5731ceb9fc824e86747c5945 (diff)
downloadlibvpx-7d97790438b796620a48dd2cfa6f2c6fe1f16871.tar
libvpx-7d97790438b796620a48dd2cfa6f2c6fe1f16871.tar.gz
libvpx-7d97790438b796620a48dd2cfa6f2c6fe1f16871.tar.bz2
libvpx-7d97790438b796620a48dd2cfa6f2c6fe1f16871.zip
vp9-svc: Fix to frames_since_golden update for SVC.
When the second (gf) temporal reference is used in SVC: the reference is refreshed on base TL superframes, and so the rc->frames_since_golden counter was also only updated on base TL frames. But this was disabling the golden reference from being used as a temporal reference for TL > 0 frames (since frames_since_golden was 0/not updated on TL > 0 frames). Fix is to copy the update of rc->frames_since_golden to all upper temporal layers. This allows TL > 0 frames to test the golden inter mode. Gain on RTC set: ~2%, ~8% on desktop_vga clip. Encode time increase ~5-8% on linux, 3SL-3TL run with 1 thread. For now keep this off for TL > 0 frames in speed features, so this change does not change current behavior for speed >= 7. Change-Id: I405708f3f80039ae47bd64ec53e66f92160acd9e
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_ratectrl.c10
-rw-r--r--vp9/encoder/vp9_speed_features.c6
2 files changed, 16 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 452e4d3cd..39dc329e9 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1601,12 +1601,22 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
// update the golden frame counter, only for base temporal layer.
if (cpi->use_svc && cpi->svc.use_gf_temporal_ref_current_layer &&
cpi->svc.temporal_layer_id == 0) {
+ int i = 0;
+ SVC *const svc = &cpi->svc;
if (cpi->refresh_golden_frame)
rc->frames_since_golden = 0;
else
rc->frames_since_golden++;
// Decrement count down till next gf
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
+ // Update the frames_since_golden for all upper temporal layers.
+ for (i = 1; i < svc->number_temporal_layers; ++i) {
+ const int layer = LAYER_IDS_TO_IDX(svc->spatial_layer_id, i,
+ svc->number_temporal_layers);
+ LAYER_CONTEXT *const lc = &svc->layer_context[layer];
+ RATE_CONTROL *const lrc = &lc->rc;
+ lrc->frames_since_golden = rc->frames_since_golden;
+ }
}
if (cm->frame_type == KEY_FRAME) rc->frames_since_key = 0;
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index f7e97cebc..09d45b769 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -629,6 +629,12 @@ static void set_rt_speed_feature_framesize_independent(
cpi->svc.number_spatial_layers == 3 && cpi->svc.temporal_layer_id > 0 &&
cpi->oxcf.width * cpi->oxcf.height > 640 * 480)
sf->svc_use_lowres_part = 1;
+ // For SVC when golden is used as second temporal reference: to avoid
+ // encode time increase only use this feature on base temporal layer.
+ // (i.e remove golden flag from frame_flags for temporal_layer_id > 0).
+ if (cpi->use_svc && cpi->svc.use_gf_temporal_ref_current_layer &&
+ cpi->svc.temporal_layer_id > 0)
+ cpi->ref_frame_flags &= (~VP9_GOLD_FLAG);
}
if (speed >= 8) {