Merge "Use constrained tokenset with --enable-daala_ec." into nextgenv2

This commit is contained in:
Yaowu Xu 2016-10-25 19:40:51 +00:00 коммит произвёл Gerrit Code Review
Родитель e71ad1d4a2 46e8490498
Коммит dece603fdf
6 изменённых файлов: 19 добавлений и 48 удалений

Просмотреть файл

@ -407,7 +407,7 @@ const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{ 255, 246, 247, 255, 239, 255, 253, 255 },
};
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
// Model obtained from a 2-sided zero-centered distribution derived
// from a Pareto distribution. The cdf of the distribution is:
// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
@ -2804,7 +2804,7 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
}
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
static void build_token_cdfs(const aom_prob *pdf_model,
aom_cdf_prob cdf[ENTROPY_TOKENS]) {
int i, sum = 0;
@ -2838,7 +2838,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
av1_copy(cm->fc->coef_probs[TX_16X16], default_coef_probs_16x16);
av1_copy(cm->fc->coef_probs[TX_32X32], default_coef_probs_32x32);
#endif // CONFIG_ENTROPY
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
av1_coef_pareto_cdfs(cm->fc);
#endif // CONFIG_RANS
}

Просмотреть файл

@ -190,12 +190,6 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
#if CONFIG_RANS || CONFIG_DAALA_EC
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_TOKENS];
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 2];
#endif // CONFIG_RANS
typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[UNCONSTRAINED_NODES];
@ -206,6 +200,15 @@ typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS]
void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
#if CONFIG_RANS || CONFIG_DAALA_EC
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_TOKENS];
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 2];
struct frame_contexts;
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
#endif // CONFIG_RANS
typedef char ENTROPY_CONTEXT;
static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,

Просмотреть файл

@ -1883,7 +1883,7 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r) {
TX_SIZE tx_size;
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
read_coef_probs_common(fc->coef_probs[tx_size], r);
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
av1_coef_pareto_cdfs(fc);
#endif // CONFIG_RANS
}

Просмотреть файл

@ -76,7 +76,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size_ctx][type][ref];
const aom_prob *prob;
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
fc->coef_cdfs[tx_size_ctx][type][ref];
const aom_cdf_prob(*cdf)[ENTROPY_TOKENS];
@ -169,7 +169,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
cdf = &coef_cdfs[band][ctx];
token = ONE_TOKEN +
aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);

Просмотреть файл

@ -703,17 +703,14 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
while (p < stop && p->token != EOSB_TOKEN) {
const int token = p->token;
aom_tree_index index = 0;
#if !CONFIG_RANS
#if !CONFIG_RANS && !CONFIG_DAALA_EC
const struct av1_token *const coef_encoding = &av1_coef_encodings[token];
#if CONFIG_DAALA_EC
int i = 0;
#endif
int coef_value = coef_encoding->value;
int coef_length = coef_encoding->len;
#endif // !CONFIG_RANS
const av1_extra_bit *const extra_bits = &extra_bits_table[token];
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
/* skip one or two nodes */
if (!p->skip_eob_node) aom_write(w, token != EOB_TOKEN, p->context_tree[0]);
@ -725,34 +722,6 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
CATEGORY6_TOKEN - ONE_TOKEN + 1);
}
}
#else
#if CONFIG_DAALA_EC
/* skip one or two nodes */
if (p->skip_eob_node) {
coef_length -= p->skip_eob_node;
i = 2 * p->skip_eob_node;
}
// TODO(jbb): expanding this can lead to big gains. It allows
// much better branch prediction and would enable us to avoid numerous
// lookups and compares.
// If we have a token that's in the constrained set, the coefficient tree
// is split into two treed writes. The first treed write takes care of the
// unconstrained nodes. The second treed write takes care of the
// constrained nodes.
if (token >= TWO_TOKEN && token < EOB_TOKEN) {
int len = UNCONSTRAINED_NODES - p->skip_eob_node;
int bits = coef_value >> (coef_length - len);
aom_write_tree_bits(w, av1_coef_tree, p->context_tree, bits, len, i);
coef_value &= (1 << (coef_length - len)) - 1;
aom_write_tree(w, av1_coef_con_tree,
av1_pareto8_full[p->context_tree[PIVOT_NODE] - 1],
coef_value, coef_length - len, 0);
} else {
aom_write_tree_bits(w, av1_coef_tree, p->context_tree, coef_value,
coef_length, i);
}
#else
/* skip one or two nodes */
if (p->skip_eob_node)
@ -774,7 +743,6 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
}
}
}
#endif
#endif // CONFIG_RANS
if (extra_bits->base_val) {

Просмотреть файл

@ -36,9 +36,9 @@ typedef struct {
typedef struct {
const aom_prob *context_tree;
#if CONFIG_ANS || CONFIG_DAALA_EC
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS];
#endif // CONFIG_ANS
#endif
EXTRABIT extra;
uint8_t token;
uint8_t skip_eob_node;