shithub: libvpx

Download patch

ref: 9c9300f56f4788ed5a9aade371c185b33dcb7781
parent: 82b865da9475586341949664d5468a93237867a8
author: Paul Wilkins <paulwilkins@google.com>
date: Fri Feb 3 10:10:44 EST 2012

Merged NEWNEAR experiment

This commit merges the NEWNEAR experiment such that it
is effectively always on.

The fact that there were changes in the threading code again
highlights the need to strip out such features during the
bitstream development phase as trying to maintain this code
(especially as it is not being tested) slows the development cycle.

Change-Id: I8b34950a1333231ced9928aa11cd6d6459984b65

--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -136,7 +136,7 @@
     oci->mi = oci->mip + oci->mode_info_stride + 1;
 
     /* allocate memory for last frame MODE_INFO array */
-#if CONFIG_ERROR_CONCEALMENT || CONFIG_NEWNEAR
+
     oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
 
     if (!oci->prev_mip)
@@ -146,10 +146,6 @@
     }
 
     oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
-#else
-    oci->prev_mip = NULL;
-    oci->prev_mi = NULL;
-#endif
 
     oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
 
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -253,9 +253,7 @@
 #endif /* CONFIG_DUALPRED */
     YV12_BUFFER_CONFIG dst;
 
-#if CONFIG_NEWNEAR
     MODE_INFO *prev_mode_info_context;
-#endif
     MODE_INFO *mode_info_context;
     int mode_info_stride;
 
--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -359,7 +359,6 @@
     vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
 }
 
-#if CONFIG_NEWNEAR
 void vp8_init_mode_contexts(VP8_COMMON *pc)
 {
     vpx_memset(pc->mv_ref_ct, 0, sizeof(pc->mv_ref_ct));
@@ -490,7 +489,4 @@
         printf("\n");
     }
 }
-
-
-#endif
 
--- a/vp8/common/findnearmv.c
+++ b/vp8/common/findnearmv.c
@@ -21,7 +21,6 @@
 /* Predict motion vectors using those from already-decoded nearby blocks.
    Note that we only consider one 4x4 subblock from each candidate 16x16
    macroblock.   */
-#if CONFIG_NEWNEAR
 void vp8_find_near_mvs
 (
     MACROBLOCKD *xd,
@@ -122,9 +121,7 @@
     cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
                         + (left->mbmi.mode == SPLITMV)) * 2
                         + (
-#if CONFIG_NEWNEAR
                         lf_here->mbmi.mode == SPLITMV ||
-#endif
                        aboveleft->mbmi.mode == SPLITMV);
 
     /* Swap near and nearest if necessary */
@@ -153,130 +150,6 @@
     vp8_clamp_mv2(nearby, xd);
     vp8_clamp_mv2(best_mv, xd);
 }
