Add chroma 2x2 block experiment
Support the use of 2x2 prediction and transform block size for
chroma components. This experiment builds on top of cb4x4. It
brings back the loss in performance gains due to 4x4 chroma
component constrain. The coding gains for lowres are up from 1.5%
to 2.5%.
Change-Id: I8e461e230c2d920f6df1af9d935ebe9dfa3820d9
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 567cf01..12a0004 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -887,7 +887,7 @@
if (x->skip) return;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-#if CONFIG_CB4X4
+#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (bsize < BLOCK_8X8 && plane && !is_chroma_reference(mi_row, mi_col))
continue;
if (plane) bsize = AOMMAX(bsize, BLOCK_8X8);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 54a3225..bf6c94c 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -974,7 +974,7 @@
for (plane = plane_from; plane <= plane_to; ++plane) {
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
-#if CONFIG_CB4X4
+#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
const BLOCK_SIZE bs = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#else
const BLOCK_SIZE bs = get_plane_block_size(bsize, pd);
@@ -3721,7 +3721,7 @@
if (ref_best_rd < 0) is_cost_valid = 0;
-#if CONFIG_CB4X4
+#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (x->skip_chroma_rd) return is_cost_valid;
bsize = AOMMAX(BLOCK_8X8, bsize);
#endif
@@ -4347,7 +4347,7 @@
av1_init_rd_stats(rd_stats);
-#if CONFIG_CB4X4
+#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (x->skip_chroma_rd) return is_cost_valid;
bsize = AOMMAX(BLOCK_8X8, bsize);
#endif
@@ -4845,6 +4845,10 @@
// appropriate speed flag is set.
(void)ctx;
#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
+ rd_pick_intra_sbuv_mode(cpi, x, rate_uv, rate_uv_tokenonly, dist_uv, skip_uv,
+ bsize, max_tx_size);
+#else
max_tx_size = AOMMAX(max_tx_size, TX_4X4);
if (x->skip_chroma_rd) {
*rate_uv = 0;
@@ -4854,10 +4858,13 @@
*mode_uv = DC_PRED;
return;
}
-#endif
-
rd_pick_intra_sbuv_mode(cpi, x, rate_uv, rate_uv_tokenonly, dist_uv, skip_uv,
bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize, max_tx_size);
+#endif // CONFIG_CHROMA_2X2
+#else
+ rd_pick_intra_sbuv_mode(cpi, x, rate_uv, rate_uv_tokenonly, dist_uv, skip_uv,
+ bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize, max_tx_size);
+#endif // CONFIG_CB4X4
*mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode;
}
@@ -9059,7 +9066,9 @@
[pd[1].subsampling_x][pd[1].subsampling_y];
#if CONFIG_CB4X4
+#if !CONFIG_CHROMA_2X2
max_uv_tx_size = AOMMAX(max_uv_tx_size, TX_4X4);
+#endif
if (!x->skip_chroma_rd)
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv,
&uv_skip, bsize, max_uv_tx_size);