Fix the decoder crash with CONFIG_SDP

The decoder crash happens when both sdp and intraBC are enabled for key frame.

In the previous code patches of SDP, variable tree_type exists in struct MB_MODE_INFO and struct MACROBLOCKD, which is easy to cause inconsistency. To solve the problem, variable tree_type from struct MB_MODE_INFO is removed in this code patch. And this variable is passed as the parameter into functions is_inter_block() and is_intrabc_block.

STATS_CHANGED

BUGS=aomedia:3052

Change-Id: I06c13c4be064ecb0d272f80af9d85a9c180cc83f
diff --git a/aom_dsp/variance.c b/aom_dsp/variance.c
index cbe756e..f75c540 100644
--- a/aom_dsp/variance.c
+++ b/aom_dsp/variance.c
@@ -290,7 +290,11 @@
   if (xd != NULL) {
     const MB_MODE_INFO *mi = xd->mi[0];
     const int ref_num = 0;
+#if CONFIG_SDP
+    const int is_intrabc = is_intrabc_block(mi, xd->tree_type);
+#else
     const int is_intrabc = is_intrabc_block(mi);
+#endif
     const struct scale_factors *const sf =
         is_intrabc ? &cm->sf_identity : xd->block_ref_scale_factors[ref_num];
     const int is_scaled = av1_is_scaled(sf);
@@ -837,7 +841,11 @@
   if (xd != NULL) {
     const MB_MODE_INFO *mi = xd->mi[0];
     const int ref_num = 0;
+#if CONFIG_SDP
+    const int is_intrabc = is_intrabc_block(mi, xd->tree_type);
+#else
     const int is_intrabc = is_intrabc_block(mi);
+#endif
     const struct scale_factors *const sf =
         is_intrabc ? &cm->sf_identity : xd->block_ref_scale_factors[ref_num];
     const int is_scaled = av1_is_scaled(sf);
diff --git a/aom_dsp/x86/highbd_variance_sse2.c b/aom_dsp/x86/highbd_variance_sse2.c
index 9094b3f..cbdeba2 100644
--- a/aom_dsp/x86/highbd_variance_sse2.c
+++ b/aom_dsp/x86/highbd_variance_sse2.c
@@ -624,7 +624,11 @@
   if (xd != NULL) {
     const MB_MODE_INFO *mi = xd->mi[0];
     const int ref_num = 0;
+#if CONFIG_SDP
+    const int is_intrabc = is_intrabc_block(mi, xd->tree_type);
+#else
     const int is_intrabc = is_intrabc_block(mi);
+#endif
     const struct scale_factors *const sf =
         is_intrabc ? &cm->sf_identity : xd->block_ref_scale_factors[ref_num];
     const int is_scaled = av1_is_scaled(sf);
diff --git a/aom_dsp/x86/variance_sse2.c b/aom_dsp/x86/variance_sse2.c
index cb2c6c0..217d9de 100644
--- a/aom_dsp/x86/variance_sse2.c
+++ b/aom_dsp/x86/variance_sse2.c
@@ -503,7 +503,11 @@
   if (xd != NULL) {
     const MB_MODE_INFO *mi = xd->mi[0];
     const int ref_num = 0;
+#if CONFIG_SDP
+    const int is_intrabc = is_intrabc_block(mi, xd->tree_type);
+#else
     const int is_intrabc = is_intrabc_block(mi);
+#endif
     const struct scale_factors *const sf =
         is_intrabc ? &cm->sf_identity : xd->block_ref_scale_factors[ref_num];
     const int is_scaled = av1_is_scaled(sf);
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c
index 05dd1fe..b8f6a8d 100644
--- a/av1/common/av1_loopfilter.c
+++ b/av1/common/av1_loopfilter.c
@@ -213,8 +213,8 @@
 #endif
   assert(tx_size < TX_SIZES_ALL);
 #if CONFIG_SDP
-  if ((plane == AOM_PLANE_Y) && is_inter_block(mbmi) &&
-      !mbmi->skip_txfm[mbmi->tree_type == CHROMA_PART]) {
+  if ((plane == AOM_PLANE_Y) && is_inter_block(mbmi, SHARED_PART) &&
+      !mbmi->skip_txfm[SHARED_PART]) {
     const BLOCK_SIZE sb_type = mbmi->sb_type[plane_type];
 #else
   if ((plane == AOM_PLANE_Y) && is_inter_block(mbmi) && !mbmi->skip_txfm) {
@@ -306,7 +306,7 @@
           av1_get_filter_level(cm, &cm->lf_info, edge_dir, plane, mbmi);
 #if CONFIG_SDP
       const int curr_skipped =
-          mbmi->skip_txfm[plane_type] && is_inter_block(mbmi);
+          mbmi->skip_txfm[plane_type] && is_inter_block(mbmi, xd->tree_type);
 #else
       const int curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi);
 #endif
@@ -331,7 +331,8 @@
 
           const int pv_skip_txfm =
 #if CONFIG_SDP
-              mi_prev->skip_txfm[plane_type] && is_inter_block(mi_prev);
+              mi_prev->skip_txfm[plane_type] &&
+              is_inter_block(mi_prev, xd->tree_type);
 #else
               mi_prev->skip_txfm && is_inter_block(mi_prev);
 #endif
diff --git a/av1/common/blockd.c b/av1/common/blockd.c
index 00725ea..e8612f2 100644
--- a/av1/common/blockd.c
+++ b/av1/common/blockd.c
@@ -18,13 +18,23 @@
 
 PREDICTION_MODE av1_left_block_mode(const MB_MODE_INFO *left_mi) {
   if (!left_mi) return DC_PRED;
+#if CONFIG_SDP
+  assert(!is_inter_block(left_mi, SHARED_PART) ||
+         is_intrabc_block(left_mi, SHARED_PART));
+#else
   assert(!is_inter_block(left_mi) || is_intrabc_block(left_mi));
+#endif
   return left_mi->mode;
 }
 
 PREDICTION_MODE av1_above_block_mode(const MB_MODE_INFO *above_mi) {
   if (!above_mi) return DC_PRED;
+#if CONFIG_SDP
+  assert(!is_inter_block(above_mi, SHARED_PART) ||
+         is_intrabc_block(above_mi, SHARED_PART));
+#else
   assert(!is_inter_block(above_mi) || is_intrabc_block(above_mi));
+#endif
   return above_mi->mode;
 }
 
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index b1759bb..0568e33 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -241,7 +241,6 @@
   // Common for both INTER and INTRA blocks
 #if CONFIG_SDP
   BLOCK_SIZE sb_type[2];
-  TREE_TYPE tree_type;
 #else
   BLOCK_SIZE sb_type;
 #endif
@@ -290,14 +289,15 @@
   int8_t cdef_strength : 4;
 } MB_MODE_INFO;
 
-static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) {
 #if CONFIG_SDP
-  const int plane_type = (mbmi->tree_type == CHROMA_PART);
-  return mbmi->use_intrabc[plane_type];
-#else
-  return mbmi->use_intrabc;
-#endif
+static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi, int tree_type) {
+  return mbmi->use_intrabc[tree_type == CHROMA_PART];
 }
+#else
+static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) {
+  return mbmi->use_intrabc;
+}
+#endif
 
 static INLINE PREDICTION_MODE get_uv_mode(UV_PREDICTION_MODE mode) {
   assert(mode < UV_INTRA_MODES);
@@ -322,9 +322,15 @@
   return uv2y[mode];
 }
 
+#if CONFIG_SDP
+static INLINE int is_inter_block(const MB_MODE_INFO *mbmi, int tree_type) {
+  return is_intrabc_block(mbmi, tree_type) || mbmi->ref_frame[0] > INTRA_FRAME;
+}
+#else
 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
   return is_intrabc_block(mbmi) || mbmi->ref_frame[0] > INTRA_FRAME;
 }
+#endif
 
 static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) {
   return mbmi->ref_frame[1] > INTRA_FRAME;
@@ -1113,10 +1119,13 @@
                                           TX_SIZE tx_size,
                                           int is_screen_content_type) {
   const MB_MODE_INFO *const mbmi = xd->mi[0];
-
-  if (is_inter_block(mbmi) || plane_type != PLANE_TYPE_Y ||
-      xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32 ||
-      is_screen_content_type)
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, xd->tree_type) ||
+#else
+  if (is_inter_block(mbmi) ||
+#endif
+      plane_type != PLANE_TYPE_Y || xd->lossless[mbmi->segment_id] ||
+      tx_size >= TX_32X32 || is_screen_content_type)
     return DCT_DCT;
 
   return intra_mode_to_tx_type(mbmi, plane_type);
@@ -1229,7 +1238,11 @@
   if (plane_type == PLANE_TYPE_Y) {
     tx_type = xd->tx_type_map[blk_row * xd->tx_type_map_stride + blk_col];
   } else {
+#if CONFIG_SDP
+    if (is_inter_block(mbmi, xd->tree_type)) {
+#else
     if (is_inter_block(mbmi)) {
+#endif
       // scale back to y plane's coordinate
       const struct macroblockd_plane *const pd = &xd->plane[plane_type];
       blk_row <<= pd->subsampling_y;
@@ -1241,12 +1254,22 @@
       tx_type = intra_mode_to_tx_type(mbmi, PLANE_TYPE_UV);
     }
     const TxSetType tx_set_type =
+#if CONFIG_SDP
+        av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi, xd->tree_type),
+                                reduced_tx_set);
+#else
         av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi), reduced_tx_set);
