Commit 23a61117 authored by Urvang Joshi's avatar Urvang Joshi

Palette code: add comments and rename some variables.

- Added comments for some tables and #defines for clarity.
- Renamed some variables to ensure we use "color_index" instead of
"color" for palette color index related variables.

Change-Id: Ica95a26e0f171a41a3259c8e6b3b891b8cd10151
parent d0d3bccf
......@@ -776,6 +776,9 @@ static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = {
};
#if CONFIG_PALETTE
// Tree to code palette size (number of colors in a palette) and the
// corresponding probabilities for Y and UV planes.
const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)] = {
-TWO_COLORS, 2, -THREE_COLORS, 4, -FOUR_COLORS, 6,
-FIVE_COLORS, 8, -SIX_COLORS, 10, -SEVEN_COLORS, -EIGHT_COLORS,
......@@ -808,6 +811,9 @@ const aom_prob
#endif // CONFIG_EXT_PARTITION
};
// When palette mode is enabled, following probability tables indicate the
// probabilities to code the "is_palette" bit (i.e. the bit that indicates
// if this block uses palette mode or DC_PRED mode).
const aom_prob
av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
[PALETTE_Y_MODE_CONTEXTS] = {
......@@ -822,10 +828,15 @@ const aom_prob
#endif // CONFIG_EXT_PARTITION
};
const aom_prob av1_default_palette_uv_mode_prob[2] = { 253, 229 };
const aom_prob av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS] = {
253, 229
};
// Trees to code palette color indices (for various palette sizes), and the
// corresponding probability tables for Y and UV planes.
const aom_tree_index
av1_palette_color_tree[PALETTE_MAX_SIZE - 1][TREE_SIZE(PALETTE_COLORS)] = {
av1_palette_color_index_tree[PALETTE_MAX_SIZE -
1][TREE_SIZE(PALETTE_COLORS)] = {
{ // 2 colors
-PALETTE_COLOR_ONE, -PALETTE_COLOR_TWO },
{ // 3 colors
......@@ -852,8 +863,8 @@ const aom_tree_index
// Note: Has to be non-zero to avoid any asserts triggering.
#define UNUSED_PROB 128
const aom_prob av1_default_palette_y_color_prob
[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] = {
const aom_prob av1_default_palette_y_color_index_prob
[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1] = {
{
// 2 colors
{ 231, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB,
......@@ -922,8 +933,8 @@ const aom_prob av1_default_palette_y_color_prob
},
};
const aom_prob av1_default_palette_uv_color_prob
[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] = {
const aom_prob av1_default_palette_uv_color_index_prob
[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1] = {
{
// 2 colors
{ 233, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB,
......@@ -996,9 +1007,9 @@ const aom_prob av1_default_palette_uv_color_prob
#define MAX_COLOR_CONTEXT_HASH 8
// Negative values are invalid
static const int palette_color_context_lookup[MAX_COLOR_CONTEXT_HASH + 1] = {
-1, -1, 0, -1, -1, 4, 3, 2, 1
};
static const int palette_color_index_context_lookup[MAX_COLOR_CONTEXT_HASH +
1] = { -1, -1, 0, -1, -1,
4, 3, 2, 1 };
#endif // CONFIG_PALETTE
......@@ -1064,10 +1075,10 @@ static const aom_prob
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_PALETTE
#define NUM_PALETTE_NEIGHBORS 3
int av1_get_palette_color_context(const uint8_t *color_map, int stride, int r,
int c, int palette_size, uint8_t *color_order,
int *color_idx) {
#define NUM_PALETTE_NEIGHBORS 3 // left, top-left and top.
int av1_get_palette_color_index_context(const uint8_t *color_map, int stride,
int r, int c, int palette_size,
uint8_t *color_order, int *color_idx) {
int i;
// The +10 below should not be needed. But we get a warning "array subscript
// is above array bounds [-Werror=array-bounds]" without it, possibly due to
......@@ -1075,8 +1086,8 @@ int av1_get_palette_color_context(const uint8_t *color_map, int stride, int r,
int scores[PALETTE_MAX_SIZE + 10];
const int weights[NUM_PALETTE_NEIGHBORS] = { 2, 1, 2 };
const int hash_multipliers[NUM_PALETTE_NEIGHBORS] = { 1, 2, 2 };
int color_ctx_hash;
int color_ctx;
int color_index_ctx_hash;
int color_index_ctx;
int color_neighbors[NUM_PALETTE_NEIGHBORS];
int inverse_color_order[PALETTE_MAX_SIZE];
assert(palette_size <= PALETTE_MAX_SIZE);
......@@ -1128,22 +1139,22 @@ int av1_get_palette_color_context(const uint8_t *color_map, int stride, int r,
}
// Get hash value of context.
color_ctx_hash = 0;
color_index_ctx_hash = 0;
for (i = 0; i < NUM_PALETTE_NEIGHBORS; ++i) {
color_ctx_hash += scores[i] * hash_multipliers[i];
color_index_ctx_hash += scores[i] * hash_multipliers[i];
}
assert(color_ctx_hash > 0);
assert(color_ctx_hash <= MAX_COLOR_CONTEXT_HASH);
assert(color_index_ctx_hash > 0);
assert(color_index_ctx_hash <= MAX_COLOR_CONTEXT_HASH);
// Lookup context from hash.
color_ctx = palette_color_context_lookup[color_ctx_hash];
assert(color_ctx >= 0);
assert(color_ctx < PALETTE_COLOR_CONTEXTS);
color_index_ctx = palette_color_index_context_lookup[color_index_ctx_hash];
assert(color_index_ctx >= 0);
assert(color_index_ctx < PALETTE_COLOR_INDEX_CONTEXTS);
if (color_idx != NULL) {
*color_idx = inverse_color_order[color_map[r * stride + c]];
}
return color_ctx;
return color_index_ctx;
}
#undef NUM_PALETTE_NEIGHBORS
#undef MAX_COLOR_CONTEXT_HASH
......
......@@ -32,10 +32,32 @@ extern "C" {
#endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
#define PALETTE_COLOR_CONTEXTS 5
// Number of possible contexts for a color index.
// As can be seen from av1_get_palette_color_index_context(), the possible
// contexts are (2,0,0), (2,2,1), (3,2,0), (4,1,0), (5,0,0). These are mapped to
// a value from 0 to 4 using 'palette_color_index_context_lookup' table.
#define PALETTE_COLOR_INDEX_CONTEXTS 5
// Maximum number of colors in a palette.
#define PALETTE_MAX_SIZE 8
// Palette mode is available for block sizes >= 8x8.
#define PALETTE_BLOCK_SIZES (BLOCK_LARGEST - BLOCK_8X8 + 1)
// Palette Y mode context for a block is determined by number of neighboring
// blocks (top and/or left) using a palette for Y plane. So, possible Y mode'
// context values are:
// 0 if neither left nor top block uses palette for Y plane,
// 1 if exactly one of left or top block uses palette for Y plane, and
// 2 if both left and top blocks use palette for Y plane.
#define PALETTE_Y_MODE_CONTEXTS 3
// Palette UV mode context for a block is determined by whether this block uses
// palette for the Y plane. So, possible values are:
// 0 if this block doesn't use palette for Y plane.
// 1 if this block uses palette for Y plane (i.e. Y palette size > 0).
#define PALETTE_UV_MODE_CONTEXTS 2
#define PALETTE_MAX_BLOCK_SIZE (64 * 64)
#endif // CONFIG_PALETTE
......@@ -344,16 +366,19 @@ extern aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES];
#if CONFIG_PALETTE
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
[PALETTE_Y_MODE_CONTEXTS];
extern const aom_prob av1_default_palette_uv_mode_prob[2];
extern const aom_prob
av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS];
extern const aom_prob av1_default_palette_y_size_prob[PALETTE_BLOCK_SIZES]
[PALETTE_SIZES - 1];
extern const aom_prob av1_default_palette_uv_size_prob[PALETTE_BLOCK_SIZES]
[PALETTE_SIZES - 1];
extern const aom_prob av1_default_palette_y_color_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_CONTEXTS]
extern const aom_prob
av1_default_palette_y_color_index_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS - 1];
extern const aom_prob av1_default_palette_uv_color_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_CONTEXTS]
extern const aom_prob
av1_default_palette_uv_color_index_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS - 1];
#endif // CONFIG_PALETTE
......@@ -381,7 +406,8 @@ extern const aom_tree_index
av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)];
#if CONFIG_PALETTE
extern const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)];
extern const aom_tree_index av1_palette_color_tree[PALETTE_MAX_SIZE - 1]
extern const aom_tree_index
av1_palette_color_index_tree[PALETTE_MAX_SIZE - 1]
[TREE_SIZE(PALETTE_COLORS)];
#endif // CONFIG_PALETTE
extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)];
......@@ -439,9 +465,9 @@ static INLINE int av1_ceil_log2(int n) {
// Returns the context for palette color index at row 'r' and column 'c',
// along with the 'color_order' of neighbors and the 'color_idx'.
// The 'color_map' is a 2D array with the given 'stride'.
int av1_get_palette_color_context(const uint8_t *color_map, int stride, int r,
int c, int palette_size, uint8_t *color_order,
int *color_idx);
int av1_get_palette_color_index_context(const uint8_t *color_map, int stride,
int r, int c, int palette_size,
uint8_t *color_order, int *color_idx);
#endif // CONFIG_PALETTE
#ifdef __cplusplus
......
......@@ -574,16 +574,19 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const BLOCK_SIZE bsize = mbmi->sb_type;
int i, n, palette_ctx = 0;
int i, n;
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
if (mbmi->mode == DC_PRED) {
int palette_y_mode_ctx = 0;
if (above_mi)
palette_ctx += (above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
palette_y_mode_ctx +=
(above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (left_mi)
palette_ctx += (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (aom_read(
r, av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx],
palette_y_mode_ctx +=
(left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (aom_read(r, av1_default_palette_y_mode_prob[bsize - BLOCK_8X8]
[palette_y_mode_ctx],
ACCT_STR)) {
pmi->palette_size[0] =
aom_read_tree(r, av1_palette_size_tree,
......@@ -600,7 +603,8 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
if (mbmi->uv_mode == DC_PRED) {
if (aom_read(r, av1_default_palette_uv_mode_prob[pmi->palette_size[0] > 0],
const int palette_uv_mode_ctx = (pmi->palette_size[0] > 0);
if (aom_read(r, av1_default_palette_uv_mode_prob[palette_uv_mode_ctx],
ACCT_STR)) {
pmi->palette_size[1] =
aom_read_tree(r, av1_palette_size_tree,
......
......@@ -318,9 +318,10 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
const int n = mbmi->palette_mode_info.palette_size[plane];
int i, j;
uint8_t *const color_map = xd->plane[plane].color_index_map;
const aom_prob(*const prob)[PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] =
plane ? av1_default_palette_uv_color_prob
: av1_default_palette_y_color_prob;
const aom_prob(*const prob)[PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS - 1] =
plane ? av1_default_palette_uv_color_index_prob
: av1_default_palette_y_color_index_prob;
int plane_block_width, plane_block_height, rows, cols;
av1_get_block_dimensions(mbmi->sb_type, plane, xd, &plane_block_width,
&plane_block_height, &rows, &cols);
......@@ -328,9 +329,10 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
const int color_ctx = av1_get_palette_color_context(
const int color_ctx = av1_get_palette_color_index_context(
color_map, plane_block_width, i, j, n, color_order, NULL);
const int color_idx = aom_read_tree(r, av1_palette_color_tree[n - 2],
const int color_idx =
aom_read_tree(r, av1_palette_color_index_tree[n - 2],
prob[n - 2][color_ctx], ACCT_STR);
assert(color_idx >= 0 && color_idx < n);
color_map[i * plane_block_width + j] = color_order[color_idx];
......
......@@ -77,7 +77,7 @@ static const struct av1_token
#endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
static struct av1_token palette_size_encodings[PALETTE_MAX_SIZE - 1];
static struct av1_token palette_color_encodings[PALETTE_MAX_SIZE - 1]
static struct av1_token palette_color_index_encodings[PALETTE_MAX_SIZE - 1]
[PALETTE_MAX_SIZE];
#endif // CONFIG_PALETTE
static const struct av1_token tx_size_encodings[MAX_TX_DEPTH][TX_SIZES] = {
......@@ -160,7 +160,8 @@ void av1_encode_token_init(void) {
#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]);
av1_tokens_from_tree(palette_color_index_encodings[s],
av1_palette_color_index_tree[s]);
}
#endif // CONFIG_PALETTE
......@@ -726,8 +727,8 @@ static void pack_palette_tokens(aom_writer *w, const TOKENEXTRA **tp, int n,
const TOKENEXTRA *p = *tp;
for (i = 0; i < num; ++i) {
av1_write_token(w, av1_palette_color_tree[n - 2], p->context_tree,
&palette_color_encodings[n - 2][p->token]);
av1_write_token(w, av1_palette_color_index_tree[n - 2], p->context_tree,
&palette_color_index_encodings[n - 2][p->token]);
++p;
}
......@@ -1137,17 +1138,19 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const MODE_INFO *const left_mi = xd->left_mi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
int palette_ctx = 0;
int n, i;
int i;
if (mbmi->mode == DC_PRED) {
n = pmi->palette_size[0];
const int n = pmi->palette_size[0];
int palette_y_mode_ctx = 0;
if (above_mi)
palette_ctx += (above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
palette_y_mode_ctx +=
(above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (left_mi)
palette_ctx += (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
aom_write(w, n > 0,
av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx]);
palette_y_mode_ctx +=
(left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
aom_write(w, n > 0, av1_default_palette_y_mode_prob[bsize - BLOCK_8X8]
[palette_y_mode_ctx]);
if (n > 0) {
av1_write_token(w, av1_palette_size_tree,
av1_default_palette_y_size_prob[bsize - BLOCK_8X8],
......@@ -1159,9 +1162,9 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
if (mbmi->uv_mode == DC_PRED) {
n = pmi->palette_size[1];
aom_write(w, n > 0,
av1_default_palette_uv_mode_prob[pmi->palette_size[0] > 0]);
const int n = pmi->palette_size[1];
const int palette_uv_mode_ctx = (pmi->palette_size[0] > 0);
aom_write(w, n > 0, av1_default_palette_uv_mode_prob[palette_uv_mode_ctx]);
if (n > 0) {
av1_write_token(w, av1_palette_size_tree,
av1_default_palette_uv_size_prob[bsize - BLOCK_8X8],
......
......@@ -568,9 +568,9 @@ typedef struct AV1_COMP {
#if CONFIG_PALETTE
int palette_y_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
int palette_uv_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
int palette_y_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS]
int palette_y_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS];
int palette_uv_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS]
int palette_uv_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS];
#endif // CONFIG_PALETTE
int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES];
......
......@@ -102,13 +102,13 @@ static void fill_mode_costs(AV1_COMP *cpi) {
}
for (i = 0; i < PALETTE_MAX_SIZE - 1; ++i) {
for (j = 0; j < PALETTE_COLOR_CONTEXTS; ++j) {
for (j = 0; j < PALETTE_COLOR_INDEX_CONTEXTS; ++j) {
av1_cost_tokens(cpi->palette_y_color_cost[i][j],
av1_default_palette_y_color_prob[i][j],
av1_palette_color_tree[i]);
av1_default_palette_y_color_index_prob[i][j],
av1_palette_color_index_tree[i]);
av1_cost_tokens(cpi->palette_uv_color_cost[i][j],
av1_default_palette_uv_color_prob[i][j],
av1_palette_color_tree[i]);
av1_default_palette_uv_color_index_prob[i][j],
av1_palette_color_index_tree[i]);
}
}
#endif // CONFIG_PALETTE
......
......@@ -2428,7 +2428,7 @@ static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
int color_idx;
const int color_ctx = av1_get_palette_color_context(
const int color_ctx = av1_get_palette_color_index_context(
color_map, block_width, i, j, k, color_order, &color_idx);
assert(color_idx >= 0 && color_idx < k);
palette_mode_cost +=
......@@ -3511,7 +3511,7 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
cpi->common.allow_screen_content_tools
? x->palette_buffer->best_palette_color_map
: NULL;
int palette_ctx = 0;
int palette_y_mode_ctx = 0;
#endif // CONFIG_PALETTE
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
......@@ -3544,9 +3544,10 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_PALETTE
pmi->palette_size[0] = 0;
if (above_mi)
palette_ctx += (above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
palette_y_mode_ctx +=
(above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (left_mi)
palette_ctx += (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
palette_y_mode_ctx += (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
#endif // CONFIG_PALETTE
if (cpi->sf.tx_type_search.fast_intra_tx_type_search)
......@@ -3608,8 +3609,10 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
}
#if CONFIG_PALETTE
if (cpi->common.allow_screen_content_tools && mbmi->mode == DC_PRED)
this_rate += av1_cost_bit(
av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx], 0);
this_rate +=
av1_cost_bit(av1_default_palette_y_mode_prob[bsize - BLOCK_8X8]
[palette_y_mode_ctx],
0);
#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (mbmi->mode == DC_PRED)
......@@ -3658,10 +3661,10 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_PALETTE
if (cpi->common.allow_screen_content_tools) {
rd_pick_palette_intra_sby(cpi, x, bsize, palette_ctx, bmode_costs[DC_PRED],
&best_mbmi, best_palette_color_map, &best_rd,
&best_model_rd, rate, rate_tokenonly, distortion,
skippable);
rd_pick_palette_intra_sby(cpi, x, bsize, palette_y_mode_ctx,
bmode_costs[DC_PRED], &best_mbmi,
best_palette_color_map, &best_rd, &best_model_rd,
rate, rate_tokenonly, distortion, skippable);
}
#endif // CONFIG_PALETTE
......@@ -4510,7 +4513,7 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
int color_idx;
const int color_ctx = av1_get_palette_color_context(
const int color_ctx = av1_get_palette_color_index_context(
color_map, plane_block_width, i, j, n, color_order, &color_idx);
assert(color_idx >= 0 && color_idx < n);
this_rate += cpi->palette_uv_color_cost[n - 2][color_ctx][color_idx];
......
......@@ -397,9 +397,11 @@ void av1_tokenize_palette_sb(const AV1_COMP *cpi,
int i, j;
int this_rate = 0;
uint8_t color_order[PALETTE_MAX_SIZE];
const aom_prob(*const probs)[PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] =
plane == 0 ? av1_default_palette_y_color_prob
: av1_default_palette_uv_color_prob;
const aom_prob(*const probs)[PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS - 1] =
plane == 0
? av1_default_palette_y_color_index_prob
: av1_default_palette_uv_color_index_prob;
int plane_block_width, rows, cols;
av1_get_block_dimensions(bsize, plane, xd, &plane_block_width, NULL, &rows,
&cols);
......@@ -408,7 +410,7 @@ void av1_tokenize_palette_sb(const AV1_COMP *cpi,
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
int color_new_idx;
const int color_ctx = av1_get_palette_color_context(
const int color_ctx = av1_get_palette_color_index_context(
color_map, plane_block_width, i, j, n, color_order, &color_new_idx);
assert(color_new_idx >= 0 && color_new_idx < n);
if (dry_run == DRY_RUN_COSTCOEFFS)
......
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