Account for the re-scheduled sub8x8 chroma block order
Make the rate-distortion optimization account for the special order
for sub8x8 block chroma component coding.
Change-Id: I050abc50dda7b9e8e32f7d0959aa954df1d69398
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index e0b9784..f0e4200 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -974,12 +974,20 @@
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
+ const BLOCK_SIZE bs = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
+#else
const BLOCK_SIZE bs = get_plane_block_size(bsize, pd);
+#endif
unsigned int sse;
int rate;
int64_t dist;
+#if CONFIG_CB4X4
+ if (x->skip_chroma_rd && plane) continue;
+#endif
+
// TODO(geza): Write direct sse functions that do not compute
// variance as well.
cpi->fn_ptr[bs].vf(p->src.buf, p->src.stride, pd->dst.buf, pd->dst.stride,
@@ -3712,6 +3720,12 @@
av1_init_rd_stats(rd_stats);
if (ref_best_rd < 0) is_cost_valid = 0;
+
+#if CONFIG_CB4X4
+ if (x->skip_chroma_rd) return is_cost_valid;
+ bsize = AOMMAX(BLOCK_8X8, bsize);
+#endif
+
#if !CONFIG_PVQ
if (is_inter_block(mbmi) && is_cost_valid) {
for (plane = 1; plane < MAX_MB_PLANE; ++plane)
@@ -4333,6 +4347,11 @@
av1_init_rd_stats(rd_stats);
+#if CONFIG_CB4X4
+ if (x->skip_chroma_rd) return is_cost_valid;
+ bsize = AOMMAX(BLOCK_8X8, bsize);
+#endif
+
#if CONFIG_EXT_TX && CONFIG_RECT_TX
if (is_rect_tx(mbmi->tx_size)) {
return super_block_uvrd(cpi, x, rd_stats, bsize, ref_best_rd);
@@ -4825,12 +4844,19 @@
// appropriate speed flag is set.
(void)ctx;
#if CONFIG_CB4X4
- 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;
+ *rate_uv_tokenonly = 0;
+ *dist_uv = 0;
+ *skip_uv = 1;
+ *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
*mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode;
}