+#endif
     if (!av1_ext_tx_used[tx_set_type][tx_type]) tx_type = DCT_DCT;
   }
   assert(tx_type < TX_TYPES);
+#if CONFIG_SDP
+  assert(av1_ext_tx_used[av1_get_ext_tx_set_type(
+      tx_size, is_inter_block(mbmi, xd->tree_type), reduced_tx_set)][tx_type]);
+#else
   assert(av1_ext_tx_used[av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi),
                                                  reduced_tx_set)][tx_type]);
+#endif
   return tx_type;
 }
 
@@ -1451,10 +1474,16 @@
     return SIMPLE_TRANSLATION;
   }
 }
-
+#if CONFIG_SDP
+static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi,
+                                           int tree_type) {
+  return (is_inter_block(mbmi, tree_type));
+}
+#else
 static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) {
   return (is_inter_block(mbmi));
 }
+#endif
 
 static INLINE int av1_allow_palette(int allow_screen_content_tools,
                                     BLOCK_SIZE sb_type) {
diff --git a/av1/common/cfl.h b/av1/common/cfl.h
index 8f12002..2463e2d 100644
--- a/av1/common/cfl.h
+++ b/av1/common/cfl.h
@@ -59,7 +59,11 @@
 
   // If this block has chroma information, we know whether we're
   // actually going to perform a CfL prediction
+#if CONFIG_SDP
+  return (CFL_ALLOWED_TYPE)(!is_inter_block(mbmi, xd->tree_type) &&
+#else
   return (CFL_ALLOWED_TYPE)(!is_inter_block(mbmi) &&
+#endif
                             mbmi->uv_mode == UV_CFL_PRED);
 }
 
diff --git a/av1/common/idct.c b/av1/common/idct.c
index bff438f..d6b4a76 100644
--- a/av1/common/idct.c
+++ b/av1/common/idct.c
@@ -206,7 +206,12 @@
   txfm_param->bd = xd->bd;
   txfm_param->is_hbd = is_cur_buf_hbd(xd);
   txfm_param->tx_set_type = av1_get_ext_tx_set_type(
+#if CONFIG_SDP
+      txfm_param->tx_size, is_inter_block(xd->mi[0], xd->tree_type),
+      reduced_tx_set);
+#else
       txfm_param->tx_size, is_inter_block(xd->mi[0]), reduced_tx_set);
