Bugfix for SDP when multiple tiles are applied
This commit fixes the bug when multiple-tile encoding are employed. tree_type is a super block level parameter, it can be luma_part or chroma_part or shared_part. When SDP is enabled, encoder will loop luma_part and chroma_part for each super block. But previously, this variable tree_type was mistakenly added to AV1_COMMON struct.
The compiling flag CONFIG_SDP is turned off by default in this CL.
Change-Id: Ia05424455fd7583a5eb059ead46dd55a4563452b
(cherry picked from commit 3af1f7b6353b81e2684e0496099c29938f4eab1f)
diff --git a/av1/common/av1_common_int.h b/av1/common/av1_common_int.h
index c28bba4..d1e067e 100644
--- a/av1/common/av1_common_int.h
+++ b/av1/common/av1_common_int.h
@@ -813,13 +813,6 @@
* is being decoded.
*/
uint32_t frame_presentation_time;
-#if CONFIG_SDP
- /*!
- * tree_type specifies whether luma and chroma component in one super block
- * shares the same tree or not.
- */
- TREE_TYPE tree_type;
-#endif
/*!
* Buffer where previous frame is stored.
@@ -1264,13 +1257,7 @@
void cfl_init(CFL_CTX *cfl, const SequenceHeader *seq_params);
static INLINE int av1_num_planes(const AV1_COMMON *cm) {
-#if CONFIG_SDP
- return (cm->seq_params.monochrome || cm->tree_type == LUMA_PART)
- ? 1
- : MAX_MB_PLANE;
-#else
return cm->seq_params.monochrome ? 1 : MAX_MB_PLANE;
-#endif
}
static INLINE void av1_init_above_context(CommonContexts *above_contexts,
@@ -1888,6 +1875,9 @@
// Compute the next partition in the direction of the sb_type stored in the mi
// array, starting with bsize.
static INLINE PARTITION_TYPE get_partition(const AV1_COMMON *const cm,
+#if CONFIG_SDP
+ const int plane_type,
+#endif
int mi_row, int mi_col,
BLOCK_SIZE bsize) {
const CommonModeInfoParams *const mi_params = &cm->mi_params;
@@ -1897,7 +1887,6 @@
const int offset = mi_row * mi_params->mi_stride + mi_col;
MB_MODE_INFO **mi = mi_params->mi_grid_base + offset;
#if CONFIG_SDP
- const int plane_type = cm->tree_type == CHROMA_PART;
const BLOCK_SIZE subsize = mi[0]->sb_type[plane_type];
#else
const BLOCK_SIZE subsize = mi[0]->sb_type;
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c
index f913f1a..3f683fe 100644
--- a/av1/common/av1_loopfilter.c
+++ b/av1/common/av1_loopfilter.c
@@ -195,7 +195,7 @@
assert(mbmi != NULL);
if (xd && xd->lossless[mbmi->segment_id]) return TX_4X4;
#if CONFIG_SDP
- const int plane_type = (mbmi->tree_type == CHROMA_PART);
+ const int plane_type = (plane > 0);
#endif
TX_SIZE tx_size = (plane == AOM_PLANE_Y)
? mbmi->tx_size
@@ -294,7 +294,7 @@
av1_get_filter_level(cm, &cm->lf_info, edge_dir, plane, mbmi);
#if CONFIG_SDP
const int curr_skipped =
- mbmi->skip_txfm[cm->tree_type == CHROMA_PART] && is_inter_block(mbmi);
+ mbmi->skip_txfm[plane > 0] && is_inter_block(mbmi);
#else
const int curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi);
#endif
@@ -315,15 +315,14 @@
const int pv_skip_txfm =
#if CONFIG_SDP
- mi_prev->skip_txfm[cm->tree_type == CHROMA_PART] &&
- is_inter_block(mi_prev);
+ mi_prev->skip_txfm[plane > 0] && is_inter_block(mi_prev);
#else
mi_prev->skip_txfm && is_inter_block(mi_prev);
#endif
#if CONFIG_SDP
const BLOCK_SIZE bsize = get_plane_block_size(
- mbmi->sb_type[cm->tree_type == CHROMA_PART],
- plane_ptr->subsampling_x, plane_ptr->subsampling_y);
+ mbmi->sb_type[plane > 0], plane_ptr->subsampling_x,
+ plane_ptr->subsampling_y);
#else
const BLOCK_SIZE bsize =
get_plane_block_size(mbmi->sb_type, plane_ptr->subsampling_x,
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 6f43aa0..80b72ce 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -292,7 +292,8 @@
static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) {
#if CONFIG_SDP
- return mbmi->use_intrabc[mbmi->tree_type != CHROMA_PART ? 0 : 1];
+ const int plane_type = (mbmi->tree_type == CHROMA_PART);
+ return mbmi->use_intrabc[plane_type];
#else
return mbmi->use_intrabc;
#endif
diff --git a/av1/common/reconintra.h b/av1/common/reconintra.h
index a3ecbdd..33780c5 100644
--- a/av1/common/reconintra.h
+++ b/av1/common/reconintra.h
@@ -54,13 +54,8 @@
}
static INLINE int av1_allow_intrabc(const AV1_COMMON *const cm) {
-#if CONFIG_SDP
- return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
- cm->features.allow_intrabc && cm->tree_type != CHROMA_PART;
-#else
return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
cm->features.allow_intrabc;
-#endif
}
static INLINE int av1_filter_intra_allowed_bsize(const AV1_COMMON *const cm,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index e94c8d3..d1ad838 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -159,7 +159,7 @@
const int plane, const int row, const int col, const TX_SIZE tx_size) {
MB_MODE_INFO *mbmi = dcb->xd.mi[0];
#if CONFIG_SDP
- if (!mbmi->skip_txfm[cm->tree_type == CHROMA_PART]) {
+ if (!mbmi->skip_txfm[dcb->xd.tree_type == CHROMA_PART]) {
#else
if (!mbmi->skip_txfm) {
#endif
@@ -950,12 +950,20 @@
static AOM_INLINE void decode_token_recon_block(AV1Decoder *const pbi,
ThreadData *const td,
aom_reader *r,
+#if CONFIG_SDP
+ PARTITION_TYPE partition,
+#endif
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &pbi->common;
DecoderCodingBlock *const dcb = &td->dcb;
MACROBLOCKD *const xd = &dcb->xd;
const int num_planes = av1_num_planes(cm);
MB_MODE_INFO *mbmi = xd->mi[0];
+#if CONFIG_SDP
+ 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)) {
int row, col;
@@ -972,8 +980,7 @@
for (row = 0; row < max_blocks_high; row += mu_blocks_high) {
for (col = 0; col < max_blocks_wide; col += mu_blocks_wide) {
#if CONFIG_SDP
- for (int plane = (cm->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
@@ -1028,7 +1035,11 @@
for (row = 0; row < max_blocks_high; row += mu_blocks_high) {
for (col = 0; col < max_blocks_wide; col += mu_blocks_wide) {
+#if CONFIG_SDP
+ for (int plane = plane_start; plane < plane_end; ++plane) {
+#else
for (int plane = 0; plane < num_planes; ++plane) {
+#endif
if (plane && !xd->is_chroma_ref) break;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int ss_x = pd->subsampling_x;
@@ -1243,7 +1254,7 @@
MB_MODE_INFO *mbmi = xd->mi[0];
int inter_block_tx = is_inter_block(mbmi) || is_intrabc_block(mbmi);
#if CONFIG_SDP
- if (cm->tree_type != CHROMA_PART) {
+ if (xd->tree_type != CHROMA_PART) {
#endif
if (cm->features.tx_mode == TX_MODE_SELECT && block_signals_txsize(bsize) &&
#if CONFIG_SDP
@@ -1341,8 +1352,11 @@
#else
if (mbmi->skip_txfm) av1_reset_entropy_context(xd, bsize, num_planes);
#endif
-
+#if CONFIG_SDP
+ decode_token_recon_block(pbi, td, r, partition, bsize);
+#else
decode_token_recon_block(pbi, td, r, bsize);
+#endif
#if CONFIG_SDP
if (xd->tree_type != SHARED_PART) {
@@ -1424,7 +1438,11 @@
BLOCK_SIZE bsize) {
(void)partition;
set_offsets_for_pred_and_recon(pbi, td, mi_row, mi_col, bsize);
+#if CONFIG_SDP
+ decode_token_recon_block(pbi, td, r, partition, bsize);
+#else
decode_token_recon_block(pbi, td, r, bsize);
+#endif
}
#if CONFIG_SDP
@@ -1503,10 +1521,6 @@
if (mi_row >= cm->mi_params.mi_rows || mi_col >= cm->mi_params.mi_cols)
return;
-#if CONFIG_SDP
- xd->tree_type = cm->tree_type;
-#endif
-
// parse_decode_flag takes the following values :
// 01 - do parse only
// 10 - do decode only
@@ -1518,8 +1532,9 @@
if (parse_decode_flag & 1) {
const int num_planes = av1_num_planes(cm);
#if CONFIG_SDP
- for (int plane = (cm->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
@@ -1546,7 +1561,12 @@
has_rows, has_cols, bsize);
#endif
} else {
+#if CONFIG_SDP
+ partition =
+ get_partition(cm, xd->tree_type == CHROMA_PART, mi_row, mi_col, bsize);
+#else
partition = get_partition(cm, mi_row, mi_col, bsize);
+#endif
}
subsize = get_partition_subsize(bsize, partition);
if (subsize == BLOCK_INVALID) {
@@ -2832,8 +2852,24 @@
sync_read(&tile_data->dec_row_mt_sync, sb_row_in_tile, sb_col_in_tile);
// Decoding of the super-block
+#if CONFIG_SDP
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
+ int totalLoopNum =
+ (frame_is_intra_only(cm) && !cm->seq_params.monochrome) ? 2 : 1;
+ xd->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x2);
+ if (totalLoopNum == 2) {
+ xd->tree_type = CHROMA_PART;
+ decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
+ cm->seq_params.sb_size, 0x2);
+ xd->tree_type = SHARED_PART;
+ }
+#else
+ decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
+ cm->seq_params.sb_size, 0x2);
+#endif
sync_write(&tile_data->dec_row_mt_sync, sb_row_in_tile, sb_col_in_tile,
sb_cols_in_tile);
@@ -2912,15 +2948,14 @@
#if CONFIG_SDP
int totalLoopNum =
(frame_is_intra_only(cm) && !cm->seq_params.monochrome) ? 2 : 1;
- cm->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
+ xd->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x3);
if (totalLoopNum == 2) {
- cm->tree_type = CHROMA_PART;
+ xd->tree_type = CHROMA_PART;
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x3);
- cm->tree_type = SHARED_PART;
- xd->tree_type = cm->tree_type;
+ xd->tree_type = SHARED_PART;
}
#else
// Bit-stream parsing and decoding of the superblock
@@ -3361,8 +3396,22 @@
set_cb_buffer(pbi, dcb, pbi->cb_buffer_base, num_planes, mi_row, mi_col);
// Bit-stream parsing of the superblock
+#if CONFIG_SDP
+ int totalLoopNum =
+ (frame_is_intra_only(cm) && !cm->seq_params.monochrome) ? 2 : 1;
+ xd->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x1);
+ if (totalLoopNum == 2) {
+ xd->tree_type = CHROMA_PART;
+ decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
+ cm->seq_params.sb_size, 0x1);
+ xd->tree_type = SHARED_PART;
+ }
+#else
+ decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
+ cm->seq_params.sb_size, 0x1);
+#endif
if (aom_reader_has_overflowed(td->bit_reader)) {
aom_merge_corrupted_flag(&dcb->corrupted, 1);
@@ -5361,7 +5410,11 @@
(uint32_t)aom_rb_bytes_read(rb); // Size of the uncompressed header
YV12_BUFFER_CONFIG *new_fb = &cm->cur_frame->buf;
xd->cur_buf = new_fb;
+#if CONFIG_SDP
+ if (av1_allow_intrabc(cm) && xd->tree_type != CHROMA_PART) {
+#else
if (av1_allow_intrabc(cm)) {
+#endif
av1_setup_scale_factors_for_frame(
&cm->sf_identity, xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height,
xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index bcb87b7..761ca3b 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -89,7 +89,7 @@
aom_reader *r, MB_MODE_INFO *const mbmi) {
int sign, abs, reduced_delta_qindex = 0;
#if CONFIG_SDP
- BLOCK_SIZE bsize = mbmi->sb_type[cm->tree_type == CHROMA_PART];
+ BLOCK_SIZE bsize = mbmi->sb_type[xd->tree_type == CHROMA_PART];
#else
BLOCK_SIZE bsize = mbmi->sb_type;
#endif
@@ -129,7 +129,8 @@
int mi_row) {
int reduced_delta_lflevel = 0;
#if CONFIG_SDP
- const BLOCK_SIZE bsize = mbmi->sb_type[cm->tree_type == CHROMA_PART];
+ const int plane_type = (mbmi->tree_type == CHROMA_PART);
+ const BLOCK_SIZE bsize = mbmi->sb_type[plane_type];
#else
const BLOCK_SIZE bsize = mbmi->sb_type;
#endif
@@ -137,8 +138,7 @@
const int b_row = mi_row & (cm->seq_params.mib_size - 1);
const int read_delta_lf_flag = (b_col == 0 && b_row == 0);
#if CONFIG_SDP
- if ((bsize != cm->seq_params.sb_size ||
- mbmi->skip_txfm[cm->tree_type != CHROMA_PART ? 0 : 1] == 0) &&
+ if ((bsize != cm->seq_params.sb_size || mbmi->skip_txfm[plane_type] == 0) &&
#else
if ((bsize != cm->seq_params.sb_size || mbmi->skip_txfm == 0) &&
#endif
@@ -634,7 +634,12 @@
read_palette_colors_y(xd, cm->seq_params.bit_depth, pmi, r);
}
}
+#if CONFIG_SDP
+ if (num_planes > 1 && xd->tree_type != LUMA_PART &&
+ mbmi->uv_mode == UV_DC_PRED && xd->is_chroma_ref) {
+#else
if (num_planes > 1 && mbmi->uv_mode == UV_DC_PRED && xd->is_chroma_ref) {
+#endif
const int palette_uv_mode_ctx = (pmi->palette_size[0] > 0);
const int modev = aom_read_symbol(
r, xd->tile_ctx->palette_uv_mode_cdf[palette_uv_mode_ctx], 2, ACCT_STR);
@@ -659,7 +664,7 @@
FILTER_INTRA_MODE_INFO *filter_intra_mode_info =
&mbmi->filter_intra_mode_info;
#if CONFIG_SDP
- if (av1_filter_intra_allowed(cm, mbmi) && cm->tree_type != CHROMA_PART) {
+ if (av1_filter_intra_allowed(cm, mbmi) && xd->tree_type != CHROMA_PART) {
#else
if (av1_filter_intra_allowed(cm, mbmi)) {
#endif
@@ -904,15 +909,18 @@
xd->above_txfm_context = cm->above_contexts.txfm[xd->tile.tile_row] + mi_col;
xd->left_txfm_context =
xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
-
+#if CONFIG_SDP
+ if (av1_allow_intrabc(cm) && xd->tree_type != CHROMA_PART) {
+#else
if (av1_allow_intrabc(cm)) {
+#endif
read_intrabc_info(cm, dcb, r);
if (is_intrabc_block(mbmi)) return;
}
const int use_angle_delta = av1_use_angle_delta(bsize);
#if CONFIG_SDP
- if (cm->tree_type != CHROMA_PART) {
+ if (xd->tree_type != CHROMA_PART) {
mbmi->mode = read_intra_mode(r, get_y_mode_cdf(ec_ctx, above_mi, left_mi));
mbmi->angle_delta[PLANE_TYPE_Y] =
(use_angle_delta && av1_is_directional_mode(mbmi->mode))
@@ -928,7 +936,7 @@
: 0;
#endif
#if CONFIG_SDP
- if (cm->tree_type != LUMA_PART) {
+ if (xd->tree_type != LUMA_PART) {
#endif
if (!cm->seq_params.monochrome && xd->is_chroma_ref) {
mbmi->uv_mode =
@@ -1262,7 +1270,7 @@
mbmi->uv_mode = UV_DC_PRED;
}
#if CONFIG_SDP
- if (cm->tree_type != LUMA_PART)
+ if (xd->tree_type != LUMA_PART)
#endif
xd->cfl.store_y = store_cfl_required(cm, xd);
#if CONFIG_SDP
@@ -1691,7 +1699,7 @@
}
}
#if CONFIG_SDP
- if (cm->tree_type != LUMA_PART)
+ if (xd->tree_type != LUMA_PART)
#endif
xd->cfl.store_y = store_cfl_required(cm, xd);
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index ff77f3c..347f064 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -255,8 +255,11 @@
aom_reader *r, palette_visitor_fn_t visit) {
if (!is_inter_block(xd->mi[0])) {
#if CONFIG_SDP
- for (int plane = (xd->tree_type == CHROMA_PART);
- plane < AOMMIN(2, av1_num_planes(&pbi->common)); ++plane) {
+ 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
for (int plane = 0; plane < AOMMIN(2, av1_num_planes(&pbi->common));
++plane) {
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a05c320..a07b973 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -652,7 +652,7 @@
const AV1_COMMON *cm, const MACROBLOCKD *xd, const MB_MODE_INFO *const mbmi,
aom_writer *w) {
#if CONFIG_SDP
- if (av1_filter_intra_allowed(cm, mbmi) && cm->tree_type != CHROMA_PART) {
+ if (av1_filter_intra_allowed(cm, mbmi) && xd->tree_type != CHROMA_PART) {
#else
if (av1_filter_intra_allowed(cm, mbmi)) {
#endif
@@ -869,7 +869,12 @@
}
const int uv_dc_pred =
+#if CONFIG_SDP
+ num_planes > 1 && xd->tree_type != LUMA_PART &&
+ mbmi->uv_mode == UV_DC_PRED && xd->is_chroma_ref;
+#else
num_planes > 1 && mbmi->uv_mode == UV_DC_PRED && xd->is_chroma_ref;
+#endif
if (uv_dc_pred) {
const int n = pmi->palette_size[1];
const int palette_uv_mode_ctx = (pmi->palette_size[0] > 0);
@@ -1111,7 +1116,7 @@
// Y mode.
#if CONFIG_SDP
const int use_angle_delta = av1_use_angle_delta(bsize);
- if (cm->tree_type != CHROMA_PART) {
+ if (xd->tree_type != CHROMA_PART) {
#endif
if (is_keyframe) {
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
@@ -1141,7 +1146,7 @@
// UV mode and UV angle delta.
#if CONFIG_SDP
if (!cm->seq_params.monochrome && xd->is_chroma_ref &&
- cm->tree_type != LUMA_PART) {
+ xd->tree_type != LUMA_PART) {
#else
if (!cm->seq_params.monochrome && xd->is_chroma_ref) {
#endif
@@ -1425,7 +1430,11 @@
write_delta_q_params(cpi, skip, w);
+#if CONFIG_SDP
+ if (av1_allow_intrabc(cm) && xd->tree_type != CHROMA_PART) {
+#else
if (av1_allow_intrabc(cm)) {
+#endif
write_intrabc_info(xd, mbmi_ext_frame, w);
if (is_intrabc_block(mbmi)) return;
}
@@ -1634,7 +1643,13 @@
const int num_planes = av1_num_planes(cm);
for (int row = 0; row < num_4x4_h; row += mu_blocks_high) {
for (int col = 0; col < num_4x4_w; col += mu_blocks_wide) {
+#if CONFIG_SDP
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
+#else
for (int plane = 0; plane < num_planes; ++plane) {
+#endif
if (plane && !xd->is_chroma_ref) break;
write_inter_txb_coeff(cm, x, mbmi, w, tok, tok_end, &token_stats, row,
col, &block[plane], plane);
@@ -1701,8 +1716,10 @@
write_mbmi_b(cpi, w);
#if CONFIG_SDP
- for (int plane = (cm->tree_type == CHROMA_PART);
- plane < AOMMIN(2, av1_num_planes(cm)); ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end =
+ (xd->tree_type == LUMA_PART ? 1 : AOMMIN(2, av1_num_planes(cm)));
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < AOMMIN(2, av1_num_planes(cm)); ++plane) {
#endif
@@ -1743,7 +1760,7 @@
#endif
const int segment_id = mbmi->segment_id;
#if CONFIG_SDP
- if (cm->tree_type != CHROMA_PART) {
+ if (xd->tree_type != CHROMA_PART) {
#endif
if (cm->features.tx_mode == TX_MODE_SELECT && block_signals_txsize(bsize) &&
!(is_inter_tx && skip_txfm) && !xd->lossless[segment_id]) {
@@ -1860,16 +1877,21 @@
const int hbs = mi_size_wide[bsize] / 2;
const int quarter_step = mi_size_wide[bsize] / 4;
int i;
+#if CONFIG_SDP
+ const PARTITION_TYPE partition =
+ get_partition(cm, xd->tree_type == CHROMA_PART, mi_row, mi_col, bsize);
+#else
const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
+#endif
const BLOCK_SIZE subsize = get_partition_subsize(bsize, partition);
if (mi_row >= mi_params->mi_rows || mi_col >= mi_params->mi_cols) return;
const int num_planes = av1_num_planes(cm);
#if CONFIG_SDP
- xd->tree_type = cm->tree_type;
- for (int plane = (cm->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
@@ -1993,17 +2015,16 @@
#if CONFIG_SDP
int totalLoopNum =
(frame_is_intra_only(cm) && !cm->seq_params.monochrome) ? 2 : 1;
- cm->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
+ xd->tree_type = (totalLoopNum == 1 ? SHARED_PART : LUMA_PART);
#endif
write_modes_sb(cpi, tile, w, &tok, tok_end, mi_row, mi_col,
cm->seq_params.sb_size);
#if CONFIG_SDP
if (totalLoopNum == 2) {
- cm->tree_type = CHROMA_PART;
+ xd->tree_type = CHROMA_PART;
write_modes_sb(cpi, tile, w, &tok, tok_end, mi_row, mi_col,
cm->seq_params.sb_size);
- cm->tree_type = SHARED_PART;
- xd->tree_type = cm->tree_type;
+ xd->tree_type = SHARED_PART;
}
#endif
}
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index c537461..9818ae1 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -482,14 +482,22 @@
av1_set_offsets(cpi, tile_info, x, mi_row, mi_col, sb_size);
const BLOCK_SIZE bsize =
seg_skip ? sb_size : sf->part_sf.fixed_partition_size;
+#if CONFIG_SDP
+ av1_set_fixed_partitioning(cpi, tile_info, x, mi, mi_row, mi_col, bsize);
+#else
av1_set_fixed_partitioning(cpi, tile_info, mi, mi_row, mi_col, bsize);
+#endif
} else if (cpi->partition_search_skippable_frame) {
// set a fixed-size partition for which the size is determined by the source
// variance
av1_set_offsets(cpi, tile_info, x, mi_row, mi_col, sb_size);
const BLOCK_SIZE bsize =
get_rd_var_based_fixed_partition(cpi, x, mi_row, mi_col);
+#if CONFIG_SDP
+ av1_set_fixed_partitioning(cpi, tile_info, x, mi, mi_row, mi_col, bsize);
+#else
av1_set_fixed_partitioning(cpi, tile_info, mi, mi_row, mi_col, bsize);
+#endif
} else if (sf->part_sf.partition_search_type == VAR_BASED_PARTITION) {
// set a variance-based partition
av1_set_offsets_without_segment_id(cpi, tile_info, x, mi_row, mi_col,
@@ -510,15 +518,13 @@
(frame_is_intra_only(cm) && !cm->seq_params.monochrome) ? 2 : 1;
MACROBLOCKD *const xd = &x->e_mbd;
for (int loopIdx = 0; loopIdx < totalLoopNum; loopIdx++) {
- cm->tree_type =
+ xd->tree_type =
(totalLoopNum == 1 ? SHARED_PART
: (loopIdx == 0 ? LUMA_PART : CHROMA_PART));
- xd->tree_type = cm->tree_type;
- td->mb.cb_offset[cm->tree_type == CHROMA_PART] = 0;
+ td->mb.cb_offset[xd->tree_type == CHROMA_PART] = 0;
av1_nonrd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, sb_size,
pc_root);
}
- cm->tree_type = SHARED_PART;
xd->tree_type = SHARED_PART;
#else
av1_nonrd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, sb_size,
@@ -619,10 +625,9 @@
#if CONFIG_SDP
for (int loopIdx = 0; loopIdx < totalLoopNum; loopIdx++) {
- cm->tree_type =
+ xd->tree_type =
(totalLoopNum == 1 ? SHARED_PART
: (loopIdx == 0 ? LUMA_PART : CHROMA_PART));
- xd->tree_type = cm->tree_type;
int num_planes = av1_num_planes(cm);
#endif
init_encode_rd_sb(cpi, td, tile_data, sms_root, &dummy_rdc, mi_row, mi_col,
@@ -645,7 +650,11 @@
av1_set_offsets(cpi, tile_info, x, mi_row, mi_col, sb_size);
const BLOCK_SIZE bsize =
seg_skip ? sb_size : sf->part_sf.fixed_partition_size;
+#if CONFIG_SDP
+ av1_set_fixed_partitioning(cpi, tile_info, x, mi, mi_row, mi_col, bsize);
+#else
av1_set_fixed_partitioning(cpi, tile_info, mi, mi_row, mi_col, bsize);
+#endif
PC_TREE *const pc_root = av1_alloc_pc_tree_node(sb_size);
av1_rd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, sb_size,
&dummy_rate, &dummy_dist, 1, pc_root);
@@ -656,7 +665,11 @@
av1_set_offsets(cpi, tile_info, x, mi_row, mi_col, sb_size);
const BLOCK_SIZE bsize =
get_rd_var_based_fixed_partition(cpi, x, mi_row, mi_col);
+#if CONFIG_SDP
+ av1_set_fixed_partitioning(cpi, tile_info, x, mi, mi_row, mi_col, bsize);
+#else
av1_set_fixed_partitioning(cpi, tile_info, mi, mi_row, mi_col, bsize);
+#endif
PC_TREE *const pc_root = av1_alloc_pc_tree_node(sb_size);
av1_rd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, sb_size,
&dummy_rate, &dummy_dist, 1, pc_root);
@@ -722,7 +735,6 @@
}
#endif
#if CONFIG_SDP
- cm->tree_type = SHARED_PART;
xd->tree_type = SHARED_PART;
#endif
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c
index 5546ff6..d716db9 100644
--- a/av1/encoder/encodeframe_utils.c
+++ b/av1/encoder/encodeframe_utils.c
@@ -730,6 +730,9 @@
}
static void set_partial_sb_partition(const AV1_COMMON *const cm,
+#if CONFIG_SDP
+ MACROBLOCKD *const xd,
+#endif
MB_MODE_INFO *mi, int bh_in, int bw_in,
int mi_rows_remaining,
int mi_cols_remaining, BLOCK_SIZE bsize,
@@ -743,7 +746,7 @@
const int mi_index = get_alloc_mi_idx(&cm->mi_params, r, c);
mib[grid_index] = mi + mi_index;
#if CONFIG_SDP
- mib[grid_index]->sb_type[cm->tree_type == CHROMA_PART] =
+ mib[grid_index]->sb_type[xd->tree_type == CHROMA_PART] =
find_partition_size(bsize, mi_rows_remaining - r,
mi_cols_remaining - c, &bh, &bw);
#else
@@ -760,6 +763,9 @@
// may not be allowed in which case this code attempts to choose the largest
// allowable partition.
void av1_set_fixed_partitioning(AV1_COMP *cpi, const TileInfo *const tile,
+#if CONFIG_SDP
+ MACROBLOCK *const x,
+#endif
MB_MODE_INFO **mib, int mi_row, int mi_col,
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &cpi->common;
@@ -771,6 +777,10 @@
int bh = mi_size_high[bsize];
int bw = mi_size_wide[bsize];
+#if CONFIG_SDP
+ MACROBLOCKD *const xd = &x->e_mbd;
+#endif
+
assert(bsize >= mi_params->mi_alloc_bsize &&
"Attempted to use bsize < mi_params->mi_alloc_bsize");
assert((mi_rows_remaining > 0) && (mi_cols_remaining > 0));
@@ -786,7 +796,7 @@
const int mi_index = get_alloc_mi_idx(mi_params, block_row, block_col);
mib[grid_index] = mi_upper_left + mi_index;
#if CONFIG_SDP
- mib[grid_index]->sb_type[cm->tree_type == CHROMA_PART] = bsize;
+ mib[grid_index]->sb_type[xd->tree_type == CHROMA_PART] = bsize;
#else
mib[grid_index]->sb_type = bsize;
#endif
@@ -794,12 +804,20 @@
}
} else {
// Else this is a partial SB.
+#if CONFIG_SDP
+ set_partial_sb_partition(cm, xd, mi_upper_left, bh, bw, mi_rows_remaining,
+#else
set_partial_sb_partition(cm, mi_upper_left, bh, bw, mi_rows_remaining,
+#endif
mi_cols_remaining, bsize, mib);
}
}
-
+#if CONFIG_SDP
+int av1_is_leaf_split_partition(AV1_COMMON *cm, MACROBLOCKD *const xd,
+ int mi_row, int mi_col,
+#else
int av1_is_leaf_split_partition(AV1_COMMON *cm, int mi_row, int mi_col,
+#endif
BLOCK_SIZE bsize) {
const int bs = mi_size_wide[bsize];
const int hbs = bs / 2;
@@ -812,7 +830,12 @@
if ((mi_row + y_idx >= cm->mi_params.mi_rows) ||
(mi_col + x_idx >= cm->mi_params.mi_cols))
return 0;
+#if CONFIG_SDP
+ if (get_partition(cm, xd->tree_type == CHROMA_PART, mi_row + y_idx,
+ mi_col + x_idx, subsize) !=
+#else
if (get_partition(cm, mi_row + y_idx, mi_col + x_idx, subsize) !=
+#endif
PARTITION_NONE &&
subsize != BLOCK_8X8)
return 0;
@@ -1457,7 +1480,11 @@
if (mi_col != tile_info->mi_col_start) break;
AOM_FALLTHROUGH_INTENDED;
case COST_UPD_SB: // SB level
+#if CONFIG_SDP
+ av1_fill_mode_rates(cm, xd, &x->mode_costs, xd->tile_ctx);
+#else
av1_fill_mode_rates(cm, &x->mode_costs, xd->tile_ctx);
+#endif
break;
default: assert(0);
}
diff --git a/av1/encoder/encodeframe_utils.h b/av1/encoder/encodeframe_utils.h
index 20927f5..cee182d 100644
--- a/av1/encoder/encodeframe_utils.h
+++ b/av1/encoder/encodeframe_utils.h
@@ -301,10 +301,17 @@
const int num_planes);
void av1_set_fixed_partitioning(AV1_COMP *cpi, const TileInfo *const tile,
+#if CONFIG_SDP
+ MACROBLOCK *const x,
+#endif
MB_MODE_INFO **mib, int mi_row, int mi_col,
BLOCK_SIZE bsize);
-
+#if CONFIG_SDP
+int av1_is_leaf_split_partition(AV1_COMMON *cm, MACROBLOCKD *const xd,
+ int mi_row, int mi_col,
+#else
int av1_is_leaf_split_partition(AV1_COMMON *cm, int mi_row, int mi_col,
+#endif
BLOCK_SIZE bsize);
void av1_reset_simple_motion_tree_partition(SIMPLE_MOTION_DATA_TREE *sms_tree,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 5691870..f6addbb 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -496,8 +496,9 @@
for (row = 0; row < max_blocks_high; row += mu_blocks_high) {
for (col = 0; col < max_blocks_wide; col += mu_blocks_wide) {
#if CONFIG_SDP
- for (int plane = (cm->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
@@ -1576,8 +1577,9 @@
return;
}
#if CONFIG_SDP
- for (int plane = (xd->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
diff --git a/av1/encoder/intra_mode_search_utils.h b/av1/encoder/intra_mode_search_utils.h
index 65f2336..89335c3 100644
--- a/av1/encoder/intra_mode_search_utils.h
+++ b/av1/encoder/intra_mode_search_utils.h
@@ -319,7 +319,11 @@
#endif
}
}
+#if CONFIG_SDP
+ if (av1_allow_intrabc(&cpi->common) && mbmi->tree_type != CHROMA_PART)
+#else
if (av1_allow_intrabc(&cpi->common))
+#endif
total_rate += mode_costs->intrabc_cost[use_intrabc];
return total_rate;
}
diff --git a/av1/encoder/mv_prec.c b/av1/encoder/mv_prec.c
index d1984e9..4dfc6ba 100644
--- a/av1/encoder/mv_prec.c
+++ b/av1/encoder/mv_prec.c
@@ -275,8 +275,12 @@
if (mi_row >= cm->mi_params.mi_rows || mi_col >= cm->mi_params.mi_cols)
return;
-
+#if CONFIG_SDP
+ const PARTITION_TYPE partition =
+ get_partition(cm, SHARED_PART, mi_row, mi_col, bsize);
+#else
const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
+#endif
const BLOCK_SIZE subsize = get_partition_subsize(bsize, partition);
const int hbs = mi_size_wide[bsize] / 2;
diff --git a/av1/encoder/partition_search.c b/av1/encoder/partition_search.c
index 62ba72f..25ba7d5 100644
--- a/av1/encoder/partition_search.c
+++ b/av1/encoder/partition_search.c
@@ -247,7 +247,7 @@
const int mi_col = xd->mi_col;
if (!is_inter) {
#if CONFIG_SDP
- if (cm->tree_type != LUMA_PART) {
+ if (xd->tree_type != LUMA_PART) {
xd->cfl.store_y = store_cfl_required(cm, xd);
}
#else
@@ -259,8 +259,9 @@
mbmi->skip_txfm = 1;
#endif
#if CONFIG_SDP
- for (int plane = (xd->tree_type == CHROMA_PART); plane < num_planes;
- ++plane) {
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
#else
for (int plane = 0; plane < num_planes; ++plane) {
#endif
@@ -282,8 +283,7 @@
xd->cfl.store_y = 0;
if (av1_allow_palette(cm->features.allow_screen_content_tools, bsize)) {
#if CONFIG_SDP
- for (int plane = (cm->tree_type == CHROMA_PART);
- plane < AOMMIN(2, av1_num_planes(cm)); ++plane) {
+ for (int plane = plane_start; plane < AOMMIN(2, plane_end); ++plane) {
#else
for (int plane = 0; plane < AOMMIN(2, num_planes); ++plane) {
#endif
@@ -947,8 +947,11 @@
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) {
+#else
if (av1_allow_intrabc(cm)) {
+#endif
update_cdf(fc->intrabc_cdf, is_intrabc_block(mbmi), 2);
#if CONFIG_ENTROPY_STATS
++td->counts->intrabc[is_intrabc_block(mbmi)];
@@ -1538,10 +1541,9 @@
if (tile_data->allow_update_cdf) {
FRAME_CONTEXT *fc = xd->tile_ctx;
#if CONFIG_SDP
-#if CONFIG_SDP
int luma_split_flag = 0;
int parent_block_width = block_size_wide[bsize];
- if (cm->tree_type == CHROMA_PART &&
+ if (xd->tree_type == CHROMA_PART &&
parent_block_width >= SHARED_PART_SIZE) {
luma_split_flag =
get_luma_split_flag(bsize, mi_params, mi_row, mi_col);
@@ -1554,10 +1556,6 @@
assert(partition == PARTITION_SPLIT);
}
#else
- update_cdf(fc->partition_cdf[plane_index][ctx], partition,
- partition_cdf_length(bsize));
-#endif
-#else
update_cdf(fc->partition_cdf[ctx], partition,
partition_cdf_length(bsize));
#endif
@@ -1703,7 +1701,12 @@
? partition_plane_context(xd, mi_row, mi_col, bsize)
: 0;
const PARTITION_TYPE partition =
+#if CONFIG_SDP
+ (bsize >= BLOCK_8X8) ? get_partition(cm, xd->tree_type == CHROMA_PART,
+ mi_row, mi_col, bsize)
+#else
(bsize >= BLOCK_8X8) ? get_partition(cm, mi_row, mi_col, bsize)
+#endif
: PARTITION_NONE;
const BLOCK_SIZE subsize = get_partition_subsize(bsize, partition);
RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
@@ -2245,7 +2248,12 @@
const int bs = mi_size_wide[bsize];
const int hbs = bs / 2;
const PARTITION_TYPE partition =
+#if CONFIG_SDP
+ (bsize >= BLOCK_8X8) ? get_partition(cm, xd->tree_type == CHROMA_PART,
+ mi_row, mi_col, bsize)
+#else
(bsize >= BLOCK_8X8) ? get_partition(cm, mi_row, mi_col, bsize)
+#endif
: PARTITION_NONE;
BLOCK_SIZE subsize = get_partition_subsize(bsize, partition);
assert(subsize <= BLOCK_LARGEST);
@@ -2398,7 +2406,11 @@
pc_tree->split[i]->index = i;
}
if (cpi->sf.rt_sf.nonrd_check_partition_merge_mode &&
+#if CONFIG_SDP
+ av1_is_leaf_split_partition(cm, xd, mi_row, mi_col, bsize) &&
+#else
av1_is_leaf_split_partition(cm, mi_row, mi_col, bsize) &&
+#endif
!frame_is_intra_only(cm) && bsize <= BLOCK_32X32) {
RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
RD_STATS split_rdc, none_rdc;
@@ -2738,11 +2750,16 @@
// Override partition cost buffer for the edge blocks.
static void set_partition_cost_for_edge_blk(
+#if CONFIG_SDP
+ AV1_COMMON const *cm, MACROBLOCKD *const xd,
+ PartitionSearchState *part_search_state) {
+#else
AV1_COMMON const *cm, PartitionSearchState *part_search_state) {
+#endif
PartitionBlkParams blk_params = part_search_state->part_blk_params;
assert(blk_params.bsize_at_least_8x8 && part_search_state->pl_ctx_idx >= 0);
#if CONFIG_SDP
- const int plane = cm->tree_type == CHROMA_PART;
+ const int plane = xd->tree_type == CHROMA_PART;
const aom_cdf_prob *partition_cdf =
cm->fc->partition_cdf[plane][part_search_state->pl_ctx_idx];
#else
@@ -3803,7 +3820,11 @@
// Override partition costs at the edges of the frame in the same
// way as in read_partition (see decodeframe.c).
if (!(blk_params.has_rows && blk_params.has_cols))
+#if CONFIG_SDP
+ set_partition_cost_for_edge_blk(cm, xd, &part_search_state);
+#else
set_partition_cost_for_edge_blk(cm, &part_search_state);
+#endif
// Disable rectangular partitions for inner blocks when the current block is
// forced to only use square partitions.
@@ -3867,7 +3888,7 @@
int luma_split_flag = 0;
int parent_block_width = block_size_wide[bsize];
const CommonModeInfoParams *const mi_params = &cm->mi_params;
- if (cm->tree_type == CHROMA_PART && parent_block_width >= SHARED_PART_SIZE) {
+ if (xd->tree_type == CHROMA_PART && parent_block_width >= SHARED_PART_SIZE) {
luma_split_flag = get_luma_split_flag(bsize, mi_params, mi_row, mi_col);
}
// if luma blocks uses smaller blocks, then chroma will also split
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index a55d248..d92dfa0 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -83,13 +83,17 @@
EXT_TX_SET_DCT_IDTX,
},
};
-
+#if CONFIG_SDP
+void av1_fill_mode_rates(AV1_COMMON *const cm, const MACROBLOCKD *xd,
+ ModeCosts *mode_costs,
+#else
void av1_fill_mode_rates(AV1_COMMON *const cm, ModeCosts *mode_costs,
+#endif
FRAME_CONTEXT *fc) {
int i, j;
#if CONFIG_SDP
const int num_planes = av1_num_planes(cm);
- for (int plane_index = (cm->tree_type == CHROMA_PART);
+ for (int plane_index = (xd->tree_type == CHROMA_PART);
plane_index < num_planes; plane_index++) {
for (i = 0; i < PARTITION_CONTEXTS; ++i)
av1_cost_tokens_from_cdf(mode_costs->partition_cost[plane_index][i],
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h
index 5e9bfcd..ecc101f 100644
--- a/av1/encoder/rd.h
+++ b/av1/encoder/rd.h
@@ -353,8 +353,12 @@
int av1_get_intra_cost_penalty(int qindex, int qdelta,
aom_bit_depth_t bit_depth);
-
+#if CONFIG_SDP
+void av1_fill_mode_rates(AV1_COMMON *const cm, const MACROBLOCKD *xd,
+ ModeCosts *mode_costs,
+#else
void av1_fill_mode_rates(AV1_COMMON *const cm, ModeCosts *mode_costs,
+#endif
FRAME_CONTEXT *fc);
void av1_fill_lr_rates(ModeCosts *mode_costs, FRAME_CONTEXT *fc);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index b906838..35c8451 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2954,11 +2954,18 @@
RD_STATS *rd_stats, BLOCK_SIZE bsize,
int64_t best_rd) {
const AV1_COMMON *const cm = &cpi->common;
+#if CONFIG_SDP
+ MACROBLOCKD *const xd = &x->e_mbd;
+ if (!av1_allow_intrabc(cm) || (xd->tree_type == CHROMA_PART) ||
+ !cpi->oxcf.kf_cfg.enable_intrabc)
+#else
if (!av1_allow_intrabc(cm) || !cpi->oxcf.kf_cfg.enable_intrabc)
+#endif
return INT64_MAX;
const int num_planes = av1_num_planes(cm);
-
+#if !CONFIG_SDP
MACROBLOCKD *const xd = &x->e_mbd;
+#endif
const TileInfo *tile = &xd->tile;
MB_MODE_INFO *mbmi = xd->mi[0];
TxfmSearchInfo *txfm_info = &x->txfm_search_info;
@@ -5347,7 +5354,7 @@
float probs[2] = { 0.0f };
#if CONFIG_SDP
nn_features[0] = (float)search_state.best_mbmode
- .skip_txfm[cm->tree_type != CHROMA_PART ? 0 : 1];
+ .skip_txfm[xd->tree_type != CHROMA_PART ? 0 : 1];
#else
nn_features[0] = (float)search_state.best_mbmode.skip_txfm;
#endif
@@ -5366,7 +5373,7 @@
if (probs[1] > 0.8) search_state.intra_search_state.skip_intra_modes = 1;
#if CONFIG_SDP
} else if ((search_state.best_mbmode
- .skip_txfm[cm->tree_type == CHROMA_PART]) &&
+ .skip_txfm[xd->tree_type == CHROMA_PART]) &&
(sf->intra_sf.skip_intra_in_interframe >= 2)) {
#else
} else if ((search_state.best_mbmode.skip_txfm) &&
diff --git a/av1/encoder/segmentation.c b/av1/encoder/segmentation.c
index daa62f5..a240b59 100644
--- a/av1/encoder/segmentation.c
+++ b/av1/encoder/segmentation.c
@@ -108,7 +108,12 @@
if (bsize == BLOCK_8X8)
partition = PARTITION_NONE;
else
+#if CONFIG_SDP
+ partition =
+ get_partition(cm, xd->tree_type == CHROMA_PART, mi_row, mi_col, bsize);
+#else
partition = get_partition(cm, mi_row, mi_col, bsize);
+#endif
switch (partition) {
case PARTITION_NONE: CSEGS(bs, bs, 0, 0); break;
case PARTITION_HORZ:
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 1047ee1..d977c7b 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -214,8 +214,13 @@
av1_reset_entropy_context(xd, bsize, num_planes);
return;
}
-
+#if CONFIG_SDP
+ const int plane_start = (xd->tree_type == CHROMA_PART);
+ const int plane_end = (xd->tree_type == LUMA_PART) ? 1 : num_planes;
+ for (int plane = plane_start; plane < plane_end; ++plane) {
+#else
for (int plane = 0; plane < num_planes; ++plane) {
+#endif
if (plane && !xd->is_chroma_ref) break;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int ss_x = pd->subsampling_x;