Commit a8810391 authored by Yushin Cho's avatar Yushin Cho

Disable palette coding if pvq is enabled

PVQ has been broken again since the experiment flag for palette is removed
in commit c6300aa1.

As a fix, if PVQ is enabled then disable both of --tune-content=screen and
automatic detection of screen and use of palette coding tool.

Change-Id: Iea6bb042b4402163805c44dabfb3f4c05dfd4e23
parent ead552a9
......@@ -334,6 +334,14 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
if (extra_cfg->tuning == AOM_TUNE_SSIM)
ERROR("Option --tune=ssim is not currently supported in AV1.");
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if CONFIG_PVQ
if (extra_cfg->content == AOM_CONTENT_SCREEN)
ERROR(
"Option --tune-content=screen is not currently supported when PVQ is "
"enabled.");
#endif // CONFIG_PVQ
if (cfg->g_pass == AOM_RC_LAST_PASS) {
#if !CONFIG_XIPHRC
const size_t packet_sz = sizeof(FIRSTPASS_STATS);
......
......@@ -1830,10 +1830,13 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
int row_y, col_y, row_c, col_c;
int plane;
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane])
av1_decode_palette_tokens(xd, plane, r);
}
#endif // !CONFIG_PVQ
for (row_y = 0; row_y < tu_num_h_y; row_y++) {
for (col_y = 0; col_y < tu_num_w_y; col_y++) {
......@@ -1913,10 +1916,15 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#else // CONFIG_COEF_INTERLEAVE
if (!is_inter_block(mbmi)) {
int plane;
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane])
av1_decode_palette_tokens(xd, plane, r);
}
#endif // #if !CONFIG_PVQ
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);
......
......@@ -64,6 +64,8 @@ static struct av1_token
inter_singleref_comp_mode_encodings[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ || CONFIG_EXT_INTRA
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;
......@@ -75,6 +77,7 @@ static INLINE void write_uniform(aom_writer *w, int n, int v) {
aom_write_literal(w, (v - m) & 1, 1);
}
}
#endif // !CONFIG_PVQ || CONFIG_EXT_INTRA
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
......@@ -579,6 +582,8 @@ static void update_skip_probs(AV1_COMMON *cm, aom_writer *w,
}
#endif
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
static void pack_map_tokens(aom_writer *w, const TOKENEXTRA **tp, int n,
int num) {
const TOKENEXTRA *p = *tp;
......@@ -591,6 +596,7 @@ static void pack_map_tokens(aom_writer *w, const TOKENEXTRA **tp, int n,
}
*tp = p;
}
#endif // !CONFIG_PVQ
#if !CONFIG_PVQ
#if CONFIG_SUPERTX
......@@ -2486,6 +2492,8 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
#endif // CONFIG_DEPENDENT_HORZTILES
cm->mi_rows, cm->mi_cols);
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
for (plane = 0; plane <= 1; ++plane) {
const uint8_t palette_size_plane =
mbmi->palette_mode_info.palette_size[plane];
......@@ -2504,6 +2512,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
#endif // !CONFIG_LV_MAP
}
}
#endif // !CONFIG_PVQ
#if CONFIG_COEF_INTERLEAVE
if (!mbmi->skip) {
......
......@@ -5084,6 +5084,8 @@ static int do_gm_search_logic(SPEED_FEATURES *const sf, int num_refs_using_gm,
}
#endif // CONFIG_GLOBAL_MOTION
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
// 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,
......@@ -5111,6 +5113,7 @@ static int is_screen_content(const uint8_t *src,
// The threshold is 10%.
return counts * blk_h * blk_w * 10 > width * height;
}
#endif // !CONFIG_PVQ
static void encode_frame_internal(AV1_COMP *cpi) {
ThreadData *const td = &cpi->td;
......@@ -5142,6 +5145,8 @@ static void encode_frame_internal(AV1_COMP *cpi) {
av1_zero(rdc->comp_pred_diff);
if (frame_is_intra_only(cm)) {
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
cm->allow_screen_content_tools =
cpi->oxcf.content == AOM_CONTENT_SCREEN ||
is_screen_content(cpi->source->y_buffer,
......@@ -5150,6 +5155,9 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#endif // CONFIG_HIGHBITDEPTH
cpi->source->y_stride, cpi->source->y_width,
cpi->source->y_height);
#else
cm->allow_screen_content_tools = 0;
#endif // !CONFIG_PVQ
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
......@@ -6123,6 +6131,9 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
sum_intra_stats(td->counts, xd, mi, xd->above_mi, xd->left_mi,
frame_is_intra_only(cm), mi_row, mi_col);
}
// TODO(anybody) : remove this flag when PVQ supports pallete coding tool
#if !CONFIG_PVQ
if (bsize >= BLOCK_8X8) {
for (plane = 0; plane <= 1; ++plane) {
if (mbmi->palette_mode_info.palette_size[plane] > 0) {
......@@ -6135,6 +6146,8 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
}
}
}
#endif // !CONFIG_PVQ
#if CONFIG_VAR_TX
mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
#endif
......
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