Commit f1906e96 authored by Urvang Joshi's avatar Urvang Joshi
Browse files

Palette code: remove the use of same if condition twice.

rd_pick_palette_intra_sby() method is called only when,
cpi->common.allow_screen_content_tools is on. So, no need to check that
again. We just use an assert() instead to still be safe.

Change-Id: I19785c2aac016798c8d331bbe91971b3806b73a8
parent 7e5aa9e7
......@@ -1722,7 +1722,6 @@ static int rd_pick_palette_intra_sby(
uint8_t *best_palette_color_map, TX_SIZE *best_tx, TX_TYPE *best_tx_type,
PREDICTION_MODE *mode_selected, int64_t *best_rd) {
int rate_overhead = 0;
if (cpi->common.allow_screen_content_tools) {
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->mi[0];
const int rows = 4 * num_4x4_blocks_high_lookup[bsize];
......@@ -1732,6 +1731,8 @@ static int rd_pick_palette_intra_sby(
const int src_stride = x->plane[0].src.stride;
const uint8_t *const src = x->plane[0].src.buf;
assert(cpi->common.allow_screen_content_tools);
#if CONFIG_VP9_HIGHBITDEPTH
if (cpi->common.use_highbitdepth)
colors = vp10_count_colors_highbd(src, src_stride, rows, cols,
......@@ -1818,8 +1819,8 @@ static int rd_pick_palette_intra_sby(
vp10_calc_indices(data, centroids, color_map, rows * cols, k, 1);
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s,
NULL, bsize, *best_rd);
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s, NULL,
bsize, *best_rd);
if (this_rate_tokenonly == INT_MAX) continue;
this_rate =
......@@ -1828,8 +1829,7 @@ static int rd_pick_palette_intra_sby(
cpi->palette_y_size_cost[bsize - BLOCK_8X8][k - 2] +
write_uniform_cost(k, color_map[0]) +
vp10_cost_bit(
vp10_default_palette_y_mode_prob[bsize -
BLOCK_8X8][palette_ctx],
vp10_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx],
1);
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
......@@ -1858,7 +1858,6 @@ static int rd_pick_palette_intra_sby(
}
}
}
}
return rate_overhead;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment