remove skip_chroma_rd in MACROBLOCK
Not needed.
Change-Id: Iac06b51ff6314c1ffd47fb03307ffea88dbc9fa8
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 200ddbb..3f93a8e 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -324,7 +324,6 @@
// Force the coding block to skip transform and quantization.
int force_skip;
- int skip_chroma_rd;
int skip_cost[SKIP_CONTEXTS][2];
int skip_mode; // 0: off; 1: on
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 4df5647..8dda309 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -784,7 +784,6 @@
mbmi->skip = 0;
// Reset skip mode flag.
mbmi->skip_mode = 0;
- x->skip_chroma_rd = !xd->is_chroma_ref;
if (is_cur_buf_hbd(xd)) {
x->source_variance = av1_high_get_sby_perpixel_variance(
diff --git a/av1/encoder/intra_mode_search.c b/av1/encoder/intra_mode_search.c
index f2b88b9..88f11ff 100644
--- a/av1/encoder/intra_mode_search.c
+++ b/av1/encoder/intra_mode_search.c
@@ -1196,7 +1196,7 @@
// Use an estimated rd for uv_intra based on DC_PRED if the
// appropriate speed flag is set.
init_sbuv_mode(mbmi);
- if (x->skip_chroma_rd) {
+ if (!xd->is_chroma_ref) {
*rate_uv = 0;
*rate_uv_tokenonly = 0;
*dist_uv = 0;
@@ -1887,7 +1887,7 @@
// not the tokenonly rate.
rd_stats_y->rate -= tx_size_cost(x, bsize, mbmi->tx_size);
}
- if (num_planes > 1 && !x->skip_chroma_rd) {
+ if (num_planes > 1 && xd->is_chroma_ref) {
const int uv_mode_cost =
x->intra_uv_mode_cost[is_cfl_allowed(xd)][mode][mbmi->uv_mode];
rd_stats->rate +=
diff --git a/av1/encoder/model_rd.h b/av1/encoder/model_rd.h
index 9fc96fc..1ca636d 100644
--- a/av1/encoder/model_rd.h
+++ b/av1/encoder/model_rd.h
@@ -163,6 +163,7 @@
assert(bsize < BLOCK_SIZES_ALL);
for (plane = plane_from; plane <= plane_to; ++plane) {
+ if (plane && !xd->is_chroma_ref) break;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE plane_bsize =
@@ -174,8 +175,6 @@
int rate;
int64_t dist;
- if (x->skip_chroma_rd && plane) continue;
-
sse = calculate_sse(xd, p, pd, bw, bh);
model_rd_from_sse(cpi, x, plane_bsize, plane, sse, bw * bh, &rate, &dist);
@@ -213,14 +212,12 @@
int64_t total_sse = 0;
for (int plane = plane_from; plane <= plane_to; ++plane) {
+ if (plane && !xd->is_chroma_ref) break;
struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
int64_t dist, sse;
int rate;
-
- if (x->skip_chroma_rd && plane) continue;
-
int bw, bh;
const struct macroblock_plane *const p = &x->plane[plane];
get_txb_dimensions(xd, plane, plane_bsize, 0, 0, plane_bsize, NULL, NULL,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 2585863..2188751 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -616,14 +616,13 @@
const MB_MODE_INFO *mbmi = xd->mi[0];
int64_t total_sse = 0;
for (int plane = 0; plane < num_planes; ++plane) {
+ if (plane && !xd->is_chroma_ref) break;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE bs = get_plane_block_size(mbmi->sb_type, pd->subsampling_x,
pd->subsampling_y);
unsigned int sse;
- if (x->skip_chroma_rd && plane) continue;
-
cpi->fn_ptr[bs].vf(p->src.buf, p->src.stride, pd->dst.buf, pd->dst.stride,
&sse);
total_sse += sse;
@@ -2628,7 +2627,6 @@
int rate_y = 0, rate_uv = 0, rate_y_tokenonly = 0, rate_uv_tokenonly = 0;
int y_skip = 0, uv_skip = 0;
int64_t dist_y = 0, dist_uv = 0;
- TX_SIZE max_uv_tx_size;
ctx->rd_stats.skip = 0;
mbmi->ref_frame[0] = INTRA_FRAME;
@@ -2660,11 +2658,12 @@
xd->cfl.store_y = 0;
}
if (num_planes > 1) {
- max_uv_tx_size = av1_get_tx_size(AOM_PLANE_U, xd);
init_sbuv_mode(mbmi);
- if (!x->skip_chroma_rd)
+ if (xd->is_chroma_ref) {
+ const TX_SIZE max_uv_tx_size = av1_get_tx_size(AOM_PLANE_U, xd);
av1_rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly,
&dist_uv, &uv_skip, bsize, max_uv_tx_size);
+ }
}
// Intra block is always coded as non-skip
diff --git a/av1/encoder/rdopt_utils.h b/av1/encoder/rdopt_utils.h
index f30e760..0be3d25 100644
--- a/av1/encoder/rdopt_utils.h
+++ b/av1/encoder/rdopt_utils.h
@@ -504,7 +504,7 @@
const MACROBLOCK *x) {
const MACROBLOCKD *xd = &x->e_mbd;
- if (cm->seq_params.monochrome || x->skip_chroma_rd) return CFL_DISALLOWED;
+ if (cm->seq_params.monochrome || !xd->is_chroma_ref) return CFL_DISALLOWED;
if (!xd->cfl.is_chroma_reference) {
// For non-chroma-reference blocks, we should always store the luma pixels,
diff --git a/av1/encoder/tx_search.c b/av1/encoder/tx_search.c
index d1a2d57..ee85454 100644
--- a/av1/encoder/tx_search.c
+++ b/av1/encoder/tx_search.c
@@ -3347,7 +3347,7 @@
av1_init_rd_stats(rd_stats);
int is_cost_valid = 1;
if (ref_best_rd < 0) is_cost_valid = 0;
- if (x->skip_chroma_rd || !is_cost_valid) return is_cost_valid;
+ if (!x->e_mbd.is_chroma_ref || !is_cost_valid) return is_cost_valid;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = xd->mi[0];