Bring palette back to nextgenv2

It was removed by the master branch merge.

Change-Id: I4b2a524c9e052e41063359afcb4ba22bf78344cf
This commit is contained in:
hui su
2015-12-07 18:18:57 -08:00
parent 69f4930041
commit c93e5cc3e9
23 changed files with 1225 additions and 9 deletions

View File

@@ -487,6 +487,39 @@ static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
return segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
}
void vp10_tokenize_palette_sb(struct ThreadData *const td,
BLOCK_SIZE bsize, int plane,
TOKENEXTRA **t) {
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
uint8_t *color_map = xd->plane[0].color_index_map;
PALETTE_MODE_INFO *pmi = &mbmi->palette_mode_info;
int n = pmi->palette_size[plane != 0];
int i, j, k;
int color_new_idx = -1, color_ctx, color_order[PALETTE_MAX_SIZE];
int rows = 4 * num_4x4_blocks_high_lookup[bsize];
int cols = 4 * num_4x4_blocks_wide_lookup[bsize];
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = vp10_get_palette_color_context(color_map, cols, i, j, n,
color_order);
for (k = 0; k < n; ++k)
if (color_map[i * cols + j] == color_order[k]) {
color_new_idx = k;
break;
}
assert(color_new_idx >= 0 && color_new_idx < n);
(*t)->token = color_new_idx;
(*t)->context_tree = vp10_default_palette_y_color_prob[n - 2][color_ctx];
(*t)->skip_eob_node = 0;
++(*t);
}
}
}
static void tokenize_b(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {