ref: 1081ca3774fc813db386598e1bde90d9aaad68d7
parent: c88ec17eb2b7c21395c5c3e136d677f11a3fd215
author: Marco Paniconi <[email protected]>
date: Mon Dec 3 09:21:04 EST 2018
vp9-svc: Fix to postencode drop for layers. Postencode drop is only checked on base spatial layers, and if set, whole superframe is dropped and and next superframe is encoded at max-q. Fix here is to make sure all layers are encoded at max-q on a postencode dropped frame. Change-Id: I2313d83ee29a382465bcec1085d8c73c37ce26d6
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -570,10 +570,25 @@
cpi->last_frame_dropped = 1;
cpi->ext_refresh_frame_flags_pending = 0;
if (cpi->use_svc) {
- cpi->svc.last_layer_dropped[cpi->svc.spatial_layer_id] = 1;
- cpi->svc.drop_spatial_layer[cpi->svc.spatial_layer_id] = 1;
- cpi->svc.drop_count[cpi->svc.spatial_layer_id]++;
- cpi->svc.skip_enhancement_layer = 1;
+ SVC *svc = &cpi->svc;
+ int sl = 0;
+ int tl = 0;
+ svc->last_layer_dropped[svc->spatial_layer_id] = 1;
+ svc->drop_spatial_layer[svc->spatial_layer_id] = 1;
+ svc->drop_count[svc->spatial_layer_id]++;
+ svc->skip_enhancement_layer = 1;
+ // Postencode drop is only checked on base spatial layer,
+ // for now if max-q is set on base we force it on all layers.
+ for (sl = 0; sl < svc->number_spatial_layers; ++sl) {
+ for (tl = 0; tl < svc->number_temporal_layers; ++tl) {
+ const int layer =
+ LAYER_IDS_TO_IDX(sl, tl, svc->number_temporal_layers);
+ LAYER_CONTEXT *lc = &svc->layer_context[layer];
+ RATE_CONTROL *lrc = &lc->rc;
+ lrc->force_max_q = 1;
+ lrc->avg_frame_qindex[INTER_FRAME] = cpi->rc.worst_quality;
+ }
+ }
}
return 1;
}