Merge "Fix VS build warnings in blend_a64_mask_test.cc" into nextgenv2
diff --git a/vp10/common/dering.c b/vp10/common/dering.c
index 6d61101..47f07f7 100644
--- a/vp10/common/dering.c
+++ b/vp10/common/dering.c
@@ -32,8 +32,8 @@
   int skip = 1;
   maxc = cm->mi_cols - mi_col;
   maxr = cm->mi_rows - mi_row;
-  if (maxr > MI_BLOCK_SIZE) maxr = MI_BLOCK_SIZE;
-  if (maxc > MI_BLOCK_SIZE) maxc = MI_BLOCK_SIZE;
+  if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
+  if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
   for (r = 0; r < maxr; r++) {
     for (c = 0; c < maxc; c++) {
       skip = skip &&
@@ -57,8 +57,8 @@
   int dec[3];
   int pli;
   int coeff_shift = VPXMAX(cm->bit_depth - 8, 0);
-  nvsb = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
-  nhsb = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
+  nvsb = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
+  nhsb = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
   bskip = vpx_malloc(sizeof(*bskip) * cm->mi_rows * cm->mi_cols);
   vp10_setup_dst_planes(xd->plane, frame, 0, 0);
   for (pli = 0; pli < 3; pli++) {
@@ -95,16 +95,16 @@
     for (sbc = 0; sbc < nhsb; sbc++) {
       int level;
       int nhb, nvb;
-      nhb = VPXMIN(MI_BLOCK_SIZE, cm->mi_cols - MI_BLOCK_SIZE * sbc);
-      nvb = VPXMIN(MI_BLOCK_SIZE, cm->mi_rows - MI_BLOCK_SIZE * sbr);
+      nhb = VPXMIN(MAX_MIB_SIZE, cm->mi_cols - MAX_MIB_SIZE * sbc);
+      nvb = VPXMIN(MAX_MIB_SIZE, cm->mi_rows - MAX_MIB_SIZE * sbr);
       for (pli = 0; pli < 3; pli++) {
-        int16_t dst[MI_BLOCK_SIZE * MI_BLOCK_SIZE * 8 * 8];
+        int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8];
         int threshold;
 #if DERING_REFINEMENT
         level = compute_level_from_index(
             global_level,
-            cm->mi_grid_visible[MI_BLOCK_SIZE * sbr * cm->mi_stride +
-                                MI_BLOCK_SIZE * sbc]
+            cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
+                                MAX_MIB_SIZE * sbc]
                 ->mbmi.dering_gain);
 #else
           level = global_level;
@@ -112,32 +112,30 @@
         /* FIXME: This is a temporary hack that uses more conservative
            deringing for chroma. */
         if (pli) level = (level * 5 + 4) >> 3;
-        if (sb_all_skip(cm, sbr * MI_BLOCK_SIZE, sbc * MI_BLOCK_SIZE))
-          level = 0;
+        if (sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE)) level = 0;
         threshold = level << coeff_shift;
-        od_dering(
-            &OD_DERING_VTBL_C, dst, MI_BLOCK_SIZE * bsize[pli],
-            &src[pli][sbr * stride * bsize[pli] * MI_BLOCK_SIZE +
-                      sbc * bsize[pli] * MI_BLOCK_SIZE],
-            stride, nhb, nvb, sbc, sbr, nhsb, nvsb, dec[pli], dir, pli,
-            &bskip[MI_BLOCK_SIZE * sbr * cm->mi_cols + MI_BLOCK_SIZE * sbc],
-            cm->mi_cols, threshold, OD_DERING_NO_CHECK_OVERLAP, coeff_shift);
+        od_dering(&OD_DERING_VTBL_C, dst, MAX_MIB_SIZE * bsize[pli],
+                  &src[pli][sbr * stride * bsize[pli] * MAX_MIB_SIZE +
+                            sbc * bsize[pli] * MAX_MIB_SIZE],
+                  stride, nhb, nvb, sbc, sbr, nhsb, nvsb, dec[pli], dir, pli,
+                  &bskip[MAX_MIB_SIZE * sbr * cm->mi_cols + MAX_MIB_SIZE * sbc],
+                  cm->mi_cols, threshold, OD_DERING_NO_CHECK_OVERLAP,
+                  coeff_shift);
         for (r = 0; r < bsize[pli] * nvb; ++r) {
           for (c = 0; c < bsize[pli] * nhb; ++c) {
 #if CONFIG_VP9_HIGHBITDEPTH
             if (cm->use_highbitdepth) {
               CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf)
               [xd->plane[pli].dst.stride *
-                   (bsize[pli] * MI_BLOCK_SIZE * sbr + r) +
-               sbc * bsize[pli] * MI_BLOCK_SIZE + c] =
-                  dst[r * MI_BLOCK_SIZE * bsize[pli] + c];
+                   (bsize[pli] * MAX_MIB_SIZE * sbr + r) +
+               sbc * bsize[pli] * MAX_MIB_SIZE + c] =
+                  dst[r * MAX_MIB_SIZE * bsize[pli] + c];
             } else {
 #endif
-              xd->plane[pli]
-                  .dst.buf[xd->plane[pli].dst.stride *
-                               (bsize[pli] * MI_BLOCK_SIZE * sbr + r) +
-                           sbc * bsize[pli] * MI_BLOCK_SIZE + c] =
-                  dst[r * MI_BLOCK_SIZE * bsize[pli] + c];
+              xd->plane[pli].dst.buf[xd->plane[pli].dst.stride *
+                                         (bsize[pli] * MAX_MIB_SIZE * sbr + r) +
+                                     sbc * bsize[pli] * MAX_MIB_SIZE + c] =
+                  dst[r * MAX_MIB_SIZE * bsize[pli] + c];
 #if CONFIG_VP9_HIGHBITDEPTH
             }
 #endif
diff --git a/vp10/encoder/context_tree.c b/vp10/encoder/context_tree.c
index 0c356e1..394aeab 100644
--- a/vp10/encoder/context_tree.c
+++ b/vp10/encoder/context_tree.c
@@ -44,10 +44,6 @@
                       vpx_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i][k])));
       CHECK_MEM_ERROR(cm, ctx->eobs[i][k],
                       vpx_memalign(32, num_blk * sizeof(*ctx->eobs[i][k])));
