]> granicus.if.org Git - libvpx/commitdiff
Initialize avg_frame_qindex to worst_allowed for 1 pass.
authorMarco Paniconi <marpan@google.com>
Thu, 19 Dec 2013 22:26:46 +0000 (14:26 -0800)
committerMarco Paniconi <marpan@google.com>
Thu, 19 Dec 2013 22:55:49 +0000 (14:55 -0800)
Change-Id: I535bde16c8fc4c2cd263bbbbaed46ead4c776090

vp9/encoder/vp9_onyx_if.c

index 3f813a1f65120f7e0037e62ec17125d3b5ed3b28..1091b7d2d8cb02f11711f77febd69bc726e35a4c 100644 (file)
@@ -1094,12 +1094,18 @@ static void init_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
   // Initialize active best and worst q and average q values.
   cpi->rc.active_worst_quality      = cpi->oxcf.worst_allowed_q;
 
-  cpi->rc.avg_frame_qindex[0]       = (cpi->oxcf.worst_allowed_q +
-                                       cpi->oxcf.best_allowed_q) / 2;
-  cpi->rc.avg_frame_qindex[1]       = (cpi->oxcf.worst_allowed_q +
-                                       cpi->oxcf.best_allowed_q) / 2;
-  cpi->rc.avg_frame_qindex[2]       = (cpi->oxcf.worst_allowed_q +
-                                       cpi->oxcf.best_allowed_q) / 2;
+  if (cpi->pass == 0 && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
+    cpi->rc.avg_frame_qindex[0] = cpi->oxcf.worst_allowed_q;
+    cpi->rc.avg_frame_qindex[1] = cpi->oxcf.worst_allowed_q;
+    cpi->rc.avg_frame_qindex[2] = cpi->oxcf.worst_allowed_q;
+  } else {
+    cpi->rc.avg_frame_qindex[0] = (cpi->oxcf.worst_allowed_q +
+                                   cpi->oxcf.best_allowed_q) / 2;
+    cpi->rc.avg_frame_qindex[1] = (cpi->oxcf.worst_allowed_q +
+                                   cpi->oxcf.best_allowed_q) / 2;
+    cpi->rc.avg_frame_qindex[2] = (cpi->oxcf.worst_allowed_q +
+                                   cpi->oxcf.best_allowed_q) / 2;
+  }
   cpi->rc.last_q[0]                 = cpi->oxcf.best_allowed_q;
   cpi->rc.last_q[1]                 = cpi->oxcf.best_allowed_q;
   cpi->rc.last_q[2]                 = cpi->oxcf.best_allowed_q;