]> granicus.if.org Git - libvpx/commitdiff
[spatial svc] No need to code full width and height for non key frame
authorMinghai Shang <minghai@google.com>
Thu, 1 May 2014 19:00:39 +0000 (12:00 -0700)
committerMinghai Shang <minghai@google.com>
Fri, 2 May 2014 18:29:05 +0000 (11:29 -0700)
Change-Id: I62ab0f4346b4157a90dc5b5f73ab5e597d69c1bd

vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_ratectrl.c

index c5a85c9df17bafb79dab054f5cf31b1e22077b4f..35d2ecf966f5e39155ce9e7e43d4a142087467d7 100644 (file)
@@ -1006,9 +1006,10 @@ static void write_frame_size_with_refs(VP9_COMP *cpi,
     found = cm->width == cfg->y_crop_width &&
             cm->height == cfg->y_crop_height;
 
-    // TODO(ivan): This prevents a bug while more than 3 buffers are used. Do it
-    // in a better way.
-    if (cpi->use_svc) {
+    // Set "found" to 0 for temporal svc and for spatial svc key frame
+    if (cpi->use_svc &&
+        (cpi->svc.number_spatial_layers == 1 ||
+         cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame)) {
       found = 0;
     }
     vp9_wb_write_bit(wb, found);
index b123bfdcbb42fac3dedf67b43329e0eedbc0cc79..8a22f81ed829fb937e1e7b7696dfdb0de2d39c2f 100644 (file)
@@ -1306,11 +1306,26 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
           cpi->oxcf.key_freq == 0))) {
     cm->frame_type = KEY_FRAME;
     rc->source_alt_ref_active = 0;
+
+    if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
+      cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1;
+    }
+
     if (cpi->pass == 0 && cpi->oxcf.rc_mode == RC_MODE_CBR) {
       target = calc_iframe_target_size_one_pass_cbr(cpi);
     }
   } else {
     cm->frame_type = INTER_FRAME;
+
+    if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
+      LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
+      if (cpi->svc.spatial_layer_id == 0) {
+        lc->is_key_frame = 0;
+      } else {
+        lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame;
+      }
+    }
+
     if (cpi->pass == 0 && cpi->oxcf.rc_mode == RC_MODE_CBR) {
       target = calc_pframe_target_size_one_pass_cbr(cpi);
     }