-      ctx->coeff_pbuf[i][k] = ctx->coeff[i][k];
-      ctx->qcoeff_pbuf[i][k] = ctx->qcoeff[i][k];
-      ctx->dqcoeff_pbuf[i][k] = ctx->dqcoeff[i][k];
-      ctx->eobs_pbuf[i][k] = ctx->eobs[i][k];
     }
   }
 
diff --git a/vp10/encoder/context_tree.h b/vp10/encoder/context_tree.h
index 4967a00..8721008 100644
--- a/vp10/encoder/context_tree.h
+++ b/vp10/encoder/context_tree.h
@@ -30,17 +30,13 @@
 #if CONFIG_VAR_TX
   uint8_t *blk_skip[MAX_MB_PLANE];
 #endif
+
+  // dual buffer pointers, 0: in use, 1: best in store
   tran_low_t *coeff[MAX_MB_PLANE][3];
   tran_low_t *qcoeff[MAX_MB_PLANE][3];
   tran_low_t *dqcoeff[MAX_MB_PLANE][3];
   uint16_t *eobs[MAX_MB_PLANE][3];
 
-  // dual buffer pointers, 0: in use, 1: best in store
-  tran_low_t *coeff_pbuf[MAX_MB_PLANE][3];
-  tran_low_t *qcoeff_pbuf[MAX_MB_PLANE][3];
-  tran_low_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
-  uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
-
   int is_coded;
   int num_4x4_blk;
   int skip;
diff --git a/vp10/encoder/encodeframe.c b/vp10/encoder/encodeframe.c
index ff8084b..cf3b002 100644
--- a/vp10/encoder/encodeframe.c
+++ b/vp10/encoder/encodeframe.c
@@ -1098,17 +1098,17 @@
 
   max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1;
   for (i = 0; i < max_plane; ++i) {
-    p[i].coeff = ctx->coeff_pbuf[i][1];
-    p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
-    pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
-    p[i].eobs = ctx->eobs_pbuf[i][1];
+    p[i].coeff = ctx->coeff[i][1];
+    p[i].qcoeff = ctx->qcoeff[i][1];
+    pd[i].dqcoeff = ctx->dqcoeff[i][1];
+    p[i].eobs = ctx->eobs[i][1];
   }
 
   for (i = max_plane; i < MAX_MB_PLANE; ++i) {
-    p[i].coeff = ctx->coeff_pbuf[i][2];
-    p[i].qcoeff = ctx->qcoeff_pbuf[i][2];
-    pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
-    p[i].eobs = ctx->eobs_pbuf[i][2];
+    p[i].coeff = ctx->coeff[i][2];
+    p[i].qcoeff = ctx->qcoeff[i][2];
+    pd[i].dqcoeff = ctx->dqcoeff[i][2];
+    p[i].eobs = ctx->eobs[i][2];
   }
 
   for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
@@ -1475,10 +1475,10 @@
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     if (pmc != NULL) {
-      p[i].coeff = pmc->coeff_pbuf[i][1];
-      p[i].qcoeff = pmc->qcoeff_pbuf[i][1];
-      pd[i].dqcoeff = pmc->dqcoeff_pbuf[i][1];
-      p[i].eobs = pmc->eobs_pbuf[i][1];
+      p[i].coeff = pmc->coeff[i][1];
+      p[i].qcoeff = pmc->qcoeff[i][1];
+      pd[i].dqcoeff = pmc->dqcoeff[i][1];
+      p[i].eobs = pmc->eobs[i][1];
     } else {
       // These should never be used
       p[i].coeff = NULL;
@@ -1642,10 +1642,10 @@
 #endif
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
-    p[i].coeff = ctx->coeff_pbuf[i][0];
-    p[i].qcoeff = ctx->qcoeff_pbuf[i][0];
-    pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0];
-    p[i].eobs = ctx->eobs_pbuf[i][0];
+    p[i].coeff = ctx->coeff[i][0];
+    p[i].qcoeff = ctx->qcoeff[i][0];
+    pd[i].dqcoeff = ctx->dqcoeff[i][0];
+    p[i].eobs = ctx->eobs[i][0];
   }
 
   for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
diff --git a/vp10/encoder/firstpass.c b/vp10/encoder/firstpass.c
index bd7e297..aac2b74 100644
--- a/vp10/encoder/firstpass.c
+++ b/vp10/encoder/firstpass.c
@@ -526,10 +526,10 @@
   vp10_frame_init_quantizer(cpi);
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
-    p[i].coeff = ctx->coeff_pbuf[i][1];
-    p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
-    pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
-    p[i].eobs = ctx->eobs_pbuf[i][1];
+    p[i].coeff = ctx->coeff[i][1];
+    p[i].qcoeff = ctx->qcoeff[i][1];
+    pd[i].dqcoeff = ctx->dqcoeff[i][1];
+    p[i].eobs = ctx->eobs[i][1];
   }
 
   vp10_init_mv_probs(cm);