Sync sub8x8 chroma component decoding process
Process sub8x8 chroma component decoding in the unit of 4x4 block.
Change-Id: I02e149f6076cdb5942b8a0a0b9ac2d833b1a7e49
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index f29a232..fd70332 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -584,6 +584,9 @@
xd->plane[i].width = (bw * MI_SIZE) >> xd->plane[i].subsampling_x;
xd->plane[i].height = (bh * MI_SIZE) >> xd->plane[i].subsampling_y;
+
+ xd->plane[i].width = AOMMAX(xd->plane[i].width, 4);
+ xd->plane[i].height = AOMMAX(xd->plane[i].height, 4);
}
}
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index f7143cb..cae92a6 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -1085,6 +1085,11 @@
const int bw = pd->width;
const int bh = pd->height;
+#if CONFIG_CB4X4
+ if (bsize < BLOCK_8X8 && plane && !is_chroma_reference(mi_row, mi_col))
+ continue;
+#endif
+
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !unify_bsize) {
const PARTITION_TYPE bp = bsize - xd->mi[0]->mbmi.sb_type;
const int have_vsplit = bp != PARTITION_HORZ;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index d791ac8..b9cb37a 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1659,7 +1659,8 @@
const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size];
#if CONFIG_CB4X4
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+ const BLOCK_SIZE plane_bsize =
+ AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#else
const BLOCK_SIZE plane_bsize =
get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd);
@@ -1668,6 +1669,11 @@
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
+#if CONFIG_CB4X4
+ if (bsize < BLOCK_8X8 && plane && !is_chroma_reference(mi_row, mi_col))
+ continue;
+#endif
+
for (row = 0; row < max_blocks_high; row += stepr)
for (col = 0; col < max_blocks_wide; col += stepc)
predict_and_reconstruct_intra_block(cm, xd, r, mbmi, plane, row, col,
@@ -1738,7 +1744,8 @@
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
#if CONFIG_CB4X4
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+ const BLOCK_SIZE plane_bsize =
+ AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#else
const BLOCK_SIZE plane_bsize =
get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd);
@@ -1746,6 +1753,12 @@
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
int row, col;
+
+#if CONFIG_CB4X4
+ if (bsize < BLOCK_8X8 && plane && !is_chroma_reference(mi_row, mi_col))
+ continue;
+#endif
+
#if CONFIG_VAR_TX
const TX_SIZE max_tx_size = max_txsize_rect_lookup[plane_bsize];
const int bh_var_tx = tx_size_high_unit[max_tx_size];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 4106860..7830ba9 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2151,6 +2151,15 @@
assert(*tok < tok_end);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
MB_MODE_INFO *mbmi = &m->mbmi;
+
+#if CONFIG_CB4X4
+ if (mbmi->sb_type < BLOCK_8X8 && plane &&
+ !is_chroma_reference(mi_row, mi_col)) {
+ (*tok)++;
+ continue;
+ }
+#endif
+
#if CONFIG_VAR_TX
const struct macroblockd_plane *const pd = &xd->plane[plane];
BLOCK_SIZE bsize = mbmi->sb_type;
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index d05dff5..bf0dff9 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -816,6 +816,16 @@
td->counts->skip[ctx][0] += skip_inc;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+#if CONFIG_CB4X4
+ if (bsize < BLOCK_8X8 && plane && !is_chroma_reference(mi_row, mi_col)) {
+ (*t)->token = EOSB_TOKEN;
+ (*t)++;
+ continue;
+ }
+#else
+ (void)mi_row;
+ (void)mi_col;
+#endif
av1_foreach_transformed_block_in_plane(xd, bsize, plane, tokenize_b,
&arg);
(*t)->token = EOSB_TOKEN;