Commit 7bc1fa19 authored by Urvang Joshi's avatar Urvang Joshi Committed by Gerrit Code Review

Merge changes I2153c57e,I0e291edd into nextgenv2

* changes:
  Palette: Generate encodings automatically from tree.
  Palette + Ext-Intra: shadowed declaration fix.
parents cf6caf7a 0b325978
......@@ -70,37 +70,9 @@ static const struct av1_token
};
#endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
static const struct av1_token palette_size_encodings[] = {
{ 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 62, 6 }, { 63, 6 },
};
static const struct av1_token
palette_color_encodings[PALETTE_MAX_SIZE - 1][PALETTE_MAX_SIZE] = {
{ { 0, 1 }, { 1, 1 } }, // 2 colors
{ { 0, 1 }, { 2, 2 }, { 3, 2 } }, // 3 colors
{ { 0, 1 }, { 2, 2 }, { 6, 3 }, { 7, 3 } }, // 4 colors
{ { 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 } }, // 5 colors
{ { 0, 1 },
{ 2, 2 },
{ 6, 3 },
{ 14, 4 },
{ 30, 5 },
{ 31, 5 } }, // 6 colors
{ { 0, 1 },
{ 2, 2 },
{ 6, 3 },
{ 14, 4 },
{ 30, 5 },
{ 62, 6 },
{ 63, 6 } }, // 7 colors
{ { 0, 1 },
{ 2, 2 },
{ 6, 3 },
{ 14, 4 },
{ 30, 5 },
{ 62, 6 },
{ 126, 7 },
{ 127, 7 } }, // 8 colors
};
static struct av1_token palette_size_encodings[PALETTE_MAX_SIZE - 1];
static struct av1_token palette_color_encodings[PALETTE_MAX_SIZE - 1]
[PALETTE_MAX_SIZE];
#endif // CONFIG_PALETTE
static const struct av1_token tx_size_encodings[TX_SIZES - 1][TX_SIZES] = {
{ { 0, 1 }, { 1, 1 } }, // Max tx_size is 8X8
......@@ -145,8 +117,10 @@ static struct av1_token switchable_restore_encodings[RESTORE_SWITCHABLE_TYPES];
#endif // CONFIG_LOOP_RESTORATION
void av1_encode_token_init(void) {
#if CONFIG_EXT_TX
#if CONFIG_EXT_TX || CONFIG_PALETTE
int s;
#endif // CONFIG_EXT_TX || CONFIG_PALETTE
#if CONFIG_EXT_TX
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
av1_tokens_from_tree(ext_tx_inter_encodings[s], av1_ext_tx_inter_tree[s]);
}
......@@ -163,6 +137,13 @@ void av1_encode_token_init(void) {
av1_tokens_from_tree(inter_mode_encodings, av1_inter_mode_tree);
#endif
#if CONFIG_PALETTE
av1_tokens_from_tree(palette_size_encodings, av1_palette_size_tree);
for (s = 0; s < PALETTE_MAX_SIZE - 1; ++s) {
av1_tokens_from_tree(palette_color_encodings[s], av1_palette_color_tree[s]);
}
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
av1_tokens_from_tree(intra_filter_encodings, av1_intra_filter_tree);
#endif // CONFIG_EXT_INTRA
......
......@@ -9375,7 +9375,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int best_rate_nocoef;
#endif
int64_t distortion2 = 0, distortion_y = 0, dummy_rd = best_rd, this_rd;
int skippable = 0, rate_overhead = 0;
int skippable = 0, rate_overhead_palette = 0;
TX_SIZE best_tx_size, uv_tx;
TX_TYPE best_tx_type;
PALETTE_MODE_INFO palette_mode_info;
......@@ -9383,13 +9383,12 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
x->palette_buffer->best_palette_color_map;
uint8_t *const color_map = xd->plane[0].color_index_map;
rate_overhead = 0;
mbmi->mode = DC_PRED;
mbmi->uv_mode = DC_PRED;
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE;
palette_mode_info.palette_size[0] = 0;
rate_overhead = rd_pick_palette_intra_sby(
rate_overhead_palette = rd_pick_palette_intra_sby(
cpi, x, bsize, palette_ctx, intra_mode_cost[DC_PRED],
&palette_mode_info, best_palette_color_map, &best_tx_size,
&best_tx_type, &mode_selected, &dummy_rd);
......@@ -9438,7 +9437,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#endif // CONFIG_FILTER_INTRA
skippable = skippable && skip_uvs[uv_tx];
distortion2 = distortion_y + dist_uvs[uv_tx];
rate2 = rate_y + rate_overhead + rate_uv_intra[uv_tx];
rate2 = rate_y + rate_overhead_palette + rate_uv_intra[uv_tx];
rate2 += ref_costs_single[INTRA_FRAME];
if (skippable) {
......
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