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

Wrap palette code inside CONFIG_PALETTE flag.

This flag was already added to aomedia/master, so bringing it back to
webm/nextgenv2, as part of an effort to get the two codebases in sync.

Change-Id: I2b933a6a160e4210d1411a9e7978149eb8553205
parent fbabcad6
...@@ -66,8 +66,10 @@ AV1_CX_SRCS-yes += encoder/tokenize.h ...@@ -66,8 +66,10 @@ AV1_CX_SRCS-yes += encoder/tokenize.h
AV1_CX_SRCS-yes += encoder/treewriter.h AV1_CX_SRCS-yes += encoder/treewriter.h
AV1_CX_SRCS-yes += encoder/mcomp.c AV1_CX_SRCS-yes += encoder/mcomp.c
AV1_CX_SRCS-yes += encoder/encoder.c AV1_CX_SRCS-yes += encoder/encoder.c
ifeq ($(CONFIG_PALETTE),yes)
AV1_CX_SRCS-yes += encoder/palette.h AV1_CX_SRCS-yes += encoder/palette.h
AV1_CX_SRCS-yes += encoder/palette.c AV1_CX_SRCS-yes += encoder/palette.c
endif
AV1_CX_SRCS-yes += encoder/picklpf.c AV1_CX_SRCS-yes += encoder/picklpf.c
AV1_CX_SRCS-yes += encoder/picklpf.h AV1_CX_SRCS-yes += encoder/picklpf.h
AV1_CX_SRCS-$(CONFIG_LOOP_RESTORATION) += encoder/pickrst.c AV1_CX_SRCS-$(CONFIG_LOOP_RESTORATION) += encoder/pickrst.c
......
...@@ -155,6 +155,7 @@ typedef struct { ...@@ -155,6 +155,7 @@ typedef struct {
typedef int8_t MV_REFERENCE_FRAME; typedef int8_t MV_REFERENCE_FRAME;
#if CONFIG_PALETTE
typedef struct { typedef struct {
// Number of base colors for Y (0) and UV (1) // Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2]; uint8_t palette_size[2];
...@@ -168,6 +169,7 @@ typedef struct { ...@@ -168,6 +169,7 @@ typedef struct {
// TODO(huisu): move this to encoder // TODO(huisu): move this to encoder
uint8_t palette_first_color_idx[2]; uint8_t palette_first_color_idx[2];
} PALETTE_MODE_INFO; } PALETTE_MODE_INFO;
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
typedef struct { typedef struct {
...@@ -199,7 +201,9 @@ typedef struct { ...@@ -199,7 +201,9 @@ typedef struct {
// Only for INTRA blocks // Only for INTRA blocks
PREDICTION_MODE uv_mode; PREDICTION_MODE uv_mode;
#if CONFIG_PALETTE
PALETTE_MODE_INFO palette_mode_info; PALETTE_MODE_INFO palette_mode_info;
#endif // CONFIG_PALETTE
// Only for INTER blocks // Only for INTER blocks
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
...@@ -291,7 +295,9 @@ typedef struct macroblockd_plane { ...@@ -291,7 +295,9 @@ typedef struct macroblockd_plane {
dequant_val_type_nuq seg_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES] dequant_val_type_nuq seg_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES]
[COEF_BANDS]; [COEF_BANDS];
#endif #endif
#if CONFIG_PALETTE
uint8_t *color_index_map; uint8_t *color_index_map;
#endif // CONFIG_PALETTE
// number of 4x4s in current block // number of 4x4s in current block
uint16_t n4_w, n4_h; uint16_t n4_w, n4_h;
......
...@@ -474,6 +474,7 @@ static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = { ...@@ -474,6 +474,7 @@ static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = {
#endif // CONFIG_EXT_REFS #endif // CONFIG_EXT_REFS
}; };
#if CONFIG_PALETTE
const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)] = { const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)] = {
-TWO_COLORS, 2, -THREE_COLORS, 4, -FOUR_COLORS, 6, -TWO_COLORS, 2, -THREE_COLORS, 4, -FOUR_COLORS, 6,
-FIVE_COLORS, 8, -SIX_COLORS, 10, -SEVEN_COLORS, -EIGHT_COLORS, -FIVE_COLORS, 8, -SIX_COLORS, 10, -SEVEN_COLORS, -EIGHT_COLORS,
...@@ -832,6 +833,7 @@ static const int palette_color_context_lookup[PALETTE_COLOR_CONTEXTS] = { ...@@ -832,6 +833,7 @@ static const int palette_color_context_lookup[PALETTE_COLOR_CONTEXTS] = {
// (7, 3, 0, 0), (8, 0, 0, 0), (8, 2, 0, 0), (10, 0, 0, 0) // (7, 3, 0, 0), (8, 0, 0, 0), (8, 2, 0, 0), (10, 0, 0, 0)
9680, 10648, 10890, 13310 9680, 10648, 10890, 13310
}; };
#endif // CONFIG_PALETTE
const aom_tree_index av1_tx_size_tree[TX_SIZES - 1][TREE_SIZE(TX_SIZES)] = { const aom_tree_index av1_tx_size_tree[TX_SIZES - 1][TREE_SIZE(TX_SIZES)] = {
{ {
...@@ -883,6 +885,7 @@ static const aom_prob ...@@ -883,6 +885,7 @@ static const aom_prob
static const aom_prob default_rect_tx_prob[TX_SIZES - 1] = { 192, 192, 192 }; static const aom_prob default_rect_tx_prob[TX_SIZES - 1] = { 192, 192, 192 };
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_VAR_TX #endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_VAR_TX
#if CONFIG_PALETTE
int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
int c, int n, int *color_order) { int c, int n, int *color_order) {
int i, j, max, max_idx, temp; int i, j, max, max_idx, temp;
...@@ -951,6 +954,7 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, ...@@ -951,6 +954,7 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
return color_ctx; return color_ctx;
} }
#endif // CONFIG_PALETTE
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = { static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
......
...@@ -31,11 +31,13 @@ extern "C" { ...@@ -31,11 +31,13 @@ extern "C" {
#define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV) #define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV)
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
#define PALETTE_COLOR_CONTEXTS 16 #define PALETTE_COLOR_CONTEXTS 16
#define PALETTE_MAX_SIZE 8 #define PALETTE_MAX_SIZE 8
#define PALETTE_BLOCK_SIZES (BLOCK_LARGEST - BLOCK_8X8 + 1) #define PALETTE_BLOCK_SIZES (BLOCK_LARGEST - BLOCK_8X8 + 1)
#define PALETTE_Y_MODE_CONTEXTS 3 #define PALETTE_Y_MODE_CONTEXTS 3
#define PALETTE_MAX_BLOCK_SIZE (64 * 64) #define PALETTE_MAX_BLOCK_SIZE (64 * 64)
#endif // CONFIG_PALETTE
struct AV1Common; struct AV1Common;
...@@ -218,6 +220,7 @@ typedef struct FRAME_COUNTS { ...@@ -218,6 +220,7 @@ typedef struct FRAME_COUNTS {
extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES] extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
[INTRA_MODES - 1]; [INTRA_MODES - 1];
#if CONFIG_PALETTE
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES] extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
[PALETTE_Y_MODE_CONTEXTS]; [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[2];
...@@ -231,6 +234,7 @@ extern const aom_prob av1_default_palette_y_color_prob[PALETTE_MAX_SIZE - 1] ...@@ -231,6 +234,7 @@ extern const aom_prob av1_default_palette_y_color_prob[PALETTE_MAX_SIZE - 1]
extern const aom_prob av1_default_palette_uv_color_prob[PALETTE_MAX_SIZE - 1] extern const aom_prob av1_default_palette_uv_color_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_CONTEXTS] [PALETTE_COLOR_CONTEXTS]
[PALETTE_COLORS - 1]; [PALETTE_COLORS - 1];
#endif // CONFIG_PALETTE
extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)]; extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)]; extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)];
...@@ -247,9 +251,11 @@ extern const aom_tree_index ...@@ -247,9 +251,11 @@ extern const aom_tree_index
#endif #endif
extern const aom_tree_index extern const aom_tree_index
av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)]; 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_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_tree[PALETTE_MAX_SIZE - 1]
[TREE_SIZE(PALETTE_COLORS)]; [TREE_SIZE(PALETTE_COLORS)];
#endif // CONFIG_PALETTE
extern const aom_tree_index av1_tx_size_tree[TX_SIZES - 1][TREE_SIZE(TX_SIZES)]; extern const aom_tree_index av1_tx_size_tree[TX_SIZES - 1][TREE_SIZE(TX_SIZES)];
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)]; extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)];
...@@ -287,8 +293,10 @@ static INLINE int av1_ceil_log2(int n) { ...@@ -287,8 +293,10 @@ static INLINE int av1_ceil_log2(int n) {
return i; return i;
} }
#if CONFIG_PALETTE
int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
int c, int n, int *color_order); int c, int n, int *color_order);
#endif // CONFIG_PALETTE
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
......
...@@ -223,6 +223,7 @@ typedef enum { ...@@ -223,6 +223,7 @@ typedef enum {
typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE; typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE;
#if CONFIG_PALETTE
typedef enum { typedef enum {
TWO_COLORS, TWO_COLORS,
THREE_COLORS, THREE_COLORS,
...@@ -245,6 +246,7 @@ typedef enum { ...@@ -245,6 +246,7 @@ typedef enum {
PALETTE_COLOR_EIGHT, PALETTE_COLOR_EIGHT,
PALETTE_COLORS PALETTE_COLORS
} PALETTE_COLOR; } PALETTE_COLOR;
#endif // CONFIG_PALETTE
#ifdef CONFIG_CLPF #ifdef CONFIG_CLPF
#define CLPF_NOFLAG -1 #define CLPF_NOFLAG -1
......
...@@ -218,7 +218,9 @@ typedef struct AV1Common { ...@@ -218,7 +218,9 @@ typedef struct AV1Common {
int allow_high_precision_mv; int allow_high_precision_mv;
#if CONFIG_PALETTE
int allow_screen_content_tools; int allow_screen_content_tools;
#endif // CONFIG_PALETTE
// Flag signaling which frame contexts should be reset to default values. // Flag signaling which frame contexts should be reset to default values.
RESET_FRAME_CONTEXT_MODE reset_frame_context; RESET_FRAME_CONTEXT_MODE reset_frame_context;
......
...@@ -1526,6 +1526,7 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in, ...@@ -1526,6 +1526,7 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
const int have_bottom = av1_has_bottom(bsize, mi_row, mi_col, yd > 0, tx_size, const int have_bottom = av1_has_bottom(bsize, mi_row, mi_col, yd > 0, tx_size,
row_off, col_off, pd->subsampling_y); row_off, col_off, pd->subsampling_y);
#if CONFIG_PALETTE
if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) { if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) {
const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size]; const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size];
const int stride = 4 * (1 << bwl_in); const int stride = 4 * (1 << bwl_in);
...@@ -1560,6 +1561,7 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in, ...@@ -1560,6 +1561,7 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
#endif // CONFIG_AOM_HIGHBITDEPTH #endif // CONFIG_AOM_HIGHBITDEPTH
return; return;
} }
#endif // CONFIG_PALETTE
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
......
...@@ -1209,10 +1209,12 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd, ...@@ -1209,10 +1209,12 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
} }
if (!is_inter_block(mbmi)) { if (!is_inter_block(mbmi)) {
int plane; int plane;
#if CONFIG_PALETTE
for (plane = 0; plane <= 1; ++plane) { for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane]) if (mbmi->palette_mode_info.palette_size[plane])
av1_decode_palette_tokens(xd, plane, r); av1_decode_palette_tokens(xd, plane, r);
} }
#endif // CONFIG_PALETTE
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
...@@ -2785,8 +2787,10 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data, ...@@ -2785,8 +2787,10 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
&td->bit_reader, pbi->decrypt_cb, pbi->decrypt_state); &td->bit_reader, pbi->decrypt_cb, pbi->decrypt_state);
#endif #endif
av1_init_macroblockd(cm, &td->xd, td->dqcoeff); av1_init_macroblockd(cm, &td->xd, td->dqcoeff);
#if CONFIG_PALETTE
td->xd.plane[0].color_index_map = td->color_index_map[0]; td->xd.plane[0].color_index_map = td->color_index_map[0];
td->xd.plane[1].color_index_map = td->color_index_map[1]; td->xd.plane[1].color_index_map = td->color_index_map[1];
#endif // CONFIG_PALETTE
} }
} }
...@@ -3095,8 +3099,10 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data, ...@@ -3095,8 +3099,10 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
pbi->decrypt_state); pbi->decrypt_state);
#endif // CONFIG_ANS #endif // CONFIG_ANS
av1_init_macroblockd(cm, &twd->xd, twd->dqcoeff); av1_init_macroblockd(cm, &twd->xd, twd->dqcoeff);
#if CONFIG_PALETTE
twd->xd.plane[0].color_index_map = twd->color_index_map[0]; twd->xd.plane[0].color_index_map = twd->color_index_map[0];
twd->xd.plane[1].color_index_map = twd->color_index_map[1]; twd->xd.plane[1].color_index_map = twd->color_index_map[1];
#endif // CONFIG_PALETTE
worker->had_error = 0; worker->had_error = 0;
if (i == num_workers - 1 || tile_col == tile_cols_end - 1) { if (i == num_workers - 1 || tile_col == tile_cols_end - 1) {
...@@ -3283,10 +3289,14 @@ static size_t read_uncompressed_header(AV1Decoder *pbi, ...@@ -3283,10 +3289,14 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map)); memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
pbi->need_resync = 0; pbi->need_resync = 0;
} }
#if CONFIG_PALETTE
cm->allow_screen_content_tools = aom_rb_read_bit(rb); cm->allow_screen_content_tools = aom_rb_read_bit(rb);
#endif // CONFIG_PALETTE
} else { } else {
cm->intra_only = cm->show_frame ? 0 : aom_rb_read_bit(rb); cm->intra_only = cm->show_frame ? 0 : aom_rb_read_bit(rb);
#if CONFIG_PALETTE
if (cm->intra_only) cm->allow_screen_content_tools = aom_rb_read_bit(rb); if (cm->intra_only) cm->allow_screen_content_tools = aom_rb_read_bit(rb);
#endif // CONFIG_PALETTE
if (cm->error_resilient_mode) { if (cm->error_resilient_mode) {
cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL; cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL;
} else { } else {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "aom_dsp/aom_dsp_common.h" #include "aom_dsp/aom_dsp_common.h"
#if CONFIG_EXT_INTRA || CONFIG_PALETTE
static INLINE int read_uniform(aom_reader *r, int n) { static INLINE int read_uniform(aom_reader *r, int n) {
int l = get_unsigned_bits(n); int l = get_unsigned_bits(n);
int m = (1 << l) - n; int m = (1 << l) - n;
...@@ -37,6 +38,7 @@ static INLINE int read_uniform(aom_reader *r, int n) { ...@@ -37,6 +38,7 @@ static INLINE int read_uniform(aom_reader *r, int n) {
else else
return (v << 1) - m + aom_read_literal(r, 1); return (v << 1) - m + aom_read_literal(r, 1);
} }
#endif // CONFIG_EXT_INTRA || CONFIG_PALETTE
static PREDICTION_MODE read_intra_mode(aom_reader *r, const aom_prob *p) { static PREDICTION_MODE read_intra_mode(aom_reader *r, const aom_prob *p) {
return (PREDICTION_MODE)aom_read_tree(r, av1_intra_mode_tree, p); return (PREDICTION_MODE)aom_read_tree(r, av1_intra_mode_tree, p);
...@@ -443,6 +445,7 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id, ...@@ -443,6 +445,7 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
} }
} }
#if CONFIG_PALETTE
static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd, static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *r) { aom_reader *r) {
MODE_INFO *const mi = xd->mi[0]; MODE_INFO *const mi = xd->mi[0];
...@@ -492,6 +495,7 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd, ...@@ -492,6 +495,7 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
} }
} }
} }
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
static void read_ext_intra_mode_info(AV1_COMMON *const cm, static void read_ext_intra_mode_info(AV1_COMMON *const cm,
...@@ -503,7 +507,11 @@ static void read_ext_intra_mode_info(AV1_COMMON *const cm, ...@@ -503,7 +507,11 @@ static void read_ext_intra_mode_info(AV1_COMMON *const cm,
#if !ALLOW_FILTER_INTRA_MODES #if !ALLOW_FILTER_INTRA_MODES
return; return;
#endif #endif
if (mbmi->mode == DC_PRED && mbmi->palette_mode_info.palette_size[0] == 0) { if (mbmi->mode == DC_PRED
#if CONFIG_PALETTE
&& mbmi->palette_mode_info.palette_size[0] == 0
#endif // CONFIG_PALETTE
) {
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = mbmi->ext_intra_mode_info.use_ext_intra_mode[0] =
aom_read(r, cm->fc->ext_intra_probs[0]); aom_read(r, cm->fc->ext_intra_probs[0]);
if (mbmi->ext_intra_mode_info.use_ext_intra_mode[0]) { if (mbmi->ext_intra_mode_info.use_ext_intra_mode[0]) {
...@@ -513,8 +521,11 @@ static void read_ext_intra_mode_info(AV1_COMMON *const cm, ...@@ -513,8 +521,11 @@ static void read_ext_intra_mode_info(AV1_COMMON *const cm,
if (counts) if (counts)
++counts->ext_intra[0][mbmi->ext_intra_mode_info.use_ext_intra_mode[0]]; ++counts->ext_intra[0][mbmi->ext_intra_mode_info.use_ext_intra_mode[0]];
} }
if (mbmi->uv_mode == DC_PRED && if (mbmi->uv_mode == DC_PRED
mbmi->palette_mode_info.palette_size[1] == 0) { #if CONFIG_PALETTE
&& mbmi->palette_mode_info.palette_size[1] == 0
#endif // CONFIG_PALETTE
) {
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = mbmi->ext_intra_mode_info.use_ext_intra_mode[1] =
aom_read(r, cm->fc->ext_intra_probs[1]); aom_read(r, cm->fc->ext_intra_probs[1]);
if (mbmi->ext_intra_mode_info.use_ext_intra_mode[1]) { if (mbmi->ext_intra_mode_info.use_ext_intra_mode[1]) {
...@@ -607,10 +618,12 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, ...@@ -607,10 +618,12 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
read_intra_angle_info(cm, xd, r); read_intra_angle_info(cm, xd, r);
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0; mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0; mbmi->palette_mode_info.palette_size[1] = 0;
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools)
read_palette_mode_info(cm, xd, r); read_palette_mode_info(cm, xd, r);
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0; mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0;
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0; mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0;
...@@ -895,10 +908,12 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, ...@@ -895,10 +908,12 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
read_intra_angle_info(cm, xd, r); read_intra_angle_info(cm, xd, r);
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0; mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0; mbmi->palette_mode_info.palette_size[1] = 0;
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools)
read_palette_mode_info(cm, xd, r); read_palette_mode_info(cm, xd, r);
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0; mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0;
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0; mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0;
...@@ -1187,8 +1202,10 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -1187,8 +1202,10 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
int16_t mode_ctx = 0; int16_t mode_ctx = 0;
MV_REFERENCE_FRAME ref_frame; MV_REFERENCE_FRAME ref_frame;
#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0; mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0; mbmi->palette_mode_info.palette_size[1] = 0;
#endif // CONFIG_PALETTE
read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame); read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
is_compound = has_second_ref(mbmi); is_compound = has_second_ref(mbmi);
......
...@@ -34,7 +34,9 @@ typedef struct TileData { ...@@ -34,7 +34,9 @@ typedef struct TileData {
DECLARE_ALIGNED(16, MACROBLOCKD, xd); DECLARE_ALIGNED(16, MACROBLOCKD, xd);
/* dqcoeff are shared by all the planes. So planes must be decoded serially */ /* dqcoeff are shared by all the planes. So planes must be decoded serially */
DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]); DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]); DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
#endif // CONFIG_PALETTE
} TileData; } TileData;
typedef struct TileWorkerData { typedef struct TileWorkerData {
...@@ -44,7 +46,9 @@ typedef struct TileWorkerData { ...@@ -44,7 +46,9 @@ typedef struct TileWorkerData {
DECLARE_ALIGNED(16, MACROBLOCKD, xd); DECLARE_ALIGNED(16, MACROBLOCKD, xd);
/* dqcoeff are shared by all the planes. So planes must be decoded serially */ /* dqcoeff are shared by all the planes. So planes must be decoded serially */
DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]); DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]); DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
#endif // CONFIG_PALETTE
struct aom_internal_error_info error_info; struct aom_internal_error_info error_info;
} TileWorkerData; } TileWorkerData;
......
...@@ -332,6 +332,7 @@ static void dec_set_contexts(const MACROBLOCKD *xd, ...@@ -332,6 +332,7 @@ static void dec_set_contexts(const MACROBLOCKD *xd,
} }
} }
#if CONFIG_PALETTE
void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
aom_reader *r) { aom_reader *r) {
MODE_INFO *const mi = xd->mi[0]; MODE_INFO *const mi = xd->mi[0];
...@@ -360,6 +361,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, ...@@ -360,6 +361,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
} }
} }
} }
#endif // CONFIG_PALETTE
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane, int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
const scan_order *sc, int x, int y, TX_SIZE tx_size, const scan_order *sc, int x, int y, TX_SIZE tx_size,
......
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
extern "C" { extern "C" {
#endif #endif
#if CONFIG_PALETTE
void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, aom_reader *r); void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, aom_reader *r);
#endif // CONFIG_PALETTE
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane, int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
const scan_order *sc, int x, int y, TX_SIZE tx_size, const scan_order *sc, int x, int y, TX_SIZE tx_size,
TX_TYPE tx_type, TX_TYPE tx_type,
......
...@@ -84,6 +84,7 @@ static const struct av1_token ...@@ -84,6 +84,7 @@ static const struct av1_token
{ 53, 6 }, { 54, 6 }, { 55, 6 }, { 0, 1 }, { 7, 3 } { 53, 6 }, { 54, 6 }, { 55, 6 }, { 0, 1 }, { 7, 3 }
}; };
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
static const struct av1_token palette_size_encodings[] = { static const struct av1_token palette_size_encodings[] = {
{ 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 62, 6 }, { 63, 6 }, { 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 62, 6 }, { 63, 6 },
}; };
...@@ -115,6 +116,7 @@ static const struct av1_token ...@@ -115,6 +116,7 @@ static const struct av1_token
{ 126, 7 }, { 126, 7 },
{ 127, 7 } }, // 8 colors { 127, 7 } }, // 8 colors
}; };
#endif // CONFIG_PALETTE
static const struct av1_token tx_size_encodings[TX_SIZES - 1][TX_SIZES] = { static const struct av1_token tx_size_encodings[TX_SIZES - 1][TX_SIZES] = {
{ { 0, 1 }, { 1, 1 } }, // Max tx_size is 8X8 { { 0, 1 }, { 1, 1 } }, // Max tx_size is 8X8
...@@ -122,6 +124,7 @@ static const struct av1_token tx_size_encodings[TX_SIZES - 1][TX_SIZES] = { ...@@ -122,6 +124,7 @@ static const struct av1_token tx_size_encodings[TX_SIZES - 1][TX_SIZES] = {
{ { 0, 1 }, { 2, 2 }, { 6, 3 }, { 7, 3 } }, // Max tx_size is 32X32 { { 0, 1 }, { 2, 2 }, { 6, 3 }, { 7, 3 } }, // Max tx_size is 32X32