Fix merge defects

This commit fixes the merge conflicts between master and nextgenv2 and
disable early termination in choose_tx_size() to avoid failure in test.

The test failures are pre-existing, some of the issue were fixed in
masterbase already, so will have another merge to introduce the fixes.

Change-Id: Ib71889661955e73aedbb4db49d8be70425281dcb
diff --git a/configure b/configure
index 5c0ed95..5481656 100755
--- a/configure
+++ b/configure
@@ -267,6 +267,7 @@
     var_tx
     ext_tx
     misc_fixes
+    ext_intra
     universal_hp
 "
 CONFIG_LIST="
diff --git a/vp10/common/blockd.h b/vp10/common/blockd.h
index 57c4321..392b5d2 100644
--- a/vp10/common/blockd.h
+++ b/vp10/common/blockd.h
@@ -257,7 +257,7 @@
   const MB_MODE_INFO *const mbmi = &mi->mbmi;
 
 #if CONFIG_EXT_TX
-  if (xd->lossless || tx_size >= TX_32X32)
+  if ( xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
     return DCT_DCT;
   if (mbmi->sb_type >= BLOCK_8X8) {
     if (plane_type == PLANE_TYPE_Y || is_inter_block(mbmi))
diff --git a/vp10/common/entropymode.c b/vp10/common/entropymode.c
index d8874c5a..e2cecbf 100644
--- a/vp10/common/entropymode.c
+++ b/vp10/common/entropymode.c
@@ -973,6 +973,7 @@
 
 #if CONFIG_EXT_TX
   for (i = TX_4X4; i <= TX_16X16; ++i) {
+    int j;
     vpx_tree_merge_probs(vp10_tx_type_tree, pre_fc->inter_tx_type_prob[i],
                          counts->inter_tx_type[i], fc->inter_tx_type_prob[i]);
 
diff --git a/vp10/common/onyxc_int.h b/vp10/common/onyxc_int.h
index aa62042..6814133 100644
--- a/vp10/common/onyxc_int.h
+++ b/vp10/common/onyxc_int.h
@@ -379,14 +379,6 @@
   return cm->frame_type == KEY_FRAME || cm->intra_only;
 }
 
-static INLINE void set_partition_probs(const VP10_COMMON *const cm,
-                                       MACROBLOCKD *const xd) {
-  xd->partition_probs =
-      frame_is_intra_only(cm) ?
-          &vp10_kf_partition_probs[0] :
-          (const vpx_prob (*)[PARTITION_TYPES - 1])cm->fc->partition_prob;
-}
-
 static INLINE void vp10_init_macroblockd(VP10_COMMON *cm, MACROBLOCKD *xd,
                                         tran_low_t *dqcoeff) {
   int i;
@@ -407,13 +399,6 @@
   xd->above_seg_context = cm->above_seg_context;
   xd->mi_stride = cm->mi_stride;
   xd->error_info = &cm->error;
-
-  set_partition_probs(cm, xd);
-}
-
-static INLINE const vpx_prob* get_partition_probs(const MACROBLOCKD *xd,
-                                                  int ctx) {
-  return xd->partition_probs[ctx];
 }
 
 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c
index d37b5e8..5f0bc49 100644
--- a/vp10/encoder/encodemb.c
+++ b/vp10/encoder/encodemb.c
@@ -1132,7 +1132,7 @@
         break;
       case TX_4X4:
         vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
-                                 xd->lossless);
+                                 xd->lossless[mbmi->segment_id]);
         vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
                                 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob,
@@ -1220,7 +1220,7 @@
         break;
       case TX_4X4:
         vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
-                                 xd->lossless);
+                                 xd->lossless[xd->mi[0]->mbmi.segment_id]);
         vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
                                p->quant_fp[0], qcoeff, dqcoeff,
                                pd->dequant[0], eob);
@@ -1592,7 +1592,7 @@
   if (p->eobs[block] > 0) {
 #if CONFIG_VP9_HIGHBITDEPTH
     if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
-      if (xd->lossless) {
+      if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
         vp10_highbd_iwht4x4_add(dqcoeff, dst, pd->dst.stride,
                                 p->eobs[block], xd->bd);
       } else {
@@ -1602,7 +1602,7 @@
       return;
     }
 #endif  // CONFIG_VP9_HIGHBITDEPTH
-    if (xd->lossless) {
+    if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
       vp10_iwht4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
     } else {
       vp10_idct4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index 525e034..d0b2f6b 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -637,7 +637,8 @@
 
   mbmi->tx_size = VPXMIN(max_tx_size, largest_tx_size);
 #if CONFIG_EXT_TX
-  if (is_inter_block(mbmi) && bs >= BLOCK_8X8 && !xd->lossless) {
+  if (is_inter_block(mbmi) && bs >= BLOCK_8X8 &&
+      !xd->lossless[mbmi->segment_id]) {
     for (tx_type = DCT_DCT; tx_type < TX_TYPES - 1; ++tx_type) {
       if (mbmi->tx_type >= DST_ADST && mbmi->tx_type < IDTX &&
           best_tx_type == DCT_DCT) {
@@ -666,7 +667,7 @@
         this_rd = RDCOST(x->rdmult, x->rddiv, s1, psse);
       else
         this_rd = RDCOST(x->rdmult, x->rddiv, r + s0, d);
-      if (is_inter_block(mbmi) && !xd->lossless && !s)
+      if (is_inter_block(mbmi) && !xd->lossless[mbmi->segment_id] && !s)
         this_rd = VPXMIN(this_rd, RDCOST(x->rdmult, x->rddiv, s1, psse));
 
       if (this_rd < ((best_tx_type == DCT_DCT) ? ext_tx_th : 1) * best_rd) {
@@ -685,7 +686,7 @@
 
 #if CONFIG_EXT_TX
   if (bs >= BLOCK_8X8 && mbmi->tx_size <= TX_16X16 &&
-      !xd->lossless && *rate != INT_MAX) {
+      !xd->lossless[mbmi->segment_id] && *rate != INT_MAX) {
     if (is_inter_block(mbmi))
       *rate += cpi->inter_tx_type_costs[mbmi->tx_size][mbmi->tx_type];
     else
@@ -758,7 +759,7 @@
 
 #if CONFIG_EXT_TX
   start_tx_type = DCT_DCT;
-  if (bs >= BLOCK_8X8 && !xd->lossless)
+  if (bs >= BLOCK_8X8 && !xd->lossless[mbmi->segment_id])
     end_tx_type = TX_TYPES - 1;
   else
     end_tx_type = DCT_DCT;
@@ -791,7 +792,8 @@
                        &sse, ref_best_rd, 0, bs, n,
                        cpi->sf.use_fast_coef_costing);
 #if CONFIG_EXT_TX
-      if (bs >= BLOCK_8X8 && !xd->lossless && r != INT_MAX && n < TX_32X32) {
+      if (bs >= BLOCK_8X8 && !xd->lossless[mbmi->segment_id] &&
+          r != INT_MAX && n < TX_32X32) {
         if (is_inter_block(mbmi))
           r += cpi->inter_tx_type_costs[n][mbmi->tx_type];
         else
@@ -817,11 +819,11 @@
         rd = RDCOST(x->rdmult, x->rddiv, r + s0, d);
       }
 
-      if (is_inter_block(mbmi) && !xd->lossless && !s)
+      if (is_inter_block(mbmi) && !xd->lossless[mbmi->segment_id] && !s)
         rd = VPXMIN(rd, RDCOST(x->rdmult, x->rddiv, s1, sse));
 
       // Early termination in transform size search.
-      if (cpi->sf.tx_size_search_breakout &&
+      if (0 && cpi->sf.tx_size_search_breakout &&
           (rd== INT64_MAX ||
               (n < (int) max_tx_size && rd > last_rd) ||
               s == 1))