diff --git a/vp8/common/default_coef_probs.h b/vp8/common/default_coef_probs.h
index 3bd46f1fd51b6dbad2504c2a4e622f0bf8c4e24c..b954b1f3980e2c0d36476623b70d077bf08f32d0 100755
--- a/vp8/common/default_coef_probs.h
+++ b/vp8/common/default_coef_probs.h
@@ -346,7 +346,164 @@ static const vp8_prob default_coef_probs [BLOCK_TYPES]
         }
     }
 };
-
+#if CONFIG_EXPANDED_COEF_CONTEXT
+static const vp8_prob
+vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
+                          [COEF_BANDS]
+                          [PREV_COEF_CONTEXTS]
+                          [ENTROPY_NODES] =
+{
+  { /* block Type 0 */
+    { /* Coeff Band 0 */
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 1 */
+      { 60, 140, 195, 255, 212, 214, 128, 128, 128, 128, 128},
+      { 75, 221, 231, 255, 203, 255, 128, 128, 128, 128, 128},
+      { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128},
+      { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128}
+    },
+    { /* Coeff Band 2 */
+      { 1, 227, 226, 255, 215, 215, 128, 128, 128, 128, 128},
+      { 5, 163, 209, 255, 212, 212, 255, 255, 128, 128, 128},
+      { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128},
+      { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128}
+    },
+    { /* Coeff Band 3 */
+      { 1, 226, 225, 255, 228, 236, 128, 128, 128, 128, 128},
+      { 6, 163, 208, 255, 224, 234, 255, 255, 128, 128, 128},
+      { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128},
+      { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128}
+    },
+    { /* Coeff Band 4 */
+      { 1, 222, 197, 254, 193, 216, 255, 236, 128, 128, 128},
+      { 7, 140, 163, 251, 195, 211, 255, 238, 128, 128, 128},
+      { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128},
+      { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128}
+    },
+    { /* Coeff Band 5 */
+      { 1, 226, 218, 255, 216, 241, 255, 255, 128, 128, 128},
+      { 6, 154, 191, 255, 218, 240, 255, 255, 128, 128, 128},
+      { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+      { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+    },
+    { /* Coeff Band 6 */
+      { 1, 221, 217, 255, 208, 217, 255, 232, 128, 128, 128},
+      { 11, 155, 189, 254, 203, 211, 255, 249, 128, 128, 128},
+      { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+      { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+    },
+    { /* Coeff Band 7 */
+      { 1, 207, 235, 255, 232, 240, 128, 128, 128, 128, 128},
+      { 58, 161, 216, 255, 229, 235, 255, 255, 128, 128, 128},
+      { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128},
+      { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128}
+    }
+  },
+  { /* block Type 1 */
+    { /* Coeff Band 0 */
+      { 134, 152, 233, 224, 234, 52, 255, 166, 128, 128, 128},
+      { 97, 132, 185, 234, 186, 189, 197, 171, 255, 212, 128},
+      { 84, 110, 185, 237, 182, 182, 145, 145, 255, 255, 128}
+    },
+    { /* Coeff Band 1 */
+      { 1, 124, 213, 247, 192, 212, 255, 255, 128, 128, 128},
+      { 88, 111, 178, 254, 189, 211, 255, 255, 128, 128, 128},
+      { 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 128},
+      { 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 128}
+    },
+    { /* Coeff Band 2 */
+      { 1, 102, 225, 255, 210, 240, 128, 128, 128, 128, 128},
+      { 110, 78, 195, 254, 200, 191, 255, 255, 128, 128, 128},
+      { 37, 63, 177, 255, 194, 195, 128, 128, 128, 128, 128},
+      { 37, 63, 177, 255, 194, 195, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 3 */
+      { 1, 1, 229, 255, 202, 224, 128, 128, 128, 128, 128},
+      { 150, 1, 192, 255, 206, 226, 128, 128, 128, 128, 128},
+      { 75, 1, 138, 255, 172, 228, 128, 128, 128, 128, 128},
+      { 75, 1, 138, 255, 172, 228, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 4 */
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 5 */
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 6 */
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+    },
+    { /* Coeff Band 7 */
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+      { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+    }
+  },
+  { /* block Type 2 */
+    { /* Coeff Band 0 */
+      { 11, 181, 226, 199, 183, 255, 255, 255, 128, 128, 128},
+      { 2, 147, 185, 248, 163, 180, 255, 236, 128, 128, 128},
+      { 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 128},
+      { 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 128}
+    },
+    { /* Coeff Band 1 */
+      { 1, 150, 191, 246, 174, 188, 255, 235, 128, 128, 128},
+      { 1, 125, 166, 245, 165, 185, 255, 234, 128, 128, 128},
+      { 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 128},
+      { 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 128}
+    },
+    { /* Coeff Band 2 */
+      { 1, 146, 184, 242, 167, 183, 255, 230, 255, 255, 128},
+      { 1, 119, 160, 239, 156, 178, 255, 231, 255, 255, 128},
+      { 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 128},
+      { 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 128}
+    },
+    { /* Coeff Band 3 */
+      { 1, 150, 188, 244, 169, 183, 255, 233, 255, 255, 128},
+      { 1, 123, 162, 243, 161, 180, 255, 233, 128, 128, 128},
+      { 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 128},
+      { 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 128}
+    },
+    { /* Coeff Band 4 */
+      { 1, 163, 202, 252, 188, 204, 255, 248, 128, 128, 128},
+      { 1, 136, 180, 251, 181, 201, 255, 246, 128, 128, 128},
+      { 1, 92, 146, 249, 170, 197, 255, 245, 128, 128, 128},
+      { 1, 92, 146, 249, 170, 197, 255, 245, 128, 128, 128}
+    },
+    { /* Coeff Band 5 */
+      { 1, 156, 195, 249, 179, 193, 255, 241, 255, 255, 128},
+      { 1, 128, 169, 248, 171, 192, 255, 242, 255, 255, 128},
+      { 1, 84, 132, 245, 158, 187, 255, 240, 255, 255, 128},
+      { 1, 84, 132, 245, 158, 187, 255, 240, 255, 255, 128}
+    },
+    { /* Coeff Band 6 */
+      { 1, 36, 71, 251, 192, 201, 255, 243, 255, 255, 128},
+      { 1, 49, 185, 250, 184, 199, 255, 242, 128, 128, 128},
+      { 1, 95, 147, 247, 168, 190, 255, 239, 255, 255, 128},
+      { 1, 95, 147, 247, 168, 190, 255, 239, 255, 255, 128}
+    },
+    { /* Coeff Band 7 */
+      { 1, 19, 98, 255, 218, 222, 255, 255, 128, 128, 128},
+      { 36, 50, 210, 255, 212, 221, 255, 255, 128, 128, 128},
+      { 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128},
+      { 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128}
+    }
+  }
+};
+#else
 static const vp8_prob
 vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
                           [COEF_BANDS]
@@ -480,3 +637,4 @@ vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
     }
   }
 };
+#endif
\ No newline at end of file
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index cf22dd45c71712b356a423891e5548170b9b30ad..4b1f9a7948a19faf5bb093f07744fb4746d18c12 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -2051,13 +2051,14 @@ static void update_coef_probs(VP8_COMP *cpi)
                         vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
                         const vp8_prob oldp = *Pold;
                         const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
+                        int s,u;
 #if CONFIG_EXPANDED_COEF_CONTEXT
                         if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
                             continue;
 #endif
 #if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
-                        const int s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
-                        const int u = s > 0 && newp != oldp ? 1 : 0;
+                        s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
+                        u = s > 0 && newp != oldp ? 1 : 0;
                         if (u)
                             savings += s - (int)(vp8_cost_zero(upd));
                         else
diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
index e1698ede3a2fe8025857400b7ecc5c8a84fa2df5..23f6b91b25b7bf4a41d1c83b7acd6d1d3bc856f5 100644
--- a/vp8/encoder/boolhuff.c
+++ b/vp8/encoder/boolhuff.c
@@ -92,8 +92,9 @@ static int get_unsigned_bits(unsigned num_values)
 void vp8_encode_uniform(BOOL_CODER *br, int v, int n)
 {
     int l = get_unsigned_bits(n);
+    int m;
     if (l == 0) return;
-    int m = (1<<l)-n;
+    m = (1<<l)-n;
     if (v<m)
         vp8_encode_value(br, v, l-1);
     else
@@ -106,8 +107,9 @@ void vp8_encode_uniform(BOOL_CODER *br, int v, int n)
 int vp8_count_uniform(int v, int n)
 {
     int l = get_unsigned_bits(n);
+    int m;
     if (l == 0) return 0;
-    int m = (1<<l)-n;
+    m = (1<<l)-n;
     if (v<m)
         return l-1;
     else