diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 9db150fb800701b963d0fc88103633c667cec419..0a5033f097240c21a9645e506c65de746e2a5838 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -97,7 +97,7 @@ void vp9_init_quantizer(VP9_COMP *cpi);
 static const double in_frame_q_adj_ratio[MAX_SEGMENTS] =
   {1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
 
-static INLINE void Scale2Ratio(int mode, int *hr, int *hs) {
+static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) {
   switch (mode) {
     case NORMAL:
       *hr = 1;
@@ -1410,6 +1410,10 @@ void vp9_change_config(struct VP9_COMP *cpi, VP9_CONFIG *oxcf) {
       cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
       break;
 
+    case MODE_BESTQUALITY:
+      cpi->pass = 0;
+      break;
+
     case MODE_FIRSTPASS:
       cpi->pass = 1;
       break;
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 10583bcbce0154438bcd310920320f50ddad62d9..8c6b48cd7e5e4be426cc62da25f6f8b99a7a0323 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -442,8 +442,6 @@ typedef struct {
   int avg_frame_size;
 } LAYER_CONTEXT;
 
-#define MAX_SEGMENTS 8
-
 typedef enum {
   NORMAL      = 0,
   FOURFIVE    = 1,
@@ -522,7 +520,7 @@ typedef struct {
   //     were generated in the first encoding pass to create the compressed
   //     output using the highest possible quality, and taking a
   //    longer amount of time to encode.. ( speed setting ignored )
-  int mode;
+  MODE mode;
 
   // Key Framing Operations
   int auto_key;  // autodetect cut scenes and set the keyframes
@@ -533,7 +531,7 @@ typedef struct {
   // ----------------------------------------------------------------
   // DATARATE CONTROL OPTIONS
 
-  int end_usage;  // vbr or cbr
+  END_USAGE end_usage;  // vbr or cbr
 
   // buffer targeting aggressiveness
   int under_shoot_pct;
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 895fa16293d5f81183e53b3c708c55fd10c7a341..220fed9bd6efad165d99eee3193dd3bb6a6dd0d6 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -577,33 +577,27 @@ static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) {
 }
 
 static void pick_quickcompress_mode(vpx_codec_alg_priv_t  *ctx,
-                                    unsigned long          duration,
-                                    unsigned long          deadline) {
-  unsigned int new_qc;
-
-  /* Use best quality mode if no deadline is given. */
-  new_qc = MODE_BESTQUALITY;
+                                    unsigned long duration,
+                                    unsigned long deadline) {
+  // Use best quality mode if no deadline is given.
+  MODE new_qc = MODE_BESTQUALITY;
 
   if (deadline) {
-      uint64_t     duration_us;
-
-      /* Convert duration parameter from stream timebase to microseconds */
-      duration_us = (uint64_t)duration * 1000000
-                    * (uint64_t)ctx->cfg.g_timebase.num
-                    / (uint64_t)ctx->cfg.g_timebase.den;
-
-      /* If the deadline is more that the duration this frame is to be shown,
-       * use good quality mode. Otherwise use realtime mode.
-       */
-      new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
+    // Convert duration parameter from stream timebase to microseconds
+    const uint64_t duration_us = (uint64_t)duration * 1000000 *
+                               (uint64_t)ctx->cfg.g_timebase.num /
+                               (uint64_t)ctx->cfg.g_timebase.den;
+
+    // If the deadline is more that the duration this frame is to be shown,
+    // use good quality mode. Otherwise use realtime mode.
+    new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
   }
 
   if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
     new_qc = MODE_FIRSTPASS;
   else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
-    new_qc = (new_qc == MODE_BESTQUALITY)
-             ? MODE_SECONDPASS_BEST
-             : MODE_SECONDPASS;
+    new_qc = (new_qc == MODE_BESTQUALITY) ? MODE_SECONDPASS_BEST
+                                          : MODE_SECONDPASS;
 
   if (ctx->oxcf.mode != new_qc) {
     ctx->oxcf.mode = new_qc;