-
-
-#else
-void vp8_find_near_mvs
-(
-    MACROBLOCKD *xd,
-    const MODE_INFO *here,
-    int_mv *nearest,
-    int_mv *nearby,
-    int_mv *best_mv,
-    int cnt[4],
-    int refframe,
-    int *ref_frame_sign_bias
-)
-{
-    const MODE_INFO *above = here - xd->mode_info_stride;
-    const MODE_INFO *left = here - 1;
-    const MODE_INFO *aboveleft = above - 1;
-    int_mv            near_mvs[4];
-    int_mv           *mv = near_mvs;
-    int             *cntx = cnt;
-    enum {CNT_ZEROMV, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV};
-
-    /* Zero accumulators */
-    mv[0].as_int = mv[1].as_int = mv[2].as_int = 0;
-    cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
-
-    /* Process above */
-    if (above->mbmi.ref_frame != INTRA_FRAME)
-    {
-        if (above->mbmi.mv.as_int)
-        {
-            (++mv)->as_int = above->mbmi.mv.as_int;
-            mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame],
-                refframe, mv, ref_frame_sign_bias);
-            ++cntx;
-        }
-        *cntx += 2;
-    }
-
-    /* Process left */
-    if (left->mbmi.ref_frame != INTRA_FRAME)
-    {
-        if (left->mbmi.mv.as_int)
-        {
-            int_mv this_mv;
-
-            this_mv.as_int = left->mbmi.mv.as_int;
-            mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame],
-                refframe, &this_mv, ref_frame_sign_bias);
-
-            if (this_mv.as_int != mv->as_int)
-            {
-                (++mv)->as_int = this_mv.as_int;
-                ++cntx;
-            }
-
-            *cntx += 2;
-        }
-        else
-            cnt[CNT_ZEROMV] += 2;
-    }
-    /* Process above left */
-    if (aboveleft->mbmi.ref_frame != INTRA_FRAME)
-    {
-        if (aboveleft->mbmi.mv.as_int)
-        {
-            int_mv this_mv;
-
-            this_mv.as_int = aboveleft->mbmi.mv.as_int;
-            mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame],
-                refframe, &this_mv, ref_frame_sign_bias);
-
-            if (this_mv.as_int != mv->as_int)
-            {
-                (++mv)->as_int = this_mv.as_int;
-                ++cntx;
-            }
-
-            *cntx += 1;
-        }
-        else
-            cnt[CNT_ZEROMV] += 1;
-    }
-
-    /* If we have three distinct MV's ... */
-    if (cnt[CNT_SPLITMV])
-    {
-        /* See if above-left MV can be merged with NEAREST */
-        if (mv->as_int == near_mvs[CNT_NEAREST].as_int)
-            cnt[CNT_NEAREST] += 1;
-    }
-
-    cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
-                        + (left->mbmi.mode == SPLITMV)) * 2
-                       + (aboveleft->mbmi.mode == SPLITMV);
-
-    /* Swap near and nearest if necessary */
-    if (cnt[CNT_NEAR] > cnt[CNT_NEAREST])
-    {
-        int tmp;
-        tmp = cnt[CNT_NEAREST];
-        cnt[CNT_NEAREST] = cnt[CNT_NEAR];
-        cnt[CNT_NEAR] = tmp;
-        tmp = near_mvs[CNT_NEAREST].as_int;
-        near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
-        near_mvs[CNT_NEAR].as_int = tmp;
-    }
-
-    /* Use near_mvs[0] to store the "best" MV */
-    if (cnt[CNT_NEAREST] >= cnt[CNT_ZEROMV])
-        near_mvs[CNT_ZEROMV] = near_mvs[CNT_NEAREST];
-
-    /* Set up return values */
-    best_mv->as_int = near_mvs[0].as_int;
-    nearest->as_int = near_mvs[CNT_NEAREST].as_int;
-    nearby->as_int = near_mvs[CNT_NEAR].as_int;
-
-    //TODO: move clamp outside findnearmv
-    vp8_clamp_mv2(nearest, xd);
-    vp8_clamp_mv2(nearby, xd);
-    vp8_clamp_mv2(best_mv, xd);
-}
-#endif
 
 vp8_prob *vp8_mv_ref_probs(VP8_COMMON *pc,
     vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
--- a/vp8/common/findnearmv.h
+++ b/vp8/common/findnearmv.h
@@ -76,9 +76,7 @@
 (
     MACROBLOCKD *xd,
     const MODE_INFO *here,
-#if CONFIG_NEWNEAR
     const MODE_INFO *lfhere,
-#endif
     int_mv *nearest, int_mv *nearby, int_mv *best,
     int near_mv_ref_cts[4],
     int refframe,
--- a/vp8/common/modecont.c
+++ b/vp8/common/modecont.c
@@ -10,7 +10,6 @@
 
 
 #include "entropy.h"
-#if CONFIG_NEWNEAR
 const int default_vp8_mode_contexts[6][4] =
 {
     {   /* 0 */
@@ -41,32 +40,3 @@
     {   /* 5 */
         234,   94,   128,   28},
 };
-#else
-const int default_vp8_mode_contexts[6][4] =
-{
-    {
-        /* 0 */
-        7,     1,     1,   143,
-    },
-    {
-        /* 1 */
-        14,    18,    14,   107,
-    },
-    {
-        /* 2 */
-        135,    64,    57,    68,
-    },
-    {
-        /* 3 */
-        60,    56,   128,    65,
-    },
-    {
-        /* 4 */
-        159,   134,   128,    34,
-    },
-    {
-        /* 5 */
-        234,   188,   128,    28,
-    },
-};
-#endif
\ No newline at end of file
--- a/vp8/common/modecont.h
+++ b/vp8/common/modecont.h
@@ -13,7 +13,5 @@
 #define __INC_MODECONT_H
 
 extern const int default_vp8_mode_contexts[6][4];
-#if CONFIG_NEWNEAR
 extern const int default_vp8_mode_contexts_a[6][4];
-#endif
 #endif
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -249,13 +249,10 @@
     FRAME_CONTEXT lfc; /* last frame entropy */
     FRAME_CONTEXT fc;  /* this frame entropy */
 
-#if CONFIG_NEWNEAR
     int mv_ref_ct[6][4][2];
     int mode_context[6][4];
     int mv_ref_ct_a[6][4][2];
     int mode_context_a[6][4];
-#endif
-
     int vp8_mode_contexts[6][4];
 
     unsigned int current_video_frame;
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -618,10 +618,8 @@
 }
 
 static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
-#if CONFIG_NEWNEAR
                              MODE_INFO *prev_mi,
-#endif
-                            int mb_row, int mb_col)
+                             int mb_row, int mb_col)
 {
     VP8_COMMON *const cm = & pbi->common;
     vp8_reader *const bc = & pbi->bc;
@@ -697,9 +695,7 @@
         vp8_prob mv_ref_p [VP8_MVREFS-1];
 
         vp8_find_near_mvs(xd, mi,
-#if CONFIG_NEWNEAR
             prev_mi,
-#endif
             &nearest, &nearby, &best_mv, rct,
                           mbmi->ref_frame, pbi->common.ref_frame_sign_bias);
         vp8_mv_ref_probs(&pbi->common, mv_ref_p, rct);
@@ -715,9 +711,7 @@
         {
             mbmi->mode = read_mv_ref(bc, mv_ref_p);
 
-#if CONFIG_NEWNEAR
             vp8_accum_mv_refs(&pbi->common, mbmi->mode, rct);
-#endif
         }
 
         mbmi->uv_mode = DC_PRED;
@@ -857,9 +851,7 @@
             if (mbmi->second_ref_frame)
             {
                 vp8_find_near_mvs(xd, mi,
-#if CONFIG_NEWNEAR
                                   prev_mi,
-#endif
                                   &nearest, &nearby, &best_mv, rct,
                                   (int)mbmi->second_ref_frame,
                                   pbi->common.ref_frame_sign_bias);
@@ -985,9 +977,7 @@
     int row_delta[4] = {-1,  0, +1,  0};
     int col_delta[4] = {+1, +1, -1, +1};
 
-#if CONFIG_NEWNEAR
     MODE_INFO *prev_mi = cm->prev_mi;
-#endif
 
     mb_mode_mv_init(pbi);
 
@@ -1023,9 +1013,7 @@
 
                 if ((mb_row >= cm->mb_rows) || (mb_col >= cm->mb_cols))
                 {
-#if CONFIG_NEWNEAR
                     prev_mi += offset_extended;
-#endif
                     mi += offset_extended;       /* next macroblock */
                     continue;
                 }
@@ -1046,9 +1034,7 @@
                     vp8_kfread_modes(pbi, mi, mb_row, mb_col);
                 else
                     read_mb_modes_mv(pbi, mi, &mi->mbmi,
-#if CONFIG_NEWNEAR
                     prev_mi,
-#endif
                     mb_row, mb_col);
 
 #if CONFIG_ERROR_CONCEALMENT
@@ -1064,9 +1050,7 @@
                 }
 #endif
 
-#if CONFIG_NEWNEAR
                 prev_mi += offset_extended;
-#endif
                 mi += offset_extended;       /* next macroblock */
             }
         }
@@ -1079,9 +1063,7 @@
 {
     MODE_INFO *mi = pbi->common.mi;
 
-#if CONFIG_NEWNEAR
     MODE_INFO *prev_mi = pbi->common.prev_mi;
-#endif
 
     int mb_row = -1;
 
@@ -1130,9 +1112,7 @@
                 vp8_kfread_modes(pbi, mi, mb_row, mb_col);
             else
                 read_mb_modes_mv(pbi, mi, &mi->mbmi,
-#if CONFIG_NEWNEAR
                 prev_mi,
-#endif
                 mb_row, mb_col);
 
             //printf("%3d", mi->mbmi.mode);
@@ -1169,15 +1149,11 @@
             fprintf(statsfile, "%2d%2d%2d   ",
                 mi->mbmi.segment_id, mi->mbmi.ref_frame, mi->mbmi.mode );
 #endif
-#if CONFIG_NEWNEAR
             prev_mi++;
-#endif
             mi++;       /* next macroblock */
         }
        // printf("\n");
-#if CONFIG_NEWNEAR
         prev_mi++;
-#endif
         mi++;           /* skip left predictor each row */
     }
 
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -947,17 +947,10 @@
         vpx_memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
         vpx_memcpy(&pc->lfc_a, &pc->fc, sizeof(pc->fc));
 
-#if CONFIG_NEWNEAR
         vp8_init_mode_contexts(&pbi->common);
         vpx_memcpy( pbi->common.vp8_mode_contexts,
                     pbi->common.mode_context,
                     sizeof(pbi->common.mode_context));
-
-#else
-        vpx_memcpy( pbi->common.vp8_mode_contexts,
-                    default_vp8_mode_contexts,
-                    sizeof(default_vp8_mode_contexts));
-#endif /* CONFIG_NEWNEAR */
     }
     else
     {
@@ -1366,20 +1359,16 @@
         if(pc->refresh_alt_ref_frame)
         {
             vpx_memcpy(&pc->fc, &pc->lfc_a, sizeof(pc->fc));
-#if CONFIG_NEWNEAR
             vpx_memcpy( pc->vp8_mode_contexts,
                         pc->mode_context_a,
                         sizeof(pc->vp8_mode_contexts));
-#endif
         }
         else
         {
             vpx_memcpy(&pc->fc, &pc->lfc, sizeof(pc->fc));
-#if CONFIG_NEWNEAR
             vpx_memcpy( pc->vp8_mode_contexts,
                         pc->mode_context,
                         sizeof(pc->vp8_mode_contexts));
-#endif
         }
 
         /* Buffer to buffer copy flags. */
@@ -1493,13 +1482,10 @@
     pc->mb_no_coeff_skip = (int)vp8_read_bit(bc);
 
     vp8_decode_mode_mvs(pbi);
-#if CONFIG_NEWNEAR
     if(pbi->common.frame_type != KEY_FRAME)
     {
         vp8_update_mode_context(&pbi->common);
     }
-#endif
-
 
 #if CONFIG_ERROR_CONCEALMENT
     if (pbi->ec_active &&
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -624,7 +624,6 @@
     }
 #endif
 
-#if CONFIG_NEWNEAR
     if(cm->show_frame)
     {
         vpx_memcpy(cm->prev_mip, cm->mip,
@@ -635,7 +634,6 @@
         vpx_memset(cm->prev_mip, 0,
             (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
     }
-#endif
 
     /*vp8_print_modes_and_motion_vectors( cm->mi, cm->mb_rows,cm->mb_cols, cm->current_video_frame);*/
 
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1050,9 +1050,7 @@
     int pred_context;
 
     MODE_INFO *m = pc->mi;
-#if CONFIG_NEWNEAR
     MODE_INFO *prev_m = pc->prev_mi;
-#endif
 
     const int mis = pc->mode_info_stride;
     int mb_row, mb_col;
@@ -1186,9 +1184,7 @@
 
                 // Make sure the MacroBlockD mode info pointer is set correctly
                 xd->mode_info_context = m;
-#if CONFIG_NEWNEAR
                 xd->prev_mode_info_context = prev_m;
-#endif
 
 #ifdef ENTROPY_STATS
                 active_section = 9;
@@ -1280,9 +1276,7 @@
                         int ct[4];
 
                         vp8_find_near_mvs(xd, m,
-#if CONFIG_NEWNEAR
                                           prev_m,
-#endif
                                           &n1, &n2, &best_mv, ct, rf,
                                           cpi->common.ref_frame_sign_bias);
                         vp8_mv_ref_probs(&cpi->common, mv_ref_p, ct);
@@ -1301,9 +1295,7 @@
                     if ( !segfeature_active( xd, segment_id, SEG_LVL_MODE ) )
                     {
                         write_mv_ref(w, mode, mv_ref_p);
-#if CONFIG_NEWNEAR
                         vp8_accum_mv_refs(&cpi->common, mode, ct);
-#endif
                     }
 
 
@@ -1338,9 +1330,7 @@
                                 int_mv n1, n2;
                                 int ct[4];
                                 vp8_find_near_mvs(xd, m,
-#if CONFIG_NEWNEAR
                                                   prev_m,
-#endif
                                                   &n1, &n2, &best_mv,
                                                   ct, second_rf,
                                                   cpi->common.ref_frame_sign_bias);
@@ -1416,11 +1406,9 @@
                     }
                 }
 
-#if CONFIG_NEWNEAR
                 prev_m += offset_extended;
                 assert((prev_m-cpi->common.prev_mip)==(m-cpi->common.mip));
                 assert((prev_m-cpi->common.prev_mi)==(m-cpi->common.mi));
-#endif
 
                 // skip to next MB
                 mb_row += dy;
@@ -1461,9 +1449,7 @@
 
 
     MODE_INFO *m = pc->mi;
-#if CONFIG_NEWNEAR
     MODE_INFO *prev_m = pc->prev_mi;
-#endif
 
     const int mis = pc->mode_info_stride;
     int mb_row = -1;
@@ -1575,9 +1561,7 @@
             // Make sure the MacroBlockD mode info pointer is set correctly
             xd->mode_info_context = m;
 
-#if CONFIG_NEWNEAR
             xd->prev_mode_info_context = prev_m;
-#endif
 
 #ifdef ENTROPY_STATS
             active_section = 9;
@@ -1670,9 +1654,7 @@
                     int_mv n1, n2;
 
                     vp8_find_near_mvs(xd, m,
-#if CONFIG_NEWNEAR
                         prev_m,
-#endif
                         &n1, &n2, &best_mv, ct, rf, cpi->common.ref_frame_sign_bias);
                     vp8_mv_ref_probs(&cpi->common, mv_ref_p, ct);
 
@@ -1691,9 +1673,7 @@
                 if ( !segfeature_active( xd, segment_id, SEG_LVL_MODE ) )
                 {
                     write_mv_ref(w, mode, mv_ref_p);
-#if CONFIG_NEWNEAR
                     vp8_accum_mv_refs(&cpi->common, mode, ct);
-#endif
                 }
 
                 {
@@ -1725,9 +1705,7 @@
                             int_mv n1, n2;
                             int ct[4];
                             vp8_find_near_mvs(xd, m,
-#if CONFIG_NEWNEAR
                                               prev_m,
-#endif
                                               &n1, &n2, &best_mv,
                                               ct, second_rf,
                                               cpi->common.ref_frame_sign_bias);
@@ -1802,19 +1780,14 @@
             }
 
             ++m;
-#if CONFIG_NEWNEAR
             ++prev_m;
             assert((prev_m-cpi->common.prev_mip)==(m-cpi->common.mip));
             assert((prev_m-cpi->common.prev_mi)==(m-cpi->common.mi));
-#endif
-
             cpi->mb.partition_info++;
         }
 
         ++m;  /* skip L prediction border */
-#if CONFIG_NEWNEAR
         ++prev_m;
-#endif
         cpi->mb.partition_info++;
     }
 
@@ -3020,9 +2993,7 @@
     {
         pack_inter_mode_mvs(cpi);
 
-#if CONFIG_NEWNEAR
         vp8_update_mode_context(&cpi->common);
-#endif
 
 #ifdef ENTROPY_STATS
         active_section = 1;
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -624,12 +624,10 @@
                 x->partition_info     += offset_extended;
                 xd->mode_info_context += offset_extended;
 
-#if CONFIG_NEWNEAR
                 xd->prev_mode_info_context += offset_extended;
 
                 assert((xd->prev_mode_info_context - cpi->common.prev_mip)
                     ==(xd->mode_info_context - cpi->common.mip));
-#endif
                 continue;
             }
 
@@ -787,12 +785,10 @@
             x->partition_info     += offset_extended;
             xd->mode_info_context += offset_extended;
 
-#if CONFIG_NEWNEAR
             xd->prev_mode_info_context += offset_extended;
 
             assert((xd->prev_mode_info_context - cpi->common.prev_mip)
                 ==(xd->mode_info_context - cpi->common.mip));
-#endif
         }
     }
 
@@ -806,9 +802,7 @@
         xd->dst.v_buffer + 8);*/
 
     // this is to account for the border
-#if CONFIG_NEWNEAR
     xd->prev_mode_info_context += 1 - (cm->mb_cols & 0x1) + xd->mode_info_stride;
-#endif
     xd->mode_info_context += 1 - (cm->mb_cols & 0x1) + xd->mode_info_stride;
     x->partition_info     += 1 - (cm->mb_cols & 0x1) + xd->mode_info_stride;
     x->gf_active_ptr      += cm->mb_cols - (cm->mb_cols & 0x1);
@@ -1033,11 +1027,9 @@
         // skip to next mb
         xd->mode_info_context++;
 
-#if CONFIG_NEWNEAR
         xd->prev_mode_info_context++;
         assert((xd->prev_mode_info_context - cpi->common.prev_mip)
             ==(xd->mode_info_context - cpi->common.mip));
-#endif
         x->partition_info++;
 
         xd->above_context++;
@@ -1057,9 +1049,7 @@
         xd->dst.v_buffer + 8);
 
     // this is to account for the border
-#if CONFIG_NEWNEAR
     xd->prev_mode_info_context++;
-#endif
     xd->mode_info_context++;
     x->partition_info++;
 
@@ -1104,11 +1094,8 @@
 
     xd->mode_info_context = cm->mi;
     xd->mode_info_stride = cm->mode_info_stride;
-#if CONFIG_NEWNEAR
     xd->prev_mode_info_context = cm->prev_mi;
-#endif
 
-
     xd->frame_type = cm->frame_type;
 
     xd->frames_since_golden = cm->frames_since_golden;
@@ -1274,11 +1261,8 @@
 
     xd->mode_info_context = cm->mi;
 
-#if CONFIG_NEWNEAR
     xd->prev_mode_info_context = cm->prev_mi;
-#endif
 
-
     vp8_zero(cpi->MVcount);
     vp8_zero(cpi->coef_counts);
 
@@ -1338,10 +1322,8 @@
 
                 xd->mode_info_context += xd->mode_info_stride
                                         * cpi->encoding_thread_count;
-#if CONFIG_NEWNEAR
                 xd->prev_mode_info_context += xd->mode_info_stride
                                             * cpi->encoding_thread_count;
-#endif
 
                 x->partition_info  += xd->mode_info_stride * cpi->encoding_thread_count;
                 x->gf_active_ptr   += cm->mb_cols * cpi->encoding_thread_count;
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -247,9 +247,7 @@
                     recon_uvoffset += 8;
 
                     // skip to next mb
-#if CONFIG_NEWNEAR
                     xd->prev_mode_info_context++;
-#endif
                     xd->mode_info_context++;
                     x->partition_info++;
                     xd->above_context++;
@@ -265,9 +263,7 @@
                     xd->dst.v_buffer + 8);
 
                 // this is to account for the border
-#if CONFIG_NEWNEAR
                 xd->prev_mode_info_context++;
-#endif
 
                 xd->mode_info_context++;
                 x->partition_info++;
@@ -278,10 +274,8 @@
 
                 xd->mode_info_context += xd->mode_info_stride
                                         * cpi->encoding_thread_count;
-#if CONFIG_NEWNEAR
                 xd->prev_mode_info_context += xd->mode_info_stride
                                             * cpi->encoding_thread_count;
-#endif
 
                 x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
                 x->gf_active_ptr   += cm->mb_cols * cpi->encoding_thread_count;
@@ -459,10 +453,8 @@
 
         mbd->mode_info_context = cm->mi
                                  + x->e_mbd.mode_info_stride * (i + 1);
-#if CONFIG_NEWNEAR
         mbd->prev_mode_info_context = cm->prev_mi
                                     + x->e_mbd.mode_info_stride * (i + 1);
-#endif
         mbd->mode_info_stride  = cm->mode_info_stride;
 
         mbd->frame_type = cm->frame_type;
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -2705,7 +2705,7 @@
                                    - cpi->first_time_stamp_ever) / 10000000.000;
             double total_encode_time = (cpi->time_receive_data + cpi->time_compress_data)   / 1000.000;
             double dr = (double)cpi->bytes * (double) 8 / (double)1000  / time_encoded;
-#if CONFIG_NEWNEAR&&defined(MODE_STATS)
+#if defined(MODE_STATS)
             print_mode_contexts(&cpi->common);
 #endif
             if (cpi->b_calculate_psnr)
@@ -5393,7 +5393,6 @@
     vp8_write_yuv_rec_frame(cm);
 #endif
 
-#if CONFIG_NEWNEAR
     if(cm->show_frame)
     {
         vpx_memcpy(cm->prev_mip, cm->mip,
@@ -5404,9 +5403,6 @@
         vpx_memset(cm->prev_mip, 0,
             (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
     }
-#endif
-
-
 }
 
 
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -472,9 +472,7 @@
         YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
                         x->e_mbd.prev_mode_info_context,
-#endif
             &nearest_mv[LAST_FRAME], &near_mv[LAST_FRAME],
                           &frame_best_ref_mv[LAST_FRAME], MDCounts[LAST_FRAME], LAST_FRAME, cpi->common.ref_frame_sign_bias);
 
@@ -490,10 +488,7 @@
         YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
             x->e_mbd.prev_mode_info_context,
-#endif
-
             &nearest_mv[GOLDEN_FRAME], &near_mv[GOLDEN_FRAME],
             &frame_best_ref_mv[GOLDEN_FRAME], MDCounts[GOLDEN_FRAME], GOLDEN_FRAME, cpi->common.ref_frame_sign_bias);
 
@@ -509,9 +504,7 @@
         YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
                         x->e_mbd.prev_mode_info_context,
-#endif
                         &nearest_mv[ALTREF_FRAME], &near_mv[ALTREF_FRAME],
                         &frame_best_ref_mv[ALTREF_FRAME], MDCounts[ALTREF_FRAME], ALTREF_FRAME, cpi->common.ref_frame_sign_bias);
 
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -267,16 +267,13 @@
     vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc));
     vpx_memcpy(&cpi->common.lfc_a, &cpi->common.fc, sizeof(cpi->common.fc));
 
-#if CONFIG_NEWNEAR
     vp8_init_mode_contexts(&cpi->common);
     vpx_memcpy( cpi->common.vp8_mode_contexts,
                 cpi->common.mode_context,
                 sizeof(cpi->common.mode_context));
-#else
     vpx_memcpy( cpi->common.vp8_mode_contexts,
                 default_vp8_mode_contexts,
                 sizeof(default_vp8_mode_contexts));
-#endif /* CONFIG_NEWNEAR */
 }
 void vp8_setup_inter_frame(VP8_COMP *cpi)
 {
@@ -285,11 +282,9 @@
         vpx_memcpy( &cpi->common.fc,
                     &cpi->common.lfc_a,
                     sizeof(cpi->common.fc));
-#if CONFIG_NEWNEAR
         vpx_memcpy( cpi->common.vp8_mode_contexts,
                     cpi->common.mode_context_a,
                     sizeof(cpi->common.vp8_mode_contexts));
-#endif /* CONFIG_NEWNEAR */
     }
     else
     {
@@ -296,11 +291,9 @@
         vpx_memcpy( &cpi->common.fc,
                     &cpi->common.lfc,
                     sizeof(cpi->common.fc));
-#if CONFIG_NEWNEAR
         vpx_memcpy( cpi->common.vp8_mode_contexts,
                     cpi->common.mode_context,
                     sizeof(cpi->common.vp8_mode_contexts));
-#endif /* CONFIG_NEWNEAR */
     }
 }
 
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2178,9 +2178,7 @@
         YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
             x->e_mbd.prev_mode_info_context,
-#endif
             &frame_nearest_mv[LAST_FRAME], &frame_near_mv[LAST_FRAME],
             &frame_best_ref_mv[LAST_FRAME], frame_mdcounts[LAST_FRAME], LAST_FRAME, cpi->common.ref_frame_sign_bias);
 
@@ -2194,9 +2192,7 @@
         YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
             x->e_mbd.prev_mode_info_context,
-#endif
             &frame_nearest_mv[GOLDEN_FRAME], &frame_near_mv[GOLDEN_FRAME],
             &frame_best_ref_mv[GOLDEN_FRAME], frame_mdcounts[GOLDEN_FRAME], GOLDEN_FRAME, cpi->common.ref_frame_sign_bias);
 
@@ -2210,9 +2206,7 @@
         YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
 
         vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
-#if CONFIG_NEWNEAR
                           x->e_mbd.prev_mode_info_context,
-#endif
                           &frame_nearest_mv[ALTREF_FRAME], &frame_near_mv[ALTREF_FRAME],
                           &frame_best_ref_mv[ALTREF_FRAME], frame_mdcounts[ALTREF_FRAME], ALTREF_FRAME, cpi->common.ref_frame_sign_bias);
 
--