Merge "Palette: count Y colors only for screen content." into nextgenv2

This commit is contained in:
Urvang Joshi
2016-08-19 23:18:39 +00:00
committed by Gerrit Code Review

View File

@@ -1721,12 +1721,13 @@ static int rd_pick_palette_intra_sby(
int dc_mode_cost, PALETTE_MODE_INFO *palette_mode_info,
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];
const int cols = 4 * num_4x4_blocks_wide_lookup[bsize];
int this_rate, this_rate_tokenonly, s, colors, n;
int rate_overhead = 0;
int64_t this_distortion, this_rd;
const int src_stride = x->plane[0].src.stride;
const uint8_t *const src = x->plane[0].src.buf;
@@ -1743,7 +1744,7 @@ static int rd_pick_palette_intra_sby(
mic->mbmi.ext_intra_mode_info.use_ext_intra_mode[0] = 0;
#endif // CONFIG_EXT_INTRA
if (colors > 1 && colors <= 64 && cpi->common.allow_screen_content_tools) {
if (colors > 1 && colors <= 64) {
int r, c, i, j, k;
const int max_itr = 50;
int color_ctx, color_idx = 0;
@@ -1817,8 +1818,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 =
@@ -1827,7 +1828,8 @@ 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) {
@@ -1856,7 +1858,7 @@ static int rd_pick_palette_intra_sby(
}
}
}
}
return rate_overhead;
}