+#endif
 }
 
 void av1_highbd_inv_txfm_add_c(const tran_low_t *input, uint8_t *dest,
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index ed9b703..1fb1918 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -77,7 +77,11 @@
     CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight,
     int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params,
     uint16_t weight) {
+#if CONFIG_SDP
+  if (!is_inter_block(candidate, SHARED_PART)) return;
+#else
   if (!is_inter_block(candidate)) return;
+#endif
   assert(weight % 2 == 0);
   int index, ref;
 
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index 05a0dbc..18f4259 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -216,7 +216,11 @@
   const int left_in_image = xd->left_available;
 
   // Above neighbor
+#if CONFIG_SDP
+  if (above_in_image && is_inter_block(above_mbmi, xd->tree_type)) {
+#else
   if (above_in_image && is_inter_block(above_mbmi)) {
+#endif
     ref_counts[above_mbmi->ref_frame[0]]++;
     if (has_second_ref(above_mbmi)) {
       ref_counts[above_mbmi->ref_frame[1]]++;
@@ -224,7 +228,11 @@
   }
 
   // Left neighbor
+#if CONFIG_SDP
+  if (left_in_image && is_inter_block(left_mbmi, xd->tree_type)) {
+#else
   if (left_in_image && is_inter_block(left_mbmi)) {
+#endif
     ref_counts[left_mbmi->ref_frame[0]]++;
     if (has_second_ref(left_mbmi)) {
       ref_counts[left_mbmi->ref_frame[1]]++;
diff --git a/av1/common/obmc.h b/av1/common/obmc.h
index 97a2256..2f233cf 100644
--- a/av1/common/obmc.h
+++ b/av1/common/obmc.h
@@ -51,7 +51,11 @@
       above_mi = prev_row_mi + above_mi_col + 1;
       mi_step = 2;
     }
+#if CONFIG_SDP
+    if (is_neighbor_overlappable(*above_mi, xd->tree_type)) {
+#else
     if (is_neighbor_overlappable(*above_mi)) {
+#endif
       ++nb_count;
       fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
           *above_mi, fun_ctxt, num_planes);
@@ -88,7 +92,11 @@
       left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
       mi_step = 2;
     }
+#if CONFIG_SDP
+    if (is_neighbor_overlappable(*left_mi, xd->tree_type)) {
+#else
     if (is_neighbor_overlappable(*left_mi)) {
+#endif
       ++nb_count;
       fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
           fun_ctxt, num_planes);
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c
index 4c3c5c3..da5e8ad 100644
--- a/av1/common/pred_common.c
+++ b/av1/common/pred_common.c
@@ -134,11 +134,21 @@
   const int has_left = xd->left_available;
 
   if (has_above && has_left) {  // both edges available
+#if CONFIG_SDP
+    const int above_intra = !is_inter_block(above_mbmi, xd->tree_type);
+    const int left_intra = !is_inter_block(left_mbmi, xd->tree_type);
+#else
     const int above_intra = !is_inter_block(above_mbmi);
     const int left_intra = !is_inter_block(left_mbmi);
+#endif
     return left_intra && above_intra ? 3 : left_intra || above_intra;
   } else if (has_above || has_left) {  // one edge available
+#if CONFIG_SDP
+    return 2 *
+           !is_inter_block(has_above ? above_mbmi : left_mbmi, xd->tree_type);
+#else
     return 2 * !is_inter_block(has_above ? above_mbmi : left_mbmi);
+#endif
   } else {
     return 0;
   }
@@ -167,11 +177,19 @@
     else if (!has_second_ref(above_mbmi))
       // one of two edges uses comp pred (2/3)
       ctx = 2 + (IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame[0]) ||
+#if CONFIG_SDP
+                 !is_inter_block(above_mbmi, xd->tree_type));
+#else
                  !is_inter_block(above_mbmi));
+#endif
     else if (!has_second_ref(left_mbmi))
       // one of two edges uses comp pred (2/3)
       ctx = 2 + (IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame[0]) ||
+#if CONFIG_SDP
+                 !is_inter_block(left_mbmi, xd->tree_type));
+#else
                  !is_inter_block(left_mbmi));
+#endif
     else  // both edges use comp pred (4)
       ctx = 4;
   } else if (has_above || has_left) {  // one edge available
@@ -198,8 +216,13 @@
   const int left_in_image = xd->left_available;
 
   if (above_in_image && left_in_image) {  // both edges available
+#if CONFIG_SDP
+    const int above_intra = !is_inter_block(above_mbmi, xd->tree_type);
+    const int left_intra = !is_inter_block(left_mbmi, xd->tree_type);
+#else
     const int above_intra = !is_inter_block(above_mbmi);
     const int left_intra = !is_inter_block(left_mbmi);
+#endif
 
     if (above_intra && left_intra) {  // intra/intra
       pred_context = 2;
@@ -243,8 +266,11 @@
     }
   } else if (above_in_image || left_in_image) {  // one edge available
     const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
-
+#if CONFIG_SDP
+    if (!is_inter_block(edge_mbmi, xd->tree_type)) {  // intra
+#else
     if (!is_inter_block(edge_mbmi)) {  // intra
+#endif
       pred_context = 2;
     } else {                           // inter
       if (!has_second_ref(edge_mbmi))  // single pred
diff --git a/av1/common/pred_common.h b/av1/common/pred_common.h
index 7fc331e..593fb50 100644
--- a/av1/common/pred_common.h
+++ b/av1/common/pred_common.h
@@ -405,18 +405,20 @@
   int left = xd->left_txfm_context[0] >= max_tx_high;
 
   if (has_above)
-    if (is_inter_block(above_mbmi))
 #if CONFIG_SDP
+    if (is_inter_block(above_mbmi, xd->tree_type))
       above = block_size_wide[above_mbmi->sb_type[PLANE_TYPE_Y]] >= max_tx_wide;
 #else
+    if (is_inter_block(above_mbmi))
       above = block_size_wide[above_mbmi->sb_type] >= max_tx_wide;
 #endif
 
   if (has_left)
-    if (is_inter_block(left_mbmi))
 #if CONFIG_SDP
+    if (is_inter_block(left_mbmi, xd->tree_type))
       left = block_size_high[left_mbmi->sb_type[PLANE_TYPE_Y]] >= max_tx_high;
 #else
+    if (is_inter_block(left_mbmi))
       left = block_size_high[left_mbmi->sb_type] >= max_tx_high;
 #endif
 
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index c05a4e4..5490c94 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -790,8 +790,13 @@
   for (int row = row_start; row <= 0; ++row) {
     for (int col = col_start; col <= 0; ++col) {
       const MB_MODE_INFO *this_mbmi = xd->mi[row * xd->mi_stride + col];
+#if CONFIG_SDP
+      if (!is_inter_block(this_mbmi, xd->tree_type)) return false;
+      if (is_intrabc_block(this_mbmi, xd->tree_type)) return false;
+#else
       if (!is_inter_block(this_mbmi)) return false;
       if (is_intrabc_block(this_mbmi)) return false;
+#endif
     }
   }
   return true;
@@ -816,7 +821,11 @@
   const int b8_h = block_size_high[plane_bsize];
   const int is_compound = has_second_ref(mi);
   assert(!is_compound);
+#if CONFIG_SDP
+  assert(!is_intrabc_block(mi, xd->tree_type));
+#else
   assert(!is_intrabc_block(mi));
+#endif
 
   // For sub8x8 chroma blocks, we may be covering more than one luma block's
   // worth of pixels. Thus (mi_x, mi_y) may not be the correct coordinates for
@@ -883,7 +892,11 @@
     int build_for_obmc, int bw, int bh, int mi_x, int mi_y, uint8_t **mc_buf,
     CalcSubpelParamsFunc calc_subpel_params_func) {
   const int is_compound = has_second_ref(mi);
+#if CONFIG_SDP
+  const int is_intrabc = is_intrabc_block(mi, xd->tree_type);
+#else
   const int is_intrabc = is_intrabc_block(mi);
+#endif
   assert(IMPLIES(is_intrabc, !is_compound));
   struct macroblockd_plane *const pd = &xd->plane[plane];
   struct buf_2d *const dst_buf = &pd->dst;
@@ -971,7 +984,7 @@
                                 CalcSubpelParamsFunc calc_subpel_params_func) {
 #if CONFIG_SDP
   if (is_sub8x8_inter(xd, plane, mi->sb_type[PLANE_TYPE_Y],
-                      is_intrabc_block(mi), build_for_obmc)) {
+                      is_intrabc_block(mi, xd->tree_type), build_for_obmc)) {
 #else
   if (is_sub8x8_inter(xd, plane, mi->sb_type, is_intrabc_block(mi),
                       build_for_obmc)) {
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index 3c20409..71b8717 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -944,7 +944,11 @@
   } else {
     // uv_mode is not set for inter blocks, so need to explicitly
     // detect that case.
+#if CONFIG_SDP
+    if (is_inter_block(mbmi, SHARED_PART)) return 0;
+#else
     if (is_inter_block(mbmi)) return 0;
+#endif
 
     const UV_PREDICTION_MODE uv_mode = mbmi->uv_mode;
     return (uv_mode == UV_SMOOTH_PRED || uv_mode == UV_SMOOTH_V_PRED ||
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 92168fd..86e7376 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -896,7 +896,11 @@
   for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
     const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
     if (frame < LAST_FRAME) {
+#if CONFIG_SDP
+      assert(is_intrabc_block(mbmi, xd->tree_type));
+#else
       assert(is_intrabc_block(mbmi));
+#endif
       assert(frame == INTRA_FRAME);
       assert(ref == 0);
     } else {
@@ -963,9 +967,10 @@
   xd->mi[0]->partition = partition;
   const int plane_start = (xd->tree_type == CHROMA_PART);
   const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
-#endif
-
+  if (!is_inter_block(mbmi, xd->tree_type)) {
+#else
   if (!is_inter_block(mbmi)) {
+#endif
     int row, col;
     assert(bsize == get_plane_block_size(bsize, xd->plane[0].subsampling_x,
                                          xd->plane[0].subsampling_y));
@@ -1252,9 +1257,12 @@
   AV1_COMMON *cm = &pbi->common;
   const int num_planes = av1_num_planes(cm);
   MB_MODE_INFO *mbmi = xd->mi[0];
-  int inter_block_tx = is_inter_block(mbmi) || is_intrabc_block(mbmi);
 #if CONFIG_SDP
+  int inter_block_tx = is_inter_block(mbmi, xd->tree_type) ||
+                       is_intrabc_block(mbmi, xd->tree_type);
   if (xd->tree_type != CHROMA_PART) {
+#else
+  int inter_block_tx = is_inter_block(mbmi) || is_intrabc_block(mbmi);
 #endif
     if (cm->features.tx_mode == TX_MODE_SELECT && block_signals_txsize(bsize) &&
 #if CONFIG_SDP
@@ -1286,13 +1294,13 @@
 #endif
       if (inter_block_tx)
         memset(mbmi->inter_tx_size, mbmi->tx_size, sizeof(mbmi->inter_tx_size));
-      set_txfm_ctxs(
-          mbmi->tx_size, xd->width, xd->height,
+      set_txfm_ctxs(mbmi->tx_size, xd->width, xd->height,
 #if CONFIG_SDP
-          mbmi->skip_txfm[xd->tree_type == CHROMA_PART] && is_inter_block(mbmi),
-          xd);
+                    mbmi->skip_txfm[xd->tree_type == CHROMA_PART] &&
+                        is_inter_block(mbmi, xd->tree_type),
+                    xd);
 #else
-        mbmi->skip_txfm && is_inter_block(mbmi), xd);
+                  mbmi->skip_txfm && is_inter_block(mbmi), xd);
 #endif
 #if CONFIG_LPF_MASK
       const int w = mi_size_wide[bsize];
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index dcc2a7c..793745f 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -126,10 +126,14 @@
 static int read_delta_lflevel(const AV1_COMMON *const cm, aom_reader *r,
                               aom_cdf_prob *const cdf,
                               const MB_MODE_INFO *const mbmi, int mi_col,
+#if CONFIG_SDP
+                              int mi_row, int tree_type) {
+#else
                               int mi_row) {
+#endif
   int reduced_delta_lflevel = 0;
 #if CONFIG_SDP
-  const int plane_type = (mbmi->tree_type == CHROMA_PART);
+  const int plane_type = (tree_type == CHROMA_PART);
   const BLOCK_SIZE bsize = mbmi->sb_type[plane_type];
 #else
   const BLOCK_SIZE bsize = mbmi->sb_type;
@@ -704,8 +708,11 @@
   // No need to read transform type for lossless mode(qindex==0).
   const int qindex = xd->qindex[mbmi->segment_id];
   if (qindex == 0) return;
-
+#if CONFIG_SDP
+  const int inter_block = is_inter_block(mbmi, xd->tree_type);
+#else
   const int inter_block = is_inter_block(mbmi);
+#endif
   if (get_ext_tx_types(tx_size, inter_block, cm->features.reduced_tx_set_used) >
       1) {
     const TxSetType tx_set_type = av1_get_ext_tx_set_type(
@@ -843,17 +850,28 @@
         for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) {
           const int tmp_lvl =
               xd->delta_lf[lf_id] +
+#if CONFIG_SDP
+              read_delta_lflevel(cm, r, ec_ctx->delta_lf_multi_cdf[lf_id], mbmi,
+                                 mi_col, mi_row, xd->tree_type) *
+#else
               read_delta_lflevel(cm, r, ec_ctx->delta_lf_multi_cdf[lf_id], mbmi,
                                  mi_col, mi_row) *
+#endif
                   delta_q_info->delta_lf_res;
           mbmi->delta_lf[lf_id] = xd->delta_lf[lf_id] =
               clamp(tmp_lvl, -MAX_LOOP_FILTER, MAX_LOOP_FILTER);
         }
       } else {
-        const int tmp_lvl = xd->delta_lf_from_base +
-                            read_delta_lflevel(cm, r, ec_ctx->delta_lf_cdf,
-                                               mbmi, mi_col, mi_row) *
-                                delta_q_info->delta_lf_res;
+        const int tmp_lvl =
+            xd->delta_lf_from_base +
+#if CONFIG_SDP
+            read_delta_lflevel(cm, r, ec_ctx->delta_lf_cdf, mbmi, mi_col,
+                               mi_row, xd->tree_type) *
+#else
+            read_delta_lflevel(cm, r, ec_ctx->delta_lf_cdf, mbmi, mi_col,
+                               mi_row) *
+#endif
+                delta_q_info->delta_lf_res;
         mbmi->delta_lf_from_base = xd->delta_lf_from_base =
             clamp(tmp_lvl, -MAX_LOOP_FILTER, MAX_LOOP_FILTER);
       }
@@ -926,7 +944,11 @@
   if (av1_allow_intrabc(cm)) {
 #endif
     read_intrabc_info(cm, dcb, r);
+#if CONFIG_SDP
+    if (is_intrabc_block(mbmi, xd->tree_type)) return;
+#else
     if (is_intrabc_block(mbmi)) return;
+#endif
   }
 
   const int use_angle_delta = av1_use_angle_delta(bsize);
@@ -1817,7 +1839,6 @@
   MACROBLOCKD *const xd = &dcb->xd;
   MB_MODE_INFO *const mi = xd->mi[0];
 #if CONFIG_SDP
-  mi->tree_type = xd->tree_type;
   mi->use_intrabc[xd->tree_type == CHROMA_PART] = 0;
 #else
   mi->use_intrabc = 0;
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 5bdc0d4..caf274f 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -264,14 +264,15 @@
 
 void av1_visit_palette(AV1Decoder *const pbi, MACROBLOCKD *const xd,
                        aom_reader *r, palette_visitor_fn_t visit) {
-  if (!is_inter_block(xd->mi[0])) {
 #if CONFIG_SDP
+  if (!is_inter_block(xd->mi[0], xd->tree_type)) {
     const int plane_start = (xd->tree_type == CHROMA_PART);
     const int plane_end =
         (xd->tree_type == LUMA_PART ? 1
                                     : AOMMIN(2, av1_num_planes(&pbi->common)));
     for (int plane = plane_start; plane < plane_end; ++plane) {
 #else
+  if (!is_inter_block(xd->mi[0])) {
     for (int plane = 0; plane < AOMMIN(2, av1_num_planes(&pbi->common));
          ++plane) {
 #endif
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index a969b45..f2367f2 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -384,8 +384,11 @@
       av1_read_coeffs_txb(cm, dcb, r, row, col, plane, &txb_ctx, tx_size);
   av1_set_entropy_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, col,
                            row);
-
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, xd->tree_type)) {
+#else
   if (is_inter_block(mbmi)) {
+#endif
     const PLANE_TYPE plane_type = get_plane_type(plane);
     // tx_type will be read out in av1_read_coeffs_txb_facade
     const TX_TYPE tx_type = av1_get_tx_type(xd, plane_type, row, col, tx_size,
diff --git a/av1/decoder/inspection.c b/av1/decoder/inspection.c
index 59ebac2..7113d50 100644
--- a/av1/decoder/inspection.c
+++ b/av1/decoder/inspection.c
@@ -132,7 +132,12 @@
 #endif
       const int c = i % mi_size_wide[bsize];
       const int r = j % mi_size_high[bsize];
+#if CONFIG_SDP
+      if (is_inter_block(mbmi, SHARED_PART) ||
+          is_intrabc_block(mbmi, SHARED_PART))
+#else
       if (is_inter_block(mbmi) || is_intrabc_block(mbmi))
+#endif
         mi->tx_size = mbmi->inter_tx_size[av1_get_txb_size_index(bsize, r, c)];
       else
         mi->tx_size = mbmi->tx_size;
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index 0a2ba35..5036fbe 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -87,10 +87,18 @@
   if (dist > cr->thresh_dist_sb &&
       (mv.row > cr->motion_thresh || mv.row < -cr->motion_thresh ||
        mv.col > cr->motion_thresh || mv.col < -cr->motion_thresh ||
+#if CONFIG_SDP
+       !is_inter_block(mbmi, SHARED_PART)))
+#else
        !is_inter_block(mbmi)))
+#endif
     return CR_SEGMENT_ID_BASE;
   else if (bsize >= BLOCK_16X16 && rate < cr->thresh_rate_sb &&
+#if CONFIG_SDP
+           is_inter_block(mbmi, SHARED_PART) && mbmi->mv[0].as_int == 0 &&
+#else
            is_inter_block(mbmi) && mbmi->mv[0].as_int == 0 &&
+#endif
            cr->rate_boost_fac > 10)
     // More aggressive delta-q for bigger blocks with zero motion.
     return CR_SEGMENT_ID_BOOST2;
@@ -242,7 +250,12 @@
           cr->actual_num_seg2_blocks++;
       }
       // Accumulate low_content_frame.
+#if CONFIG_SDP
+      if (is_inter_block(mi[0], SHARED_PART) && abs(mv.row) < 16 &&
+          abs(mv.col) < 16)
+#else
       if (is_inter_block(mi[0]) && abs(mv.row) < 16 && abs(mv.col) < 16)
+#endif
         cr->cnt_zeromv++;
     }
   }
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index eea0ab0..a215c4e 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -70,7 +70,11 @@
                                              const MB_MODE_INFO *left_mi,
                                              PREDICTION_MODE mode,
                                              aom_writer *w) {
+#if CONFIG_SDP
+  assert(!is_intrabc_block(mi, SHARED_PART));
+#else
   assert(!is_intrabc_block(mi));
+#endif
   (void)mi;
   aom_write_symbol(w, mode, get_y_mode_cdf(frame_ctx, above_mi, left_mi),
                    INTRA_MODES);
@@ -222,7 +226,11 @@
     const int32_t tx_size_cat = bsize_to_tx_size_cat(bsize);
 
     assert(depth >= 0 && depth <= max_depths);
+#if CONFIG_SDP
+    assert(!is_inter_block(mbmi, xd->tree_type));
+#else
     assert(!is_inter_block(mbmi));
+#endif
     assert(IMPLIES(is_rect_tx(tx_size), is_rect_tx_allowed(xd, mbmi)));
 
     aom_write_symbol(w, depth, ec_ctx->tx_size_cdf[tx_size_cat][tx_size_ctx],
@@ -503,8 +511,9 @@
     // Still need to transmit tx size for intra blocks even if skip_txfm is
     // true. Changing segment_id may make the tx size become invalid, e.g
     // changing from lossless to lossy.
-    assert(is_inter_block(mbmi) || !cpi->enc_seg.has_lossless_segment);
 #if CONFIG_SDP
+    assert(is_inter_block(mbmi, xd->tree_type) ||
+           !cpi->enc_seg.has_lossless_segment);
     set_spatial_segment_id(&cm->mi_params, cm->cur_frame->seg_map,
                            mbmi->sb_type[xd->tree_type == CHROMA_PART], mi_row,
                            mi_col, pred);
@@ -512,6 +521,7 @@
                            mbmi->sb_type[xd->tree_type == CHROMA_PART], mi_row,
                            mi_col, pred);
 #else
+    assert(is_inter_block(mbmi) || !cpi->enc_seg.has_lossless_segment);
     set_spatial_segment_id(&cm->mi_params, cm->cur_frame->seg_map,
                            mbmi->sb_type, mi_row, mi_col, pred);
     set_spatial_segment_id(&cm->mi_params, cpi->enc_seg.map, mbmi->sb_type,
@@ -893,7 +903,11 @@
                        TX_TYPE tx_type, TX_SIZE tx_size, aom_writer *w) {
   MB_MODE_INFO *mbmi = xd->mi[0];
   const FeatureFlags *const features = &cm->features;
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   if (get_ext_tx_types(tx_size, is_inter, features->reduced_tx_set_used) > 1 &&
       ((!cm->seg.enabled && cm->quant_params.base_qindex > 0) ||
        (cm->seg.enabled && xd->qindex[mbmi->segment_id] > 0)) &&
@@ -1240,7 +1254,11 @@
   const BLOCK_SIZE bsize = mbmi->sb_type;
 #endif
   const int allow_hp = cm->features.allow_high_precision_mv;
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   const int is_compound = has_second_ref(mbmi);
   int ref;
 
@@ -1395,9 +1413,11 @@
     MACROBLOCKD *xd, const MB_MODE_INFO_EXT_FRAME *mbmi_ext_frame,
     aom_writer *w) {
   const MB_MODE_INFO *const mbmi = xd->mi[0];
-  int use_intrabc = is_intrabc_block(mbmi);
 #if CONFIG_SDP
+  int use_intrabc = is_intrabc_block(mbmi, xd->tree_type);
   if (xd->tree_type == CHROMA_PART) assert(use_intrabc == 0);
+#else
+  int use_intrabc = is_intrabc_block(mbmi);
 #endif
   FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
   aom_write_symbol(w, use_intrabc, ec_ctx->intrabc_cdf, 2);
@@ -1442,7 +1462,11 @@
   if (av1_allow_intrabc(cm)) {
 #endif
     write_intrabc_info(xd, mbmi_ext_frame, w);
+#if CONFIG_SDP
+    if (is_intrabc_block(mbmi, xd->tree_type)) return;
+#else
     if (is_intrabc_block(mbmi)) return;
+#endif
   }
 
   write_intra_prediction_modes(cpi, 1, w);
@@ -1499,7 +1523,11 @@
       mbmi_ext_info->frame_base + get_mi_ext_idx(mi_row, mi_col,
                                                  cm->mi_params.mi_alloc_bsize,
                                                  mbmi_ext_info->stride);
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, SHARED_PART)) {
+#else
   if (is_inter_block(mbmi)) {
+#endif
 #define FRAME_TO_CHECK 11
     if (cm->current_frame.frame_number == FRAME_TO_CHECK &&
         cm->show_frame == 1) {
@@ -1621,11 +1649,12 @@
 #endif
 #if CONFIG_SDP
   assert(!mbmi->skip_txfm[xd->tree_type == CHROMA_PART]);
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
 #else
   assert(!mbmi->skip_txfm);
+  const int is_inter = is_inter_block(mbmi);
 #endif
 
-  const int is_inter = is_inter_block(mbmi);
   if (!is_inter) {
     av1_write_intra_coeffs_mb(cm, x, w, bsize);
   } else {
@@ -1696,7 +1725,6 @@
 
 #if CONFIG_SDP
   MB_MODE_INFO *mbmi = xd->mi[0];
-  mbmi->tree_type = xd->tree_type;
 #else
   const MB_MODE_INFO *mbmi = xd->mi[0];
 #endif
@@ -1758,10 +1786,11 @@
     }
   }
 
-  const int is_inter_tx = is_inter_block(mbmi);
 #if CONFIG_SDP
+  const int is_inter_tx = is_inter_block(mbmi, xd->tree_type);
   const int skip_txfm = mbmi->skip_txfm[xd->tree_type == CHROMA_PART];
 #else
+  const int is_inter_tx = is_inter_block(mbmi);
   const int skip_txfm = mbmi->skip_txfm;
 #endif
   const int segment_id = mbmi->segment_id;
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c
index 430b8b6..a7efe97 100644
--- a/av1/encoder/encodeframe_utils.c
+++ b/av1/encoder/encodeframe_utils.c
@@ -180,7 +180,11 @@
     TX_SIZE min_tx_size = depth_to_tx_size(MAX_TX_DEPTH, bsize);
     mbmi->tx_size = (TX_SIZE)TXSIZEMAX(mbmi->tx_size, min_tx_size);
   }
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, xd->tree_type)) {
+#else
   if (is_inter_block(mbmi)) {
+#endif
     memset(mbmi->inter_tx_size, mbmi->tx_size, sizeof(mbmi->inter_tx_size));
   }
   const int stride = xd->tx_type_map_stride;
@@ -386,7 +390,11 @@
   }
 #endif
   if (!frame_is_intra_only(cm)) {
+#if CONFIG_SDP
+    if (is_inter_block(mi_addr, xd->tree_type)) {
+#else
     if (is_inter_block(mi_addr)) {
+#endif
       // TODO(sarahparker): global motion stats need to be handled per-tile
       // to be compatible with tile-based threading.
       update_global_motion_used(mi_addr->mode, bsize, mi_addr, rdc);
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 1a4bddf..d3e093a 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -333,7 +333,12 @@
   txfm_param->tx_size = tx_size;
   txfm_param->lossless = xd->lossless[mbmi->segment_id];
   txfm_param->tx_set_type = av1_get_ext_tx_set_type(
+#if CONFIG_SDP
+      tx_size, is_inter_block(mbmi, xd->tree_type),
+      cm->features.reduced_tx_set_used);
+#else
       tx_size, is_inter_block(mbmi), cm->features.reduced_tx_set_used);
+#endif
 
   txfm_param->bd = xd->bd;
   txfm_param->is_hbd = is_cur_buf_hbd(xd);
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index b3de273..7a24264 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -557,7 +557,11 @@
   const TX_SIZE square_tx_size = txsize_sqr_map[tx_size];
 
   const MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   if (get_ext_tx_types(tx_size, is_inter, reduced_tx_set_used) > 1 &&
       !xd->lossless[xd->mi[0]->segment_id]) {
     const int ext_tx_set =
@@ -1228,7 +1232,11 @@
   const int width = get_txb_wide(tx_size);
   const int height = get_txb_high(tx_size);
   assert(width == (1 << bwl));
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   const LV_MAP_COEFF_COST *txb_costs =
       &coeff_costs->coeff_costs[txs_ctx][plane_type];
   const int eob_multi_size = txsize_log2_minus4[tx_size];
@@ -1379,7 +1387,11 @@
                                  FRAME_COUNTS *counts,
                                  uint8_t allow_update_cdf) {
   MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+  int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   int is_inter = is_inter_block(mbmi);
+#endif
   const int reduced_tx_set_used = cm->features.reduced_tx_set_used;
   FRAME_CONTEXT *fc = xd->tile_ctx;
 #if !CONFIG_ENTROPY_STATS
diff --git a/av1/encoder/interp_search.c b/av1/encoder/interp_search.c
index e38eb11..17322c5 100644
--- a/av1/encoder/interp_search.c
+++ b/av1/encoder/interp_search.c
@@ -324,11 +324,18 @@
   const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
   const int bsl = mi_size_wide_log2[bsize];
   int is_horiz_eq = 0, is_vert_eq = 0;
-
+#if CONFIG_SDP
+  if (above_mbmi && is_inter_block(above_mbmi, xd->tree_type))
+#else
   if (above_mbmi && is_inter_block(above_mbmi))
+#endif
     *af = above_mbmi->interp_filters;
-
+#if CONFIG_SDP
+  if (left_mbmi && is_inter_block(left_mbmi, xd->tree_type))
+    *lf = left_mbmi->interp_filters;
+#else
   if (left_mbmi && is_inter_block(left_mbmi)) *lf = left_mbmi->interp_filters;
+#endif
 
   if (af->as_filters.x_filter != INTERP_INVALID)
     is_horiz_eq = af->as_filters.x_filter == lf->as_filters.x_filter;
@@ -616,7 +623,11 @@
   MB_MODE_INFO *const mbmi = xd->mi[0];
   const int num_planes = av1_num_planes(cm);
   const int is_compound = has_second_ref(mbmi);
+#if CONFIG_SDP
+  assert(is_intrabc_block(mbmi, xd->tree_type) == 0);
+#else
   assert(is_intrabc_block(mbmi) == 0);
+#endif
   for (int ref = 0; ref < 1 + is_compound; ++ref) {
     const struct scale_factors *const sf =
         get_ref_scale_factors_const(cm, mbmi->ref_frame[ref]);
diff --git a/av1/encoder/intra_mode_search.c b/av1/encoder/intra_mode_search.c
index 7ab1caf..07b9bca 100644
--- a/av1/encoder/intra_mode_search.c
+++ b/av1/encoder/intra_mode_search.c
@@ -208,7 +208,11 @@
     int rate_overhead, int64_t best_rd_in, int *rate, RD_STATS *rd_stats,
     int *best_angle_delta, int64_t *best_rd) {
   MB_MODE_INFO *mbmi = x->e_mbd.mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, cpi->td.mb.e_mbd.tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   int this_rate;
   int64_t this_rd;
   RD_STATS tokenonly_rd_stats;
@@ -244,7 +248,11 @@
                                     RD_STATS *rd_stats) {
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   int i, angle_delta, best_angle_delta = 0;
   int64_t this_rd, best_rd_in, rd_cost[2 * (MAX_ANGLE_DELTA + 2)];
 
@@ -434,7 +442,11 @@
   const AV1_COMMON *const cm = &cpi->common;
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   MB_MODE_INFO best_mbmi = *mbmi;
   int64_t best_rd = INT64_MAX, this_rd;
   const ModeCosts *mode_costs = &x->mode_costs;
@@ -984,7 +996,11 @@
                                    PICK_MODE_CONTEXT *ctx) {
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   int64_t best_model_rd = INT64_MAX;
   int is_directional_mode;
   uint8_t directional_mode_skip_mask[INTRA_MODES] = { 0 };
diff --git a/av1/encoder/intra_mode_search_utils.h b/av1/encoder/intra_mode_search_utils.h
index 9793340..0b49dea 100644
--- a/av1/encoder/intra_mode_search_utils.h
+++ b/av1/encoder/intra_mode_search_utils.h
@@ -247,6 +247,7 @@
   const ModeCosts *mode_costs = &x->mode_costs;
   const int use_palette = mbmi->palette_mode_info.palette_size[0] > 0;
   const int use_filter_intra = mbmi->filter_intra_mode_info.use_filter_intra;
+  const MACROBLOCKD *xd = &x->e_mbd;
 #if CONFIG_SDP
   const int use_intrabc = mbmi->use_intrabc[PLANE_TYPE_Y];
 #else
@@ -264,7 +265,6 @@
       cpi->common.features.allow_screen_content_tools, mbmi->sb_type);
 #endif
   if (try_palette && mbmi->mode == DC_PRED) {
-    const MACROBLOCKD *xd = &x->e_mbd;
     const int bsize_ctx = av1_get_palette_bsize_ctx(bsize);
     const int mode_ctx = av1_get_palette_mode_ctx(xd);
     total_rate +=
@@ -320,7 +320,7 @@
     }
   }
 #if CONFIG_SDP
-  if (av1_allow_intrabc(&cpi->common) && mbmi->tree_type != CHROMA_PART)
+  if (av1_allow_intrabc(&cpi->common) && xd->tree_type != CHROMA_PART)
 #else
   if (av1_allow_intrabc(&cpi->common))
 #endif
@@ -411,7 +411,11 @@
   const AV1_COMMON *cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   RD_STATS this_rd_stats;
   int row, col;
   int64_t temp_sse, this_rd;
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index 70cfbf7..8601b55 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -2759,10 +2759,14 @@
   int hstep = INIT_SUBPEL_STEP_SIZE;  // Step size, initialized to 4/8=1/2 pel
   unsigned int besterr = INT_MAX;
   *bestmv = start_mv;
-
+#if CONFIG_SDP
+  const struct scale_factors *const sf =
+      is_intrabc_block(xd->mi[0], xd->tree_type)
+#else
   const struct scale_factors *const sf = is_intrabc_block(xd->mi[0])
-                                             ? &cm->sf_identity
-                                             : xd->block_ref_scale_factors[0];
+#endif
+          ? &cm->sf_identity
+          : xd->block_ref_scale_factors[0];
   const int is_scaled = av1_is_scaled(sf);
   besterr = setup_center_error_facade(
       xd, cm, bestmv, var_params, mv_cost_params, sse1, distortion, is_scaled);
@@ -2843,10 +2847,14 @@
   int hstep = INIT_SUBPEL_STEP_SIZE;  // Step size, initialized to 4/8=1/2 pel
   unsigned int besterr = INT_MAX;
   *bestmv = start_mv;
-
+#if CONFIG_SDP
+  const struct scale_factors *const sf =
+      is_intrabc_block(xd->mi[0], xd->tree_type)
+#else
   const struct scale_factors *const sf = is_intrabc_block(xd->mi[0])
-                                             ? &cm->sf_identity
-                                             : xd->block_ref_scale_factors[0];
+#endif
+          ? &cm->sf_identity
+          : xd->block_ref_scale_factors[0];
   const int is_scaled = av1_is_scaled(sf);
   besterr = setup_center_error_facade(
       xd, cm, bestmv, var_params, mv_cost_params, sse1, distortion, is_scaled);
@@ -2928,10 +2936,14 @@
   int hstep = INIT_SUBPEL_STEP_SIZE;  // Step size, initialized to 4/8=1/2 pel
   unsigned int besterr = INT_MAX;
   *bestmv = start_mv;
-
+#if CONFIG_SDP
+  const struct scale_factors *const sf =
+      is_intrabc_block(xd->mi[0], xd->tree_type)
+#else
   const struct scale_factors *const sf = is_intrabc_block(xd->mi[0])
-                                             ? &cm->sf_identity
-                                             : xd->block_ref_scale_factors[0];
+#endif
+          ? &cm->sf_identity
+          : xd->block_ref_scale_factors[0];
   const int is_scaled = av1_is_scaled(sf);
   besterr = setup_center_error_facade(
       xd, cm, bestmv, var_params, mv_cost_params, sse1, distortion, is_scaled);
@@ -3067,10 +3079,14 @@
   unsigned int besterr = INT_MAX;
 
   *bestmv = start_mv;
-
+#if CONFIG_SDP
+  const struct scale_factors *const sf =
+      is_intrabc_block(xd->mi[0], xd->tree_type)
+#else
   const struct scale_factors *const sf = is_intrabc_block(xd->mi[0])
-                                             ? &cm->sf_identity
-                                             : xd->block_ref_scale_factors[0];
+#endif
+          ? &cm->sf_identity
+          : xd->block_ref_scale_factors[0];
   const int is_scaled = av1_is_scaled(sf);
 
   if (subpel_search_type != USE_2_TAPS_ORIG) {
diff --git a/av1/encoder/mv_prec.c b/av1/encoder/mv_prec.c
index 4dfc6ba..f5250f5 100644
--- a/av1/encoder/mv_prec.c
+++ b/av1/encoder/mv_prec.c
@@ -189,8 +189,11 @@
       cpi->mbmi_ext_info.frame_base +
       get_mi_ext_idx(mi_row, mi_col, cm->mi_params.mi_alloc_bsize,
                      cpi->mbmi_ext_info.stride);
-
+#if CONFIG_SDP
+  if (!is_inter_block(mbmi, SHARED_PART)) {
+#else
   if (!is_inter_block(mbmi)) {
+#endif
     mv_stats->intra_count++;
     return;
   }
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index a65c545..96761d1 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -980,10 +980,7 @@
                              const AV1_COMMON *cm) {
   PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
   mbmi->ref_mv_idx = 0;
-#if CONFIG_SDP
-  if (mbmi->tree_type != CHROMA_PART)
-#endif
-    mbmi->mode = pred_mode;
+  mbmi->mode = pred_mode;
   mbmi->uv_mode = UV_DC_PRED;
   mbmi->ref_frame[0] = ref_frame0;
   mbmi->ref_frame[1] = ref_frame1;
@@ -1602,9 +1599,9 @@
     args.skippable = 1;
     args.rdc = &this_rdc;
 #if CONFIG_SDP
-    if (mi->tree_type != CHROMA_PART) mi->tx_size = intra_tx_size;
+    if (xd->tree_type != CHROMA_PART) mi->tx_size = intra_tx_size;
     av1_foreach_transformed_block_in_plane(
-        xd, bsize, mi->tree_type == CHROMA_PART, estimate_block_intra, &args);
+        xd, bsize, xd->tree_type == CHROMA_PART, estimate_block_intra, &args);
 #else
     mi->tx_size = intra_tx_size;
     av1_foreach_transformed_block_in_plane(xd, bsize, 0, estimate_block_intra,
@@ -2388,8 +2385,11 @@
   mi->mode = best_pickmode.best_mode;
   mi->ref_frame[0] = best_pickmode.best_ref_frame;
   txfm_info->skip_txfm = best_rdc.skip_txfm;
-
+#if CONFIG_SDP
+  if (!is_inter_block(mi, xd->tree_type)) {
+#else
   if (!is_inter_block(mi)) {
+#endif
 #if CONFIG_REMOVE_DUAL_FILTER
     mi->interp_fltr = SWITCHABLE_FILTERS;
 #else
diff --git a/av1/encoder/palette.c b/av1/encoder/palette.c
index ab425c1..62bd43f 100644
--- a/av1/encoder/palette.c
+++ b/av1/encoder/palette.c
@@ -411,7 +411,11 @@
     uint8_t *best_blk_skip, uint8_t *tx_type_map) {
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
+#else
   assert(!is_inter_block(mbmi));
+#endif
   assert(av1_allow_palette(cpi->common.features.allow_screen_content_tools,
                            bsize));
   assert(PALETTE_MAX_SIZE == 8);
@@ -638,12 +642,13 @@
                                     int *skippable) {
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
-  assert(!is_inter_block(mbmi));
 #if CONFIG_SDP
+  assert(!is_inter_block(mbmi, xd->tree_type));
   assert(xd->tree_type != LUMA_PART);
   assert(av1_allow_palette(cpi->common.features.allow_screen_content_tools,
                            mbmi->sb_type[PLANE_TYPE_UV]));
 #else
+  assert(!is_inter_block(mbmi));
   assert(av1_allow_palette(cpi->common.features.allow_screen_content_tools,
                            mbmi->sb_type));
 #endif
diff --git a/av1/encoder/partition_search.c b/av1/encoder/partition_search.c
index b4d9bf3..33e4ff5 100644
--- a/av1/encoder/partition_search.c
+++ b/av1/encoder/partition_search.c
@@ -209,7 +209,11 @@
     for (int x = 0; x < xmis; x++) {
       // consec_zero_mv is in the scale of 8x8 blocks
       const int map_offset = block_index + y * (cm->mi_params.mi_cols >> 1) + x;
+#if CONFIG_SDP
+      if (mi->ref_frame[0] == LAST_FRAME && is_inter_block(mi, SHARED_PART) &&
+#else
       if (mi->ref_frame[0] == LAST_FRAME && is_inter_block(mi) &&
+#endif
           mi->segment_id <= CR_SEGMENT_ID_BOOST2) {
         if (abs(mv.row) < 10 && abs(mv.col) < 10) {
           if (cpi->consec_zero_mv[map_offset] < 255)
@@ -235,7 +239,11 @@
   const int mis = cm->mi_params.mi_stride;
   const int mi_width = mi_size_wide[bsize];
   const int mi_height = mi_size_high[bsize];
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
 
   // Initialize tx_mode and tx_size_search_method
   TxfmSearchParams *txfm_params = &x->txfm_search_params;
@@ -310,7 +318,11 @@
     for (ref = 0; ref < 1 + is_compound; ++ref) {
       const YV12_BUFFER_CONFIG *cfg =
           get_ref_frame_yv12_buf(cm, mbmi->ref_frame[ref]);
+#if CONFIG_SDP
+      assert(IMPLIES(!is_intrabc_block(mbmi, xd->tree_type), cfg));
+#else
       assert(IMPLIES(!is_intrabc_block(mbmi), cfg));
+#endif
       av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
                            xd->block_ref_scale_factors[ref], num_planes);
     }
@@ -348,18 +360,16 @@
   }
 
   if (!dry_run) {
-    if (av1_allow_intrabc(cm) && is_intrabc_block(mbmi)) td->intrabc_used = 1;
 #if CONFIG_SDP
+    if (av1_allow_intrabc(cm) && is_intrabc_block(mbmi, xd->tree_type))
+      td->intrabc_used = 1;
     if (txfm_params->tx_mode_search_type == TX_MODE_SELECT &&
         !xd->lossless[mbmi->segment_id] &&
         mbmi->sb_type[xd->tree_type == CHROMA_PART] > BLOCK_4X4 &&
-#if CONFIG_SDP
         !(is_inter &&
           (mbmi->skip_txfm[xd->tree_type == CHROMA_PART] || seg_skip))) {
 #else
-        !(is_inter && (mbmi->skip_txfm || seg_skip))) {
-#endif
-#else
+    if (av1_allow_intrabc(cm) && is_intrabc_block(mbmi)) td->intrabc_used = 1;
     if (txfm_params->tx_mode_search_type == TX_MODE_SELECT &&
         !xd->lossless[mbmi->segment_id] && mbmi->sb_type > BLOCK_4X4 &&
         !(is_inter && (mbmi->skip_txfm || seg_skip))) {
@@ -455,18 +465,20 @@
     set_txfm_ctxs(tx_size, xd->width, xd->height,
 #if CONFIG_SDP
                   (mbmi->skip_txfm[xd->tree_type == CHROMA_PART] || seg_skip) &&
-                      is_inter_block(mbmi),
+                      is_inter_block(mbmi, xd->tree_type),
                   xd);
 #else
                   (mbmi->skip_txfm || seg_skip) && is_inter_block(mbmi), xd);
 #endif
   }
 
-  if (is_inter_block(mbmi) && !xd->is_chroma_ref && is_cfl_allowed(xd)) {
 #if CONFIG_SDP
+  if (is_inter_block(mbmi, xd->tree_type) && !xd->is_chroma_ref &&
+      is_cfl_allowed(xd)) {
     cfl_store_block(xd, mbmi->sb_type[xd->tree_type == CHROMA_PART],
                     mbmi->tx_size);
 #else
+  if (is_inter_block(mbmi) && !xd->is_chroma_ref && is_cfl_allowed(xd)) {
     cfl_store_block(xd, mbmi->sb_type, mbmi->tx_size);
 #endif
   }
@@ -744,9 +756,6 @@
 
   mbmi = xd->mi[0];
 #if CONFIG_SDP
-  mbmi->tree_type = xd->tree_type;
-#endif
-#if CONFIG_SDP
   mbmi->sb_type[plane_type] = bsize;
   if (xd->tree_type == SHARED_PART) mbmi->sb_type[PLANE_TYPE_UV] = bsize;
 #else
@@ -951,26 +960,38 @@
     }
   }
 #endif
-
+#if CONFIG_SDP
+  if (!is_inter_block(mbmi, xd->tree_type)) {
+#else
   if (!is_inter_block(mbmi)) {
+#endif
     av1_sum_intra_stats(cm, td->counts, xd, mbmi, xd->above_mbmi, xd->left_mbmi,
                         frame_is_intra_only(cm));
   }
 #if CONFIG_SDP
-  if (av1_allow_intrabc(cm) && mbmi->tree_type != CHROMA_PART) {
+  if (av1_allow_intrabc(cm) && xd->tree_type != CHROMA_PART) {
+    update_cdf(fc->intrabc_cdf, is_intrabc_block(mbmi, xd->tree_type), 2);
 #else
   if (av1_allow_intrabc(cm)) {
-#endif
     update_cdf(fc->intrabc_cdf, is_intrabc_block(mbmi), 2);
+#endif
 #if CONFIG_ENTROPY_STATS
+#if CONFIG_SDP
+    ++td->counts->intrabc[is_intrabc_block(mbmi, xd->tree_type)];
+#else
     ++td->counts->intrabc[is_intrabc_block(mbmi)];
+#endif
 #endif  // CONFIG_ENTROPY_STATS
   }
 
   if (frame_is_intra_only(cm) || mbmi->skip_mode) return;
 
   FRAME_COUNTS *const counts = td->counts;
+#if CONFIG_SDP
+  const int inter_block = is_inter_block(mbmi, xd->tree_type);
+#else
   const int inter_block = is_inter_block(mbmi);
+#endif
 
   if (!seg_ref_active) {
 #if CONFIG_ENTROPY_STATS
@@ -1431,7 +1452,11 @@
         // If the segment reference feature is enabled we have only a single
         // reference frame allowed for the segment so exclude it from
         // the reference frame counts used to work out probabilities.
+#if CONFIG_SDP
+        if (is_inter_block(mbmi, xd->tree_type)) {
+#else
         if (is_inter_block(mbmi)) {
+#endif
           av1_collect_neighbors_ref_counts(xd);
           if (cm->current_frame.reference_mode == REFERENCE_MODE_SELECT) {
             if (has_second_ref(mbmi)) {
@@ -1451,7 +1476,11 @@
          cpi->sf.inter_sf.prune_obmc_prob_thresh > 0) ||
         (cm->features.allow_warped_motion &&
          cpi->sf.inter_sf.prune_warped_prob_thresh > 0)) {
+#if CONFIG_SDP
+      const int inter_block = is_inter_block(mbmi, xd->tree_type);
+#else
       const int inter_block = is_inter_block(mbmi);
+#endif
       const int seg_ref_active =
           segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_REF_FRAME);
       if (!seg_ref_active && inter_block) {
@@ -2150,7 +2179,6 @@
   xd->tx_type_map = txfm_info->tx_type_map_;
   xd->tx_type_map_stride = mi_size_wide[bsize];
 #if CONFIG_SDP
-  mbmi->tree_type = xd->tree_type;
   if (xd->tree_type == SHARED_PART) mbmi->sb_type[PLANE_TYPE_UV] = bsize;
 #endif
 #if CONFIG_SDP
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 15b0cc0..a6798cf 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2157,7 +2157,11 @@
     mi_step = mi_size_wide[above_mi[0]->sb_type];
 #endif
     int match_found = 0;
+#if CONFIG_SDP
+    if (is_inter_block(*above_mi, xd->tree_type))
+#else
     if (is_inter_block(*above_mi))
+#endif
       match_found = ref_match_found_in_nb_blocks(*cur_mbmi, *above_mi);
     if (match_found) return 1;
   }
@@ -2183,7 +2187,11 @@
     mi_step = mi_size_high[left_mi[0]->sb_type];
 #endif
     int match_found = 0;
+#if CONFIG_SDP
+    if (is_inter_block(*left_mi, xd->tree_type))
+#else
     if (is_inter_block(*left_mi))
+#endif
       match_found = ref_match_found_in_nb_blocks(*cur_mbmi, *left_mi);
     if (match_found) return 1;
   }
@@ -3400,7 +3408,7 @@
         search_state->best_mbmode.tx_size, xd->width, xd->height,
 #if CONFIG_SDP
         search_state->best_mbmode.skip_txfm[xd->tree_type == CHROMA_PART] &&
-            is_inter_block(mbmi),
+            is_inter_block(mbmi, xd->tree_type),
 #else
         search_state->best_mbmode.skip_txfm && is_inter_block(mbmi),
 #endif
@@ -4445,7 +4453,11 @@
 static INLINE void match_ref_frame(const MB_MODE_INFO *const mbmi,
                                    const MV_REFERENCE_FRAME *ref_frames,
                                    int *const is_ref_match) {
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, SHARED_PART)) {
+#else
   if (is_inter_block(mbmi)) {
+#endif
     is_ref_match[0] |= ref_frames[0] == mbmi->ref_frame[0];
     is_ref_match[1] |= ref_frames[1] == mbmi->ref_frame[0];
     if (has_second_ref(mbmi)) {
@@ -5527,9 +5539,25 @@
   const InterpFilter interp_filter = features->interp_filter;
 #if CONFIG_REMOVE_DUAL_FILTER
   (void)interp_filter;
+#if CONFIG_SDP
+  assert((interp_filter == SWITCHABLE) ||
+         (interp_filter == search_state.best_mbmode.interp_fltr) ||
+         !is_inter_block(&search_state.best_mbmode, xd->tree_type));
+#else
   assert((interp_filter == SWITCHABLE) ||
          (interp_filter == search_state.best_mbmode.interp_fltr) ||
          !is_inter_block(&search_state.best_mbmode));
+#endif
+#else
+#if CONFIG_SDP
+  assert((interp_filter == SWITCHABLE) ||
+         (interp_filter ==
+          search_state.best_mbmode.interp_filters.as_filters.y_filter) ||
+         !is_inter_block(&search_state.best_mbmode, xd->tree_type));
+  assert((interp_filter == SWITCHABLE) ||
+         (interp_filter ==
+          search_state.best_mbmode.interp_filters.as_filters.x_filter) ||
+         !is_inter_block(&search_state.best_mbmode, xd->tree_type));
 #else
   assert((interp_filter == SWITCHABLE) ||
          (interp_filter ==
@@ -5539,6 +5567,7 @@
          (interp_filter ==
           search_state.best_mbmode.interp_filters.as_filters.x_filter) ||
          !is_inter_block(&search_state.best_mbmode));
+#endif
 #endif  // CONFIG_REMOVE_DUAL_FILTER
 
   if (!cpi->rc.is_src_frame_alt_ref && cpi->sf.inter_sf.adaptive_rd_thresh) {
diff --git a/av1/encoder/rdopt_utils.h b/av1/encoder/rdopt_utils.h
index b61f7f5..9e9f77d 100644
--- a/av1/encoder/rdopt_utils.h
+++ b/av1/encoder/rdopt_utils.h
@@ -381,7 +381,11 @@
   const SPEED_FEATURES *sf = &cpi->sf;
 
   // TODO(any): Move block independent condition checks to frame level
+#if CONFIG_SDP
+  if (is_inter_block(mbmi, SHARED_PART)) {
+#else
   if (is_inter_block(mbmi)) {
+#endif
     if (is_inter_mode(best_mode) &&
         sf->tx_sf.tx_type_search.fast_inter_tx_type_search &&
         !cpi->oxcf.txfm_cfg.use_inter_dct_only)
diff --git a/av1/encoder/tx_search.c b/av1/encoder/tx_search.c
index 97ed87a..58165d8 100644
--- a/av1/encoder/tx_search.c
+++ b/av1/encoder/tx_search.c
@@ -485,7 +485,11 @@
   param.is_hbd = is_cur_buf_hbd(xd);
   param.lossless = 0;
   param.tx_set_type = av1_get_ext_tx_set_type(
+#if CONFIG_SDP
+      param.tx_size, is_inter_block(xd->mi[0], xd->tree_type), reduced_tx_set);
+#else
       param.tx_size, is_inter_block(xd->mi[0]), reduced_tx_set);
+#endif
   const int bd_idx = (xd->bd == 8) ? 0 : ((xd->bd == 10) ? 1 : 2);
   const uint32_t max_qcoef_thresh = skip_pred_threshold[bd_idx][bsize];
   const int16_t *src_diff = x->plane[0].src_diff;
@@ -1163,7 +1167,11 @@
   const AV1_COMMON *cm = &cpi->common;
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   if (!is_inter && best_eob &&
       (blk_row + tx_size_high_unit[tx_size] < mi_size_high[plane_bsize] ||
        blk_col + tx_size_wide_unit[tx_size] < mi_size_wide[plane_bsize])) {
@@ -1334,7 +1342,12 @@
   MACROBLOCKD *xd = &x->e_mbd;
   TxfmSearchInfo *txfm_info = &x->txfm_search_info;
   assert(cpi->sf.tx_sf.use_intra_txb_hash &&
+#if CONFIG_SDP
+         frame_is_intra_only(&cpi->common) &&
+         !is_inter_block(xd->mi[0], xd->tree_type) &&
+#else
          frame_is_intra_only(&cpi->common) && !is_inter_block(xd->mi[0]) &&
+#endif
          plane == 0 && tx_size_wide[tx_size] == tx_size_high[tx_size]);
   const uint32_t intra_hash =
       get_intra_txb_hash(x, plane, blk_row, blk_col, plane_bsize, tx_size);
@@ -1985,7 +1998,11 @@
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = xd->mi[0];
   const TxfmSearchParams *txfm_params = &x->txfm_search_params;
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   const int fast_tx_search = ftxs_mode & FTXS_DCT_AND_1D_DCT_ONLY;
   // if txk_allowed = TX_TYPES, >1 tx types are allowed, else, if txk_allowed <
   // TX_TYPES, only that specific tx type is allowed.
@@ -2252,7 +2269,12 @@
   } else if (block_var < var_threshold) {
     // Predict DC only blocks based on residual variance.
     // For chroma plane, this early prediction is disabled for intra blocks.
+#if CONFIG_SDP
+    if ((plane == 0) || (plane > 0 && is_inter_block(mbmi, xd->tree_type)))
+      *dc_only_blk = 1;
+#else
     if ((plane == 0) || (plane > 0 && is_inter_block(mbmi))) *dc_only_blk = 1;
+#endif
   }
 }
 
@@ -2290,7 +2312,11 @@
   // the table and terminate early.
   TXB_RD_INFO *intra_txb_rd_info = NULL;
   uint16_t cur_joint_ctx = 0;
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   const int use_intra_txb_hash =
       cpi->sf.tx_sf.use_intra_txb_hash && frame_is_intra_only(cm) &&
       !is_inter && plane == 0 && tx_size_wide[tx_size] == tx_size_high[tx_size];
@@ -2630,7 +2656,11 @@
   const uint16_t cur_joint_ctx =
       (txb_ctx->dc_sign_ctx << 8) + txb_ctx->txb_skip_ctx;
   MACROBLOCKD *xd = &x->e_mbd;
+#if CONFIG_SDP
+  assert(is_inter_block(xd->mi[0], xd->tree_type));
+#else
   assert(is_inter_block(xd->mi[0]));
+#endif
   const int tx_type_map_idx = blk_row * xd->tx_type_map_stride + blk_col;
   // Look up RD and terminate early in case when we've already processed exactly
   // the same residue with exactly the same entropy context.
@@ -2923,7 +2953,12 @@
   const int skip_txfm_rate = x->mode_costs.skip_txfm_cost[skip_ctx][1];
   // Skip RDcost is used only for Inter blocks
   const int64_t skip_txfm_rd =
+#if CONFIG_SDP
+      is_inter_block(mbmi, xd->tree_type) ? RDCOST(x->rdmult, skip_txfm_rate, 0)
+                                          : INT64_MAX;
+#else
       is_inter_block(mbmi) ? RDCOST(x->rdmult, skip_txfm_rate, 0) : INT64_MAX;
+#endif
   const int64_t no_skip_txfm_rd = RDCOST(x->rdmult, no_skip_txfm_rate, 0);
   const int skip_trellis = 0;
   av1_txfm_rd_in_plane(x, cpi, rd_stats, ref_best_rd,
@@ -2966,9 +3001,14 @@
 
   if (tx_select) {
     start_tx = max_rect_tx_size;
-    init_depth = get_search_init_depth(mi_size_wide[bs], mi_size_high[bs],
-                                       is_inter_block(mbmi), &cpi->sf,
-                                       txfm_params->tx_size_search_method);
+    init_depth =
+        get_search_init_depth(mi_size_wide[bs], mi_size_high[bs],
+#if CONFIG_SDP
+                              is_inter_block(mbmi, xd->tree_type), &cpi->sf,
+#else
+                              is_inter_block(mbmi), &cpi->sf,
+#endif
+                              txfm_params->tx_size_search_method);
   } else {
     const TX_SIZE chosen_tx_size =
         tx_size_from_tx_mode(bs, txfm_params->tx_mode_search_type);
@@ -3031,7 +3071,11 @@
 
   MACROBLOCK *const x = args->x;
   MACROBLOCKD *const xd = &x->e_mbd;
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(xd->mi[0], xd->tree_type);
+#else
   const int is_inter = is_inter_block(xd->mi[0]);
+#endif
   const AV1_COMP *cpi = args->cpi;
   ENTROPY_CONTEXT *a = args->t_above + blk_col;
   ENTROPY_CONTEXT *l = args->t_left + blk_row;
@@ -3102,11 +3146,12 @@
   MB_MODE_INFO *const mbmi = xd->mi[0];
   const TxfmSearchParams *txfm_params = &x->txfm_search_params;
   const ModeCosts *mode_costs = &x->mode_costs;
-  const int is_inter = is_inter_block(mbmi);
 #if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
   const int tx_select = txfm_params->tx_mode_search_type == TX_MODE_SELECT &&
                         block_signals_txsize(mbmi->sb_type[PLANE_TYPE_Y]);
 #else
+  const int is_inter = is_inter_block(mbmi);
   const int tx_select = txfm_params->tx_mode_search_type == TX_MODE_SELECT &&
                         block_signals_txsize(mbmi->sb_type);
 #endif
@@ -3177,7 +3222,11 @@
   assert(tx_size < TX_SIZES_ALL);
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
+#if CONFIG_SDP
+  assert(is_inter_block(mbmi, xd->tree_type));
+#else
   assert(is_inter_block(mbmi));
+#endif
   const int max_blocks_high = max_block_high(xd, plane_bsize, 0);
   const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
 
@@ -3346,7 +3395,11 @@
                                        TXB_RD_INFO_NODE *rd_info_tree) {
   MACROBLOCKD *const xd = &x->e_mbd;
   const TxfmSearchParams *txfm_params = &x->txfm_search_params;
+#if CONFIG_SDP
+  assert(is_inter_block(xd->mi[0], xd->tree_type));
+#else
   assert(is_inter_block(xd->mi[0]));
+#endif
   assert(bsize < BLOCK_SIZES_ALL);
   const int fast_tx_search = txfm_params->tx_size_search_method > USE_FULL_RD;
   int64_t rd_thresh = ref_best_rd;
@@ -3462,7 +3515,11 @@
                                          int64_t ref_best_rd) {
   MACROBLOCKD *const xd = &x->e_mbd;
   const TxfmSearchParams *txfm_params = &x->txfm_search_params;
+#if CONFIG_SDP
+  assert(is_inter_block(xd->mi[0], xd->tree_type));
+#else
   assert(is_inter_block(xd->mi[0]));
+#endif
 
   av1_invalid_rd_stats(rd_stats);
 
@@ -3551,10 +3608,11 @@
   const TxfmSearchParams *tx_params = &x->txfm_search_params;
 #if CONFIG_SDP
   assert(bs == mbmi->sb_type[PLANE_TYPE_Y]);
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
 #else
   assert(bs == mbmi->sb_type);
-#endif
   const int is_inter = is_inter_block(mbmi);
+#endif
   const int mi_row = xd->mi_row;
   const int mi_col = xd->mi_col;
 
@@ -3624,7 +3682,11 @@
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = xd->mi[0];
   struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_U];
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   int64_t this_rd = 0, skip_txfm_rd = 0;
   const BLOCK_SIZE plane_bsize =
       get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
@@ -3706,7 +3768,11 @@
                                          &args);
 
   MB_MODE_INFO *const mbmi = xd->mi[0];
+#if CONFIG_SDP
+  const int is_inter = is_inter_block(mbmi, xd->tree_type);
+#else
   const int is_inter = is_inter_block(mbmi);
+#endif
   const int invalid_rd = is_inter ? args.incomplete_exit : args.exit_early;
 
   if (invalid_rd) {