]> granicus.if.org Git - libvpx/commitdiff
svc: Force the quantizer to be same as that in encoder config.
authorJerome Jiang <jianj@google.com>
Thu, 16 Aug 2018 00:15:45 +0000 (17:15 -0700)
committerJerome Jiang <jianj@google.com>
Thu, 16 Aug 2018 00:56:28 +0000 (17:56 -0700)
Change-Id: I0377ca2ebf63792d7a27de4b8e7e08b38659ecde

vp9/encoder/vp9_svc_layercontext.c
vpx/src/svc_encodeframe.c

index 3fa25ae14b60169a258f691303d4a1bd6cb5eaa4..58eef9134e500d772355f326f03e1c124dbfe6fb 100644 (file)
@@ -108,6 +108,8 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
       lrc->ni_frames = 0;
       lrc->decimation_count = 0;
       lrc->decimation_factor = 0;
+      lrc->worst_quality = oxcf->worst_allowed_q;
+      lrc->best_quality = oxcf->best_allowed_q;
 
       for (i = 0; i < RATE_FACTOR_LEVELS; ++i) {
         lrc->rate_correction_factors[i] = 1.0;
@@ -816,7 +818,8 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
 
   // Setting the worst/best_quality via the encoder control: SET_SVC_PARAMETERS,
   // only for non-BYPASS mode for now.
-  if (svc->temporal_layering_mode != VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
+  if (svc->temporal_layering_mode != VP9E_TEMPORAL_LAYERING_MODE_BYPASS ||
+      svc->use_set_ref_frame_config) {
     RATE_CONTROL *const lrc = &lc->rc;
     lrc->worst_quality = vp9_quantizer_to_qindex(lc->max_q);
     lrc->best_quality = vp9_quantizer_to_qindex(lc->min_q);
index 4e9f1a40ec6dad630171e5208e52cca93c048c72..2bd8a0991669d00bdb26bf8e9019df5dccc6f664 100644 (file)
@@ -497,6 +497,17 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
     enc_cfg->rc_buf_sz = 1000;
   }
 
+  for (tl = 0; tl < svc_ctx->temporal_layers; ++tl) {
+    for (sl = 0; sl < svc_ctx->spatial_layers; ++sl) {
+      i = sl * svc_ctx->temporal_layers + tl;
+      if (enc_cfg->rc_end_usage == VPX_CBR &&
+          enc_cfg->g_pass == VPX_RC_ONE_PASS) {
+        si->svc_params.max_quantizers[i] = enc_cfg->rc_max_quantizer;
+        si->svc_params.min_quantizers[i] = enc_cfg->rc_min_quantizer;
+      }
+    }
+  }
+
   if (enc_cfg->g_error_resilient == 0 && si->use_multiple_frame_contexts == 0)
     enc_cfg->g_error_resilient = 1;