Remove PALETTE flag
This experiment is now adopted as it was cleared by Tapas.
Note: Palette use can still be controlled by command-line option
"--tune-content=..." in 'aomenc'.
Change-Id: I832f49f20f60c34bdef5b424755849c496687e87
diff --git a/av1/av1.cmake b/av1/av1.cmake
index 5295a1a..46e55bb 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -131,6 +131,8 @@
"${AOM_ROOT}/av1/encoder/mbgraph.h"
"${AOM_ROOT}/av1/encoder/mcomp.c"
"${AOM_ROOT}/av1/encoder/mcomp.h"
+ "${AOM_ROOT}/av1/encoder/palette.c"
+ "${AOM_ROOT}/av1/encoder/palette.h")
"${AOM_ROOT}/av1/encoder/picklpf.c"
"${AOM_ROOT}/av1/encoder/picklpf.h"
"${AOM_ROOT}/av1/encoder/ratectrl.c"
@@ -363,13 +365,6 @@
"${AOM_ROOT}/av1/encoder/encodetxb.h")
endif ()
-if (CONFIG_PALETTE)
- set(AOM_AV1_ENCODER_SOURCES
- ${AOM_AV1_ENCODER_SOURCES}
- "${AOM_ROOT}/av1/encoder/palette.c"
- "${AOM_ROOT}/av1/encoder/palette.h")
-endif ()
-
if (CONFIG_CFL)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
diff --git a/av1/av1_cx.mk b/av1/av1_cx.mk
index 5041fa2..8bc827f 100644
--- a/av1/av1_cx.mk
+++ b/av1/av1_cx.mk
@@ -74,11 +74,9 @@
AV1_CX_SRCS-yes += encoder/treewriter.h
AV1_CX_SRCS-yes += encoder/mcomp.c
AV1_CX_SRCS-yes += encoder/encoder.c
-ifeq ($(CONFIG_PALETTE),yes)
AV1_CX_SRCS-yes += encoder/k_means_template.h
AV1_CX_SRCS-yes += encoder/palette.h
AV1_CX_SRCS-yes += encoder/palette.c
-endif
AV1_CX_SRCS-yes += encoder/picklpf.c
AV1_CX_SRCS-yes += encoder/picklpf.h
AV1_CX_SRCS-$(CONFIG_LOOP_RESTORATION) += encoder/pickrst.c
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 060f820..9e7d0b2 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -307,14 +307,12 @@
typedef int8_t MV_REFERENCE_FRAME;
-#if CONFIG_PALETTE
typedef struct {
// Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
// Value of base colors for Y, U, and V
uint16_t palette_colors[3 * PALETTE_MAX_SIZE];
} PALETTE_MODE_INFO;
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
#define USE_3TAP_INTRA_FILTER 1 // 0: 4-tap; 1: 3-tap
@@ -399,9 +397,8 @@
// Only for INTRA blocks
UV_PREDICTION_MODE uv_mode;
-#if CONFIG_PALETTE
+
PALETTE_MODE_INFO palette_mode_info;
-#endif // CONFIG_PALETTE
#if CONFIG_INTRABC
uint8_t use_intrabc;
#endif // CONFIG_INTRABC
@@ -635,9 +632,7 @@
dequant_val_type_nuq seg_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES]
[COEF_BANDS];
#endif
-#if CONFIG_PALETTE
uint8_t *color_index_map;
-#endif // CONFIG_PALETTE
// number of 4x4s in current block
uint16_t n4_w, n4_h;
diff --git a/av1/common/entropy.c b/av1/common/entropy.c
index 4807d1d..0ef5f55 100644
--- a/av1/common/entropy.c
+++ b/av1/common/entropy.c
@@ -5678,12 +5678,10 @@
AVERAGE_TILE_CDFS(txfm_partition_cdf)
#endif
#endif // CONFIG_NEW_MULTISYMBOL
-#if CONFIG_PALETTE
AVERAGE_TILE_CDFS(palette_y_size_cdf)
AVERAGE_TILE_CDFS(palette_uv_size_cdf)
AVERAGE_TILE_CDFS(palette_y_color_index_cdf)
AVERAGE_TILE_CDFS(palette_uv_color_index_cdf)
-#endif
}
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index eae186e..363e8aa 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1474,7 +1474,6 @@
};
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
-#if CONFIG_PALETTE
// TODO(huisu): tune these cdfs
const aom_cdf_prob
default_palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)] = {
@@ -1740,8 +1739,6 @@
1] = { -1, -1, 0, -1, -1,
4, 3, 2, 1 };
-#endif // CONFIG_PALETTE
-
// The transform size is coded as an offset to the smallest transform
// block size.
const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)] = {
@@ -1807,7 +1804,6 @@
};
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_PALETTE
#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,
@@ -1892,8 +1888,6 @@
#undef NUM_PALETTE_NEIGHBORS
#undef MAX_COLOR_CONTEXT_HASH
-#endif // CONFIG_PALETTE
-
#if CONFIG_VAR_TX
static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
250, 231, 212, 241, 166, 66, 241, 230, 135, 243, 154, 64, 248, 161, 63, 128,
@@ -5059,12 +5053,10 @@
av1_copy(fc->partition_prob, default_partition_probs);
av1_copy(fc->intra_inter_prob, default_intra_inter_p);
av1_copy(fc->comp_inter_prob, default_comp_inter_p);
-#if CONFIG_PALETTE
av1_copy(fc->palette_y_size_cdf, default_palette_y_size_cdf);
av1_copy(fc->palette_uv_size_cdf, default_palette_uv_size_cdf);
av1_copy(fc->palette_y_color_index_cdf, default_palette_y_color_index_cdf);
av1_copy(fc->palette_uv_color_index_cdf, default_palette_uv_color_index_cdf);
-#endif // CONFIG_PALETTE
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf);
#endif // CONFIG_NEW_MULTISYMBOL
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 8fb8089..3177c7e 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -40,7 +40,6 @@
#define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV)
#endif // CONFIG_EXT_INTER
-#if CONFIG_PALETTE
// 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
@@ -70,7 +69,6 @@
#define PALETTE_UV_MODE_CONTEXTS 2
#define PALETTE_MAX_BLOCK_SIZE (64 * 64)
-#endif // CONFIG_PALETTE
#if CONFIG_INTRABC
#define INTRABC_PROB_DEFAULT 192
@@ -234,7 +232,6 @@
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
-#if CONFIG_PALETTE
aom_cdf_prob palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)];
aom_cdf_prob palette_uv_size_cdf[PALETTE_BLOCK_SIZES]
[CDF_SIZE(PALETTE_SIZES)];
@@ -244,7 +241,6 @@
aom_cdf_prob palette_uv_color_index_cdf[PALETTE_SIZES]
[PALETTE_COLOR_INDEX_CONTEXTS]
[CDF_SIZE(PALETTE_COLORS)];
-#endif // CONFIG_PALETTE
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)];
@@ -516,12 +512,10 @@
extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[CDF_SIZE(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[PALETTE_UV_MODE_CONTEXTS];
-#endif // CONFIG_PALETTE
extern const int av1_intra_mode_ind[INTRA_MODES];
extern const int av1_intra_mode_inv[INTRA_MODES];
@@ -552,10 +546,8 @@
#endif
extern const aom_tree_index
av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)];
-#if CONFIG_PALETTE
extern const aom_tree_index
av1_palette_color_index_tree[PALETTE_SIZES][TREE_SIZE(PALETTE_COLORS)];
-#endif // CONFIG_PALETTE
extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)];
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)];
@@ -607,14 +599,12 @@
return i;
}
-#if CONFIG_PALETTE
// 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_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
} // extern "C"
diff --git a/av1/common/enums.h b/av1/common/enums.h
index c225b4a..b017f17 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -385,7 +385,6 @@
(CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
#endif
-#if CONFIG_PALETTE
typedef enum {
TWO_COLORS,
THREE_COLORS,
@@ -408,7 +407,6 @@
PALETTE_COLOR_EIGHT,
PALETTE_COLORS
} PALETTE_COLOR;
-#endif // CONFIG_PALETTE
// Note: All directional predictors must be between V_PRED and D63_PRED (both
// inclusive).
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index b101422..adb07b62 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -232,9 +232,7 @@
int allow_high_precision_mv;
-#if CONFIG_PALETTE || CONFIG_INTRABC
int allow_screen_content_tools;
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if CONFIG_EXT_INTER
#if CONFIG_INTERINTRA
int allow_interintra_compound;
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c
index 0417a67..365d977 100644
--- a/av1/common/pred_common.c
+++ b/av1/common/pred_common.c
@@ -153,7 +153,7 @@
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#if CONFIG_PALETTE_DELTA_ENCODING
int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
int plane, uint16_t *cache) {
int above_n = 0, left_n = 0;
@@ -193,7 +193,7 @@
assert(n <= 2 * PALETTE_MAX_SIZE);
return n;
}
-#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#endif // CONFIG_PALETTE_DELTA_ENCODING
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
diff --git a/av1/common/pred_common.h b/av1/common/pred_common.h
index aab026e..ffdeb6b 100644
--- a/av1/common/pred_common.h
+++ b/av1/common/pred_common.h
@@ -86,14 +86,14 @@
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#if CONFIG_PALETTE_DELTA_ENCODING
// Get a list of palette base colors that are used in the above and left blocks,
// referred to as "color cache". The return value is the number of colors in the
// cache (<= 2 * PALETTE_MAX_SIZE). The color values are stored in "cache"
// in ascending order.
int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
int plane, uint16_t *cache);
-#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#endif // CONFIG_PALETTE_DELTA_ENCODING
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index aea49b2..0357b32 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -2991,7 +2991,6 @@
const int have_bottom_left =
has_bottom_left(bsize, mi_row, mi_col, bottom_available, have_left,
tx_size, row_off, col_off, pd->subsampling_y);
-#if CONFIG_PALETTE
if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) {
const int stride = wpx;
int r, c;
@@ -3020,7 +3019,6 @@
#endif // CONFIG_HIGHBITDEPTH
return;
}
-#endif // CONFIG_PALETTE
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 1b572ae..2d2f113 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1898,12 +1898,10 @@
int row_y, col_y, row_c, col_c;
int plane;
-#if CONFIG_PALETTE
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane])
av1_decode_palette_tokens(xd, plane, r);
}
-#endif
for (row_y = 0; row_y < tu_num_h_y; row_y++) {
for (col_y = 0; col_y < tu_num_w_y; col_y++) {
@@ -1983,12 +1981,10 @@
#else // CONFIG_COEF_INTERLEAVE
if (!is_inter_block(mbmi)) {
int plane;
-#if CONFIG_PALETTE
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane])
av1_decode_palette_tokens(xd, plane, r);
}
-#endif // CONFIG_PALETTE
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = av1_get_tx_size(plane, xd);
@@ -3841,10 +3837,8 @@
td->xd.daala_dec.state.adapt = &td->tctx.pvq_context;
#endif
-#if CONFIG_PALETTE
td->xd.plane[0].color_index_map = td->color_index_map[0];
td->xd.plane[1].color_index_map = td->color_index_map[1];
-#endif // CONFIG_PALETTE
}
}
@@ -4223,10 +4217,8 @@
// Initialise the tile context from the frame context
twd->tctx = *cm->fc;
twd->xd.tile_ctx = &twd->tctx;
-#if CONFIG_PALETTE
twd->xd.plane[0].color_index_map = twd->color_index_map[0];
twd->xd.plane[1].color_index_map = twd->color_index_map[1];
-#endif // CONFIG_PALETTE
worker->had_error = 0;
if (i == num_workers - 1 || tile_col == tile_cols_end - 1) {
@@ -4561,17 +4553,13 @@
#if CONFIG_ANS && ANS_MAX_SYMBOLS
cm->ans_window_size_log2 = aom_rb_read_literal(rb, 4) + 8;
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
-#if CONFIG_PALETTE || CONFIG_INTRABC
cm->allow_screen_content_tools = aom_rb_read_bit(rb);
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if CONFIG_TEMPMV_SIGNALING
cm->use_prev_frame_mvs = 0;
#endif
} else {
cm->intra_only = cm->show_frame ? 0 : aom_rb_read_bit(rb);
-#if CONFIG_PALETTE || CONFIG_INTRABC
if (cm->intra_only) cm->allow_screen_content_tools = aom_rb_read_bit(rb);
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if CONFIG_TEMPMV_SIGNALING
if (cm->intra_only || cm->error_resilient_mode) cm->use_prev_frame_mvs = 0;
#endif
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 13720b0..848772b 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -691,7 +691,6 @@
}
}
-#if CONFIG_PALETTE
#if CONFIG_PALETTE_DELTA_ENCODING
static int uint16_compare(const void *a, const void *b) {
const uint16_t va = *(const uint16_t *)a;
@@ -840,7 +839,6 @@
}
}
}
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
static void read_filter_intra_mode_info(AV1_COMMON *const cm,
@@ -852,11 +850,7 @@
FILTER_INTRA_MODE_INFO *filter_intra_mode_info =
&mbmi->filter_intra_mode_info;
- if (mbmi->mode == DC_PRED
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[0] == 0
-#endif // CONFIG_PALETTE
- ) {
+ if (mbmi->mode == DC_PRED && mbmi->palette_mode_info.palette_size[0] == 0) {
filter_intra_mode_info->use_filter_intra_mode[0] =
aom_read(r, cm->fc->filter_intra_probs[0], ACCT_STR);
if (filter_intra_mode_info->use_filter_intra_mode[0]) {
@@ -879,11 +873,8 @@
(void)mi_col;
#endif // CONFIG_CB4X4
- if (mbmi->uv_mode == UV_DC_PRED
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[1] == 0
-#endif // CONFIG_PALETTE
- ) {
+ if (mbmi->uv_mode == UV_DC_PRED &&
+ mbmi->palette_mode_info.palette_size[1] == 0) {
filter_intra_mode_info->use_filter_intra_mode[1] =
aom_read(r, cm->fc->filter_intra_probs[1], ACCT_STR);
if (filter_intra_mode_info->use_filter_intra_mode[1]) {
@@ -1210,13 +1201,11 @@
#if CONFIG_EXT_INTRA
read_intra_angle_info(cm, xd, r);
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0;
if (bsize >= BLOCK_8X8 && bsize <= BLOCK_LARGEST &&
cm->allow_screen_content_tools)
read_palette_mode_info(cm, xd, r);
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
@@ -1818,12 +1807,10 @@
#if CONFIG_EXT_INTRA
read_intra_angle_info(cm, xd, r);
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0;
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools)
read_palette_mode_info(cm, xd, r);
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
@@ -2241,10 +2228,8 @@
assert(NELEMENTS(mode_2_counter) == MB_MODE_COUNT);
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0;
-#endif // CONFIG_PALETTE
memset(ref_mvs, 0, sizeof(ref_mvs));
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h
index 5e6afc2..b3784e1 100644
--- a/av1/decoder/decoder.h
+++ b/av1/decoder/decoder.h
@@ -54,9 +54,7 @@
CFL_CTX cfl;
#endif
DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
-#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
-#endif // CONFIG_PALETTE
} TileData;
typedef struct TileWorkerData {
@@ -74,9 +72,7 @@
CFL_CTX cfl;
#endif
FRAME_CONTEXT tctx;
-#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
-#endif // CONFIG_PALETTE
struct aom_internal_error_info error_info;
} TileWorkerData;
@@ -213,7 +209,6 @@
}
#endif // CONFIG_EXT_REFS
-#if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
#define ACCT_STR __func__
static INLINE int av1_read_uniform(aom_reader *r, int n) {
const int l = get_unsigned_bits(n);
@@ -225,7 +220,6 @@
else
return (v << 1) - m + aom_read_literal(r, 1, ACCT_STR);
}
-#endif // CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
#ifdef __cplusplus
} // extern "C"
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 89d9ef3..052ba73 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -218,7 +218,6 @@
}
#endif // !CONFIG_PVQ
-#if CONFIG_PALETTE
void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
aom_reader *r) {
const MODE_INFO *const mi = xd->mi[0];
@@ -281,7 +280,6 @@
color_map + (rows - 1) * plane_block_width, plane_block_width);
}
}
-#endif // CONFIG_PALETTE
#if !CONFIG_PVQ || CONFIG_VAR_TX
int av1_decode_block_tokens(AV1_COMMON *cm, MACROBLOCKD *const xd, int plane,
diff --git a/av1/decoder/detokenize.h b/av1/decoder/detokenize.h
index 0e58a28..eb31d58 100644
--- a/av1/decoder/detokenize.h
+++ b/av1/decoder/detokenize.h
@@ -22,9 +22,7 @@
extern "C" {
#endif
-#if CONFIG_PALETTE
void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, aom_reader *r);
-#endif // CONFIG_PALETTE
#if !CONFIG_PVQ || CONFIG_VAR_TX
int av1_decode_block_tokens(AV1_COMMON *cm, MACROBLOCKD *const xd, int plane,
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 61483e3..4a6fbd8 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -50,9 +50,9 @@
#include "av1/encoder/cost.h"
#include "av1/encoder/encodemv.h"
#include "av1/encoder/mcomp.h"
-#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#if CONFIG_PALETTE_DELTA_ENCODING
#include "av1/encoder/palette.h"
-#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+#endif // CONFIG_PALETTE_DELTA_ENCODING
#include "av1/encoder/segmentation.h"
#include "av1/encoder/subexp.h"
#include "av1/encoder/tokenize.h"
@@ -67,7 +67,6 @@
inter_singleref_comp_mode_encodings[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
-#if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
static INLINE void write_uniform(aom_writer *w, int n, int v) {
const int l = get_unsigned_bits(n);
const int m = (1 << l) - n;
@@ -79,7 +78,6 @@
aom_write_literal(w, (v - m) & 1, 1);
}
}
-#endif // CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
#if CONFIG_EXT_TX
static struct av1_token ext_tx_inter_encodings[EXT_TX_SETS_INTER][TX_TYPES];
@@ -622,7 +620,6 @@
}
#endif
-#if CONFIG_PALETTE
static void pack_palette_tokens(aom_writer *w, const TOKENEXTRA **tp, int n,
int num) {
const TOKENEXTRA *p = *tp;
@@ -635,7 +632,6 @@
}
*tp = p;
}
-#endif // CONFIG_PALETTE
#if !CONFIG_PVQ
#if CONFIG_SUPERTX
@@ -1280,11 +1276,7 @@
const MB_MODE_INFO *const mbmi,
int mi_row, int mi_col,
aom_writer *w) {
- if (mbmi->mode == DC_PRED
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[0] == 0
-#endif // CONFIG_PALETTE
- ) {
+ if (mbmi->mode == DC_PRED && mbmi->palette_mode_info.palette_size[0] == 0) {
aom_write(w, mbmi->filter_intra_mode_info.use_filter_intra_mode[0],
cm->fc->filter_intra_probs[0]);
if (mbmi->filter_intra_mode_info.use_filter_intra_mode[0]) {
@@ -1305,11 +1297,8 @@
(void)mi_col;
#endif // CONFIG_CB4X4
- if (mbmi->uv_mode == UV_DC_PRED
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[1] == 0
-#endif // CONFIG_PALETTE
- ) {
+ if (mbmi->uv_mode == UV_DC_PRED &&
+ mbmi->palette_mode_info.palette_size[1] == 0) {
aom_write(w, mbmi->filter_intra_mode_info.use_filter_intra_mode[1],
cm->fc->filter_intra_probs[1]);
if (mbmi->filter_intra_mode_info.use_filter_intra_mode[1]) {
@@ -1400,7 +1389,6 @@
}
}
-#if CONFIG_PALETTE
#if CONFIG_PALETTE_DELTA_ENCODING
// Transmit color values with delta encoding. Write the first value as
// literal, and the deltas between each value and the previous one. "min_val" is
@@ -1590,7 +1578,6 @@
}
}
}
-#endif // CONFIG_PALETTE
void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
#if CONFIG_SUPERTX
@@ -1878,10 +1865,8 @@
#if CONFIG_EXT_INTRA
write_intra_angle_info(xd, ec_ctx, w);
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools)
write_palette_mode_info(cm, xd, mi, w);
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (bsize >= BLOCK_8X8 || unify_bsize)
write_filter_intra_mode_info(cm, xd, mbmi, mi_row, mi_col, w);
@@ -2286,11 +2271,9 @@
#if CONFIG_EXT_INTRA
write_intra_angle_info(xd, ec_ctx, w);
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
if (bsize >= BLOCK_8X8 && bsize <= BLOCK_LARGEST &&
cm->allow_screen_content_tools)
write_palette_mode_info(cm, xd, mi, w);
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (bsize >= BLOCK_8X8 || unify_bsize)
write_filter_intra_mode_info(cm, xd, mbmi, mi_row, mi_col, w);
@@ -2536,7 +2519,6 @@
#endif // CONFIG_DEPENDENT_HORZTILES
cm->mi_rows, cm->mi_cols);
-#if CONFIG_PALETTE
for (plane = 0; plane <= 1; ++plane) {
const uint8_t palette_size_plane =
mbmi->palette_mode_info.palette_size[plane];
@@ -2553,7 +2535,6 @@
assert(*tok < tok_end + mbmi->skip);
}
}
-#endif // CONFIG_PALETTE
#if CONFIG_COEF_INTERLEAVE
if (!mbmi->skip) {
@@ -4349,14 +4330,10 @@
assert(cpi->common.ans_window_size_log2 < 24);
aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
-#if CONFIG_PALETTE || CONFIG_INTRABC
aom_wb_write_bit(wb, cm->allow_screen_content_tools);
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
} else {
if (!cm->show_frame) aom_wb_write_bit(wb, cm->intra_only);
-#if CONFIG_PALETTE || CONFIG_INTRABC
if (cm->intra_only) aom_wb_write_bit(wb, cm->allow_screen_content_tools);
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING
if (!cm->error_resilient_mode) {
if (cm->intra_only) {
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 5d6b08f..2bdfff3 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -89,12 +89,10 @@
int row_max;
} MvLimits;
-#if CONFIG_PALETTE
typedef struct {
uint8_t best_palette_color_map[MAX_SB_SQUARE];
float kmeans_data_buf[2 * MAX_SB_SQUARE];
} PALETTE_BUFFER;
-#endif // CONFIG_PALETTE
typedef struct macroblock MACROBLOCK;
struct macroblock {
@@ -148,9 +146,7 @@
uint8_t *left_pred_buf;
#endif // CONFIG_MOTION_VAR
-#if CONFIG_PALETTE
PALETTE_BUFFER *palette_buffer;
-#endif // CONFIG_PALETTE
// These define limits to motion vector components to prevent them
// from extending outside the UMV borders
@@ -206,14 +202,12 @@
int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX]
[PARTITION_TYPES];
#endif // CONFIG_EXT_PARTITION_TYPES
-#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_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS];
int palette_uv_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
[PALETTE_COLORS];
-#endif // CONFIG_PALETTE
int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES];
#if CONFIG_EXT_TX
int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c
index b1c01b2..41ca53e 100644
--- a/av1/encoder/context_tree.c
+++ b/av1/encoder/context_tree.c
@@ -64,13 +64,11 @@
#endif
}
-#if CONFIG_PALETTE
for (i = 0; i < 2; ++i) {
CHECK_MEM_ERROR(
cm, ctx->color_index_map[i],
aom_memalign(32, num_pix * sizeof(*ctx->color_index_map[i])));
}
-#endif // CONFIG_PALETTE
}
static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
@@ -98,12 +96,10 @@
#endif
}
-#if CONFIG_PALETTE
for (i = 0; i < 2; ++i) {
aom_free(ctx->color_index_map[i]);
ctx->color_index_map[i] = 0;
}
-#endif // CONFIG_PALETTE
}
static void alloc_tree_contexts(AV1_COMMON *cm, PC_TREE *tree,
diff --git a/av1/encoder/context_tree.h b/av1/encoder/context_tree.h
index bcfcc27..8027a3f 100644
--- a/av1/encoder/context_tree.h
+++ b/av1/encoder/context_tree.h
@@ -27,9 +27,7 @@
typedef struct {
MODE_INFO mic;
MB_MODE_INFO_EXT mbmi_ext;
-#if CONFIG_PALETTE
uint8_t *color_index_map[2];
-#endif // CONFIG_PALETTE
#if CONFIG_VAR_TX
uint8_t *blk_skip[MAX_MB_PLANE];
#endif
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index f1982d8..b157a69 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -649,9 +649,7 @@
p[i].txb_entropy_ctx = ctx->txb_entropy_ctx[i];
#endif // CONFIG_LV_MAP
}
-#if CONFIG_PALETTE
for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
-#endif // CONFIG_PALETTE
// Restore the coding context of the MB to that that was in place
// when the mode was picked for it
for (y = 0; y < mi_height; y++)
@@ -1413,9 +1411,7 @@
#endif
}
-#if CONFIG_PALETTE
for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
-#endif // CONFIG_PALETTE
ctx->skippable = 0;
@@ -5012,7 +5008,6 @@
}
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_PALETTE
// Estimate if the source frame is screen content, based on the portion of
// blocks that have no more than 4 (experimentally selected) luma colors.
static int is_screen_content(const uint8_t *src,
@@ -5040,7 +5035,6 @@
// The threshold is 10%.
return counts * blk_h * blk_w * 10 > width * height;
}
-#endif // CONFIG_PALETTE
static void encode_frame_internal(AV1_COMP *cpi) {
ThreadData *const td = &cpi->td;
@@ -5068,9 +5062,7 @@
av1_zero(rdc->coef_counts);
av1_zero(rdc->comp_pred_diff);
-#if CONFIG_PALETTE || CONFIG_INTRABC
if (frame_is_intra_only(cm)) {
-#if CONFIG_PALETTE
cm->allow_screen_content_tools =
cpi->oxcf.content == AOM_CONTENT_SCREEN ||
is_screen_content(cpi->source->y_buffer,
@@ -5079,11 +5071,7 @@
#endif // CONFIG_HIGHBITDEPTH
cpi->source->y_stride, cpi->source->y_width,
cpi->source->y_height);
-#else
- cm->allow_screen_content_tools = cpi->oxcf.content == AOM_CONTENT_SCREEN;
-#endif // CONFIG_PALETTE
}
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if CONFIG_GLOBAL_MOTION
av1_zero(rdc->global_motion_used);
@@ -5702,11 +5690,7 @@
}
#endif // CONFIG_ENTROPY_STATS
#if CONFIG_FILTER_INTRA
- if (mbmi->mode == DC_PRED
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[0] == 0
-#endif // CONFIG_PALETTE
- ) {
+ if (mbmi->mode == DC_PRED && mbmi->palette_mode_info.palette_size[0] == 0) {
const int use_filter_intra_mode =
mbmi->filter_intra_mode_info.use_filter_intra_mode[0];
++counts->filter_intra[0][use_filter_intra_mode];
@@ -5717,10 +5701,7 @@
is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y)
#endif
-#if CONFIG_PALETTE
- && mbmi->palette_mode_info.palette_size[1] == 0
-#endif // CONFIG_PALETTE
- ) {
+ && mbmi->palette_mode_info.palette_size[1] == 0) {
const int use_filter_intra_mode =
mbmi->filter_intra_mode_info.use_filter_intra_mode[1];
++counts->filter_intra[1][use_filter_intra_mode];
@@ -5978,14 +5959,12 @@
sum_intra_stats(td->counts, xd, mi, xd->above_mi, xd->left_mi,
frame_is_intra_only(cm), mi_row, mi_col);
}
-#if CONFIG_PALETTE
if (bsize >= BLOCK_8X8 && !dry_run) {
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane] > 0)
av1_tokenize_palette_sb(td, plane, t, dry_run, bsize, rate);
}
}
-#endif // CONFIG_PALETTE
#if CONFIG_VAR_TX
mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
#endif
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 2dadc97..da2370b9 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -529,9 +529,7 @@
av1_free_pc_tree(&cpi->td);
-#if CONFIG_PALETTE
aom_free(cpi->td.mb.palette_buffer);
-#endif // CONFIG_PALETTE
#if CONFIG_ANS
aom_buf_ans_free(&cpi->buf_ans);
@@ -2323,12 +2321,10 @@
cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE;
#endif
-#if CONFIG_PALETTE
if (x->palette_buffer == NULL) {
CHECK_MEM_ERROR(cm, x->palette_buffer,
aom_memalign(16, sizeof(*x->palette_buffer)));
}
-#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTER
set_compound_tools(cm);
#endif // CONFIG_EXT_INTER
@@ -2962,9 +2958,7 @@
// Deallocate allocated thread data.
if (t < cpi->num_workers - 1) {
-#if CONFIG_PALETTE
aom_free(thread_data->td->palette_buffer);
-#endif // CONFIG_PALETTE
#if CONFIG_MOTION_VAR
aom_free(thread_data->td->above_pred_buf);
aom_free(thread_data->td->left_pred_buf);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index e71c91c..1902647 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -350,9 +350,7 @@
uint8_t *left_pred_buf;
#endif
-#if CONFIG_PALETTE
PALETTE_BUFFER *palette_buffer;
-#endif // CONFIG_PALETTE
} ThreadData;
struct EncWorkerData;
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 1aa1d52..1768757 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -124,12 +124,10 @@
CHECK_MEM_ERROR(cm, thread_data->td->counts,
aom_calloc(1, sizeof(*thread_data->td->counts)));
-#if CONFIG_PALETTE
// Allocate buffers used by palette coding mode.
CHECK_MEM_ERROR(
cm, thread_data->td->palette_buffer,
aom_memalign(16, sizeof(*thread_data->td->palette_buffer)));
-#endif // CONFIG_PALETTE
// Create threads
if (!winterface->reset(worker))
@@ -169,10 +167,8 @@
sizeof(cpi->common.counts));
}
-#if CONFIG_PALETTE
if (i < num_workers - 1)
thread_data->td->mb.palette_buffer = thread_data->td->palette_buffer;
-#endif // CONFIG_PALETTE
}
// Encode a frame
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index d6867f0..073b714 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -117,7 +117,6 @@
fc->switchable_interp_cdf[i],
av1_switchable_interp_inv);
-#if CONFIG_PALETTE
for (i = 0; i < PALETTE_BLOCK_SIZES; ++i) {
av1_cost_tokens_from_cdf(x->palette_y_size_cost[i],
fc->palette_y_size_cdf[i], NULL);
@@ -133,7 +132,6 @@
fc->palette_uv_color_index_cdf[i][j], NULL);
}
}
-#endif // CONFIG_PALETTE
for (i = 0; i < MAX_TX_DEPTH; ++i)
for (j = 0; j < TX_SIZE_CONTEXTS; ++j)
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ba45253..d22719d 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -51,9 +51,7 @@
#endif
#include "av1/encoder/hybrid_fwd_txfm.h"
#include "av1/encoder/mcomp.h"
-#if CONFIG_PALETTE
#include "av1/encoder/palette.h"
-#endif // CONFIG_PALETTE
#include "av1/encoder/ratectrl.h"
#include "av1/encoder/rd.h"
#include "av1/encoder/rdopt.h"
@@ -664,7 +662,6 @@
#define uv_rd_search_mode_order intra_rd_search_mode_order
#endif // CONFIG_CFL
-#if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
static INLINE int write_uniform_cost(int n, int v) {
const int l = get_unsigned_bits(n);
const int m = (1 << l) - n;
@@ -674,7 +671,6 @@
else
return l * av1_cost_bit(128, 0);
}
-#endif // CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
// constants for prune 1 and prune 2 decision boundaries
#define FAST_EXT_TX_CORR_MID 0.0
@@ -1872,7 +1868,6 @@
visible_rows);
}
-#if CONFIG_PALETTE || CONFIG_INTRABC
int av1_count_colors(const uint8_t *src, int stride, int rows, int cols) {
int val_count[256];
memset(val_count, 0, sizeof(val_count));
@@ -1907,7 +1902,6 @@
return n;
}
#endif // CONFIG_HIGHBITDEPTH
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
BLOCK_SIZE plane_bsize, int block, int blk_row, int blk_col,
@@ -3048,7 +3042,6 @@
return this_rd;
}
-#if CONFIG_PALETTE
// Extends 'color_map' array from 'orig_width x orig_height' to 'new_width x
// new_height'. Extra rows and columns are filled in by copying last valid
// row/column.
@@ -3284,7 +3277,6 @@
*mbmi = *best_mbmi;
return rate_overhead;
}
-#endif // CONFIG_PALETTE
static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const AV1_COMP *const cpi, MACROBLOCK *x, int row, int col,
@@ -3357,9 +3349,7 @@
xd->mi[0]->mbmi.tx_size = tx_size;
-#if CONFIG_PALETTE
xd->mi[0]->mbmi.palette_mode_info.palette_size[0] = 0;
-#endif // CONFIG_PALETTE
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -3908,9 +3898,7 @@
av1_zero(filter_intra_mode_info);
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 1;
mbmi->mode = DC_PRED;
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
-#endif // CONFIG_PALETTE
for (mode = 0; mode < FILTER_INTRA_MODES; ++mode) {
int this_rate;
@@ -4270,14 +4258,12 @@
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
// Returns true if palette can be used for this block.
static int can_use_palette(const AV1_COMP *const cpi,
const MB_MODE_INFO *const mbmi) {
return cpi->common.allow_screen_content_tools && mbmi->sb_type >= BLOCK_8X8 &&
mbmi->sb_type <= BLOCK_LARGEST;
}
-#endif // CONFIG_PALETTE
// This function is used only for intra_only frames
static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
@@ -4306,7 +4292,6 @@
uint16_t filter_intra_mode_skip_mask = (1 << FILTER_INTRA_MODES) - 1;
#endif // CONFIG_FILTER_INTRA
const int *bmode_costs;
-#if CONFIG_PALETTE
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
uint8_t *best_palette_color_map =
cpi->common.allow_screen_content_tools
@@ -4314,7 +4299,6 @@
: NULL;
int palette_y_mode_ctx = 0;
const int try_palette = can_use_palette(cpi, mbmi);
-#endif // CONFIG_PALETTE
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
const PREDICTION_MODE A = av1_above_block_mode(mic, above_mi, 0);
@@ -4342,14 +4326,12 @@
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
#endif // CONFIG_FILTER_INTRA
-#if CONFIG_PALETTE
pmi->palette_size[0] = 0;
if (above_mi)
palette_y_mode_ctx +=
(above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
if (left_mi)
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)
x->use_default_intra_tx_type = 1;
@@ -4408,14 +4390,12 @@
// not the tokenonly rate.
this_rate_tokenonly -= tx_size_cost(cpi, x, bsize, mbmi->tx_size);
}
-#if CONFIG_PALETTE
if (try_palette && mbmi->mode == DC_PRED) {
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)
this_rate += av1_cost_bit(cpi->common.fc->filter_intra_probs[0], 0);
@@ -4461,14 +4441,12 @@
od_encode_rollback(&x->daala_enc, &post_buf);
#endif // CONFIG_PVQ
-#if CONFIG_PALETTE
if (try_palette) {
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
#if CONFIG_FILTER_INTRA
if (beat_best_rd) {
@@ -5516,7 +5494,6 @@
}
#endif // CONFIG_VAR_TX
-#if CONFIG_PALETTE
static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
int dc_mode_cost,
uint8_t *best_palette_color_map,
@@ -5708,7 +5685,6 @@
rows * cols * sizeof(best_palette_color_map[0]));
}
}
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
// Return 1 if an filter intra mode is selected; return 0 otherwise.
@@ -5728,9 +5704,7 @@
av1_zero(filter_intra_mode_info);
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 1;
mbmi->uv_mode = UV_DC_PRED;
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[1] = 0;
-#endif // CONFIG_PALETTE
for (mode = 0; mode < FILTER_INTRA_MODES; ++mode) {
mbmi->filter_intra_mode_info.filter_intra_mode[1] = mode;
@@ -6025,9 +5999,7 @@
static void init_sbuv_mode(MB_MODE_INFO *const mbmi) {
mbmi->uv_mode = UV_DC_PRED;
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[1] = 0;
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
#endif // CONFIG_FILTER_INTRA
@@ -6046,10 +6018,8 @@
od_rollback_buffer buf;
od_encode_checkpoint(&x->daala_enc, &buf);
#endif // CONFIG_PVQ
-#if CONFIG_PALETTE
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
const int try_palette = can_use_palette(cpi, mbmi);
-#endif // CONFIG_PALETTE
for (int mode_idx = 0; mode_idx < UV_INTRA_MODES; ++mode_idx) {
int this_rate;
@@ -6109,11 +6079,9 @@
if (mbmi->sb_type >= BLOCK_8X8 && mode == DC_PRED)
this_rate += av1_cost_bit(cpi->common.fc->filter_intra_probs[1], 0);
#endif // CONFIG_FILTER_INTRA
-#if CONFIG_PALETTE
if (try_palette && mode == UV_DC_PRED)
this_rate += av1_cost_bit(
av1_default_palette_uv_mode_prob[pmi->palette_size[0] > 0], 0);
-#endif // CONFIG_PALETTE
#if CONFIG_PVQ
od_encode_rollback(&x->daala_enc, &buf);
@@ -6130,7 +6098,6 @@
}
}
-#if CONFIG_PALETTE
if (try_palette) {
uint8_t *best_palette_color_map = x->palette_buffer->best_palette_color_map;
rd_pick_palette_intra_sbuv(cpi, x,
@@ -6138,7 +6105,6 @@
best_palette_color_map, &best_mbmi, &best_rd,
rate, rate_tokenonly, distortion, skippable);
}
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (mbmi->sb_type >= BLOCK_8X8) {
@@ -9827,9 +9793,7 @@
if (mv_check_bounds(&x->mv_limits, &dv)) continue;
if (!is_dv_valid(dv, tile, mi_row, mi_col, bsize)) continue;
-#if CONFIG_PALETTE
memset(&mbmi->palette_mode_info, 0, sizeof(mbmi->palette_mode_info));
-#endif
mbmi->use_intrabc = 1;
mbmi->mode = DC_PRED;
mbmi->uv_mode = UV_DC_PRED;
@@ -10068,7 +10032,6 @@
av1_active_v_edge(cpi, mi_col, cpi->common.mib_size);
}
-#if CONFIG_PALETTE
static void restore_uv_color_map(const AV1_COMP *const cpi, MACROBLOCK *x) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@@ -10118,7 +10081,6 @@
extend_palette_color_map(color_map, cols, rows, plane_block_width,
plane_block_height);
}
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
static void pick_filter_intra_interframe(
@@ -10129,12 +10091,10 @@
#if CONFIG_EXT_INTRA
int8_t *uv_angle_delta,
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
- PALETTE_MODE_INFO *pmi_uv, int palette_ctx,
-#endif // CONFIG_PALETTE
- int skip_mask, unsigned int *ref_costs_single, int64_t *best_rd,
- int64_t *best_intra_rd, PREDICTION_MODE *best_intra_mode,
- int *best_mode_index, int *best_skip2, int *best_mode_skippable,
+ PALETTE_MODE_INFO *pmi_uv, int palette_ctx, int skip_mask,
+ unsigned int *ref_costs_single, int64_t *best_rd, int64_t *best_intra_rd,
+ PREDICTION_MODE *best_intra_mode, int *best_mode_index, int *best_skip2,
+ int *best_mode_skippable,
#if CONFIG_SUPERTX
int *returnrate_nocoef,
#endif // CONFIG_SUPERTX
@@ -10142,10 +10102,8 @@
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-#if CONFIG_PALETTE
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
const int try_palette = can_use_palette(cpi, mbmi);
-#endif // CONFIG_PALETTE
int rate2 = 0, rate_y = INT_MAX, skippable = 0, rate_uv, rate_dummy, i;
int dc_mode_index;
const int *const intra_mode_cost = x->mbmode_cost[size_group_lookup[bsize]];
@@ -10179,9 +10137,7 @@
choose_intra_uv_mode(cpi, x, bsize, uv_tx, &rate_uv_intra[uv_tx],
&rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx],
&skip_uv[uv_tx], &mode_uv[uv_tx]);
-#if CONFIG_PALETTE
if (cm->allow_screen_content_tools) pmi_uv[uv_tx] = *pmi;
-#endif // CONFIG_PALETTE
filter_intra_mode_info_uv[uv_tx] = mbmi->filter_intra_mode_info;
#if CONFIG_EXT_INTRA
uv_angle_delta[uv_tx] = mbmi->angle_delta[1];
@@ -10192,14 +10148,12 @@
distortion_uv = dist_uv[uv_tx];
skippable = skippable && skip_uv[uv_tx];
mbmi->uv_mode = mode_uv[uv_tx];
-#if CONFIG_PALETTE
if (cm->allow_screen_content_tools) {
pmi->palette_size[1] = pmi_uv[uv_tx].palette_size[1];
memcpy(pmi->palette_colors + PALETTE_MAX_SIZE,
pmi_uv[uv_tx].palette_colors + PALETTE_MAX_SIZE,
2 * PALETTE_MAX_SIZE * sizeof(pmi->palette_colors[0]));
}
-#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
mbmi->angle_delta[1] = uv_angle_delta[uv_tx];
#endif // CONFIG_EXT_INTRA
@@ -10212,11 +10166,9 @@
rate2 = rate_y + intra_mode_cost[mbmi->mode] + rate_uv +
x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode];
-#if CONFIG_PALETTE
if (try_palette && mbmi->mode == DC_PRED)
rate2 += av1_cost_bit(
av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx], 0);
-#endif // CONFIG_PALETTE
if (!xd->lossless[mbmi->segment_id]) {
// super_block_yrd above includes the cost of the tx_size in the
@@ -10313,10 +10265,8 @@
const SPEED_FEATURES *const sf = &cpi->sf;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-#if CONFIG_PALETTE
const int try_palette = can_use_palette(cpi, mbmi);
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
-#endif // CONFIG_PALETTE
MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const struct segmentation *const seg = &cm->seg;
PREDICTION_MODE this_mode;
@@ -10372,9 +10322,7 @@
int64_t dist_uvs[TX_SIZES_ALL];
int skip_uvs[TX_SIZES_ALL];
UV_PREDICTION_MODE mode_uv[TX_SIZES_ALL];
-#if CONFIG_PALETTE
PALETTE_MODE_INFO pmi_uv[TX_SIZES_ALL];
-#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
int8_t uv_angle_delta[TX_SIZES_ALL];
int is_directional_mode, angle_stats_ready = 0;
@@ -10421,15 +10369,11 @@
{ { 0 } },
};
-#if CONFIG_PALETTE || CONFIG_EXT_INTRA
const int rows = block_size_high[bsize];
const int cols = block_size_wide[bsize];
-#endif // CONFIG_PALETTE || CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
int palette_ctx = 0;
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
-#endif // CONFIG_PALETTE
#if CONFIG_MOTION_VAR
int dst_width1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
int dst_width2[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
@@ -10464,7 +10408,6 @@
av1_zero(best_mbmode);
-#if CONFIG_PALETTE
av1_zero(pmi_uv);
if (try_palette) {
if (above_mi)
@@ -10472,7 +10415,6 @@
if (left_mi)
palette_ctx += (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
}
-#endif // CONFIG_PALETTE
estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p);
@@ -10932,10 +10874,8 @@
mbmi->uv_mode = UV_DC_PRED;
mbmi->ref_frame[0] = ref_frame;
mbmi->ref_frame[1] = second_ref_frame;
-#if CONFIG_PALETTE
pmi->palette_size[0] = 0;
pmi->palette_size[1] = 0;
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
@@ -11020,9 +10960,7 @@
choose_intra_uv_mode(cpi, x, bsize, uv_tx, &rate_uv_intra[uv_tx],
&rate_uv_tokenonly[uv_tx], &dist_uvs[uv_tx],
&skip_uvs[uv_tx], &mode_uv[uv_tx]);
-#if CONFIG_PALETTE
if (try_palette) pmi_uv[uv_tx] = *pmi;
-#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
uv_angle_delta[uv_tx] = mbmi->angle_delta[1];
@@ -11036,14 +10974,12 @@
distortion_uv = dist_uvs[uv_tx];
skippable = skippable && skip_uvs[uv_tx];
mbmi->uv_mode = mode_uv[uv_tx];
-#if CONFIG_PALETTE
if (try_palette) {
pmi->palette_size[1] = pmi_uv[uv_tx].palette_size[1];
memcpy(pmi->palette_colors + PALETTE_MAX_SIZE,
pmi_uv[uv_tx].palette_colors + PALETTE_MAX_SIZE,
2 * PALETTE_MAX_SIZE * sizeof(pmi->palette_colors[0]));
}
-#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
mbmi->angle_delta[1] = uv_angle_delta[uv_tx];
@@ -11066,12 +11002,10 @@
x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode];
#endif // CONFIG_CB4X4
-#if CONFIG_PALETTE
if (try_palette && mbmi->mode == DC_PRED) {
rate2 += av1_cost_bit(
av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx], 0);
}
-#endif // CONFIG_PALETTE
if (!xd->lossless[mbmi->segment_id] && bsize >= BLOCK_8X8) {
// super_block_yrd above includes the cost of the tx_size in the
@@ -11887,7 +11821,6 @@
}
#endif
-#if CONFIG_PALETTE
// Only try palette mode when the best mode so far is an intra mode.
if (try_palette && !is_inter_mode(best_mbmode.mode)) {
int rate2 = 0;
@@ -11983,15 +11916,11 @@
}
}
PALETTE_EXIT:
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
// TODO(huisu): filter-intra is turned off in lossless mode for now to
// avoid a unit test failure
- if (!xd->lossless[mbmi->segment_id] &&
-#if CONFIG_PALETTE
- pmi->palette_size[0] == 0 &&
-#endif // CONFIG_PALETTE
+ if (!xd->lossless[mbmi->segment_id] && pmi->palette_size[0] == 0 &&
!dc_skipped && best_mode_index >= 0 &&
best_intra_rd < (best_rd + (best_rd >> 3))) {
pick_filter_intra_interframe(
@@ -12000,11 +11929,8 @@
#if CONFIG_EXT_INTRA
uv_angle_delta,
#endif // CONFIG_EXT_INTRA
-#if CONFIG_PALETTE
- pmi_uv, palette_ctx,
-#endif // CONFIG_PALETTE
- 0, ref_costs_single, &best_rd, &best_intra_rd, &best_intra_mode,
- &best_mode_index, &best_skip2, &best_mode_skippable,
+ pmi_uv, palette_ctx, 0, ref_costs_single, &best_rd, &best_intra_rd,
+ &best_intra_mode, &best_mode_index, &best_skip2, &best_mode_skippable,
#if CONFIG_SUPERTX
returnrate_nocoef,
#endif // CONFIG_SUPERTX
@@ -12285,12 +12211,10 @@
store_coding_context(x, ctx, best_mode_index, best_pred_diff,
best_mode_skippable);
-#if CONFIG_PALETTE
if (pmi->palette_size[1] > 0) {
assert(try_palette);
restore_uv_color_map(cpi, x);
}
-#endif // CONFIG_PALETTE
}
void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
@@ -12331,10 +12255,8 @@
assert(segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP));
-#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0;
-#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
diff --git a/av1/encoder/rdopt.h b/av1/encoder/rdopt.h
index 83c3fb8..e1b5b2d 100644
--- a/av1/encoder/rdopt.h
+++ b/av1/encoder/rdopt.h
@@ -57,7 +57,6 @@
OUTPUT_HAS_DECODED_PIXELS
} OUTPUT_STATUS;
-#if CONFIG_PALETTE || CONFIG_INTRABC
// Returns the number of colors in 'src'.
int av1_count_colors(const uint8_t *src, int stride, int rows, int cols);
#if CONFIG_HIGHBITDEPTH
@@ -65,7 +64,6 @@
int av1_count_colors_highbd(const uint8_t *src8, int stride, int rows, int cols,
int bit_depth);
#endif // CONFIG_HIGHBITDEPTH
-#endif // CONFIG_PALETTE || CONFIG_INTRABC
void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
BLOCK_SIZE plane_bsize, int block, int blk_row, int blk_col,
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 2cc918e..f7fe706 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -329,7 +329,6 @@
}
#endif // !CONFIG_PVQ || CONFIG_VAR_TX
-#if CONFIG_PALETTE
void av1_tokenize_palette_sb(const struct ThreadData *const td, int plane,
TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
int *rate) {
@@ -379,7 +378,6 @@
}
if (rate) *rate += this_rate;
}
-#endif // CONFIG_PALETTE
#if CONFIG_PVQ
static void add_pvq_block(AV1_COMMON *const cm, MACROBLOCK *const x,
diff --git a/av1/encoder/tokenize.h b/av1/encoder/tokenize.h
index 5827ee3..02c0be6 100644
--- a/av1/encoder/tokenize.h
+++ b/av1/encoder/tokenize.h
@@ -37,9 +37,7 @@
typedef struct {
aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
-#if CONFIG_PALETTE
aom_cdf_prob *palette_cdf;
-#endif // CONFIG_PALETTE
int eob_val;
int first_val;
const aom_prob *context_tree;
@@ -76,11 +74,9 @@
TOKENEXTRA **t, RUN_TYPE dry_run, int mi_row,
int mi_col, BLOCK_SIZE bsize, int *rate);
#endif
-#if CONFIG_PALETTE
void av1_tokenize_palette_sb(const struct ThreadData *const td, int plane,
TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
int *rate);
-#endif // CONFIG_PALETTE
void av1_tokenize_sb(const struct AV1_COMP *cpi, struct ThreadData *td,
TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
int *rate, const int mi_row, const int mi_col);
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 5b13147..aacb1ac 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -174,7 +174,6 @@
set(CONFIG_NEW_QUANT 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_NO_FRAME_CONTEXT_SIGNALING 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_ONE_SIDED_COMPOUND 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_PALETTE 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_PALETTE_DELTA_ENCODING 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_PALETTE_THROUGHPUT 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_PARALLEL_DEBLOCKING 1 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index 664e97f..ce82e73 100755
--- a/configure
+++ b/configure
@@ -526,7 +526,6 @@
# Enable low-bitdepth pixel pipeline by default
soft_enable lowbitdepth
- soft_enable palette
soft_enable alt_intra
soft_enable palette_throughput
soft_enable tempmv_signaling
@@ -544,7 +543,6 @@
enabled pvq && disable_feature palette
enabled pvq && disable_feature palette_throughput
enabled mrc_tx && enable_feature ext_tx
- enabled palette_throughput && soft_enable palette
enabled ext_delta_q && soft_enable delta_q
enabled txk_sel && soft_enable lv_map
enabled compound_round && soft_enable convolve_round
diff --git a/test/end_to_end_test.cc b/test/end_to_end_test.cc
index 93bc162..e1a833e 100644
--- a/test/end_to_end_test.cc
+++ b/test/end_to_end_test.cc
@@ -128,13 +128,11 @@
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
encoder->Control(AV1E_SET_TILE_COLUMNS, 4);
encoder->Control(AOME_SET_CPUUSED, cpu_used_);
-#if CONFIG_PALETTE
// Test screen coding tools at cpu_used = 1 && encoding mode is two-pass.
if (cpu_used_ == 1 && encoding_mode_ == ::libaom_test::kTwoPassGood)
encoder->Control(AV1E_SET_TUNE_CONTENT, AOM_CONTENT_SCREEN);
else
encoder->Control(AV1E_SET_TUNE_CONTENT, AOM_CONTENT_DEFAULT);
-#endif // CONFIG_PALETTE
if (encoding_mode_ != ::libaom_test::kRealTime) {
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);