]> granicus.if.org Git - libvpx/commitdiff
vp9-svc: Fix to postencode drop for layers.
authorMarco Paniconi <marpan@google.com>
Mon, 3 Dec 2018 22:21:04 +0000 (14:21 -0800)
committerMarco Paniconi <marpan@google.com>
Mon, 3 Dec 2018 22:25:06 +0000 (14:25 -0800)
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

vp9/encoder/vp9_ratectrl.c

index ac8fda496767636ebce2df001ca85af6640e63e0..a2923c271b935d9d272a1c7e3e022844432a4e9b 100644 (file)
@@ -570,10 +570,25 @@ int post_encode_drop_cbr(VP9_COMP *cpi, size_t *size) {
     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;
   }