Commit f3b00072 authored by Nathan E. Egge's avatar Nathan E. Egge

Use constrained tokenset with --enable-daala_ec.

Change-Id: Ia09edf92bf9f7ecacc65c232ac6e656cde236634
parent e1f9e33d
This diff is collapsed.
......@@ -176,9 +176,10 @@ typedef unsigned int av1_coeff_count_model
void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
#if CONFIG_RANS
typedef rans_lut coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS];
extern const AnsP10
#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);
......
......@@ -62,7 +62,7 @@ typedef struct frame_contexts {
aom_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
#endif // CONFIG_RANS
aom_prob
......
......@@ -728,7 +728,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
}
......
......@@ -67,10 +67,10 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];
const aom_prob *prob;
#if CONFIG_RANS
const rans_lut(*coef_cdfs)[COEFF_CONTEXTS] =
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob (*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
fc->coef_cdfs[tx_size][type][ref];
const rans_lut *cdf;
const aom_cdf_prob(*cdf)[ENTROPY_TOKENS];
#endif // CONFIG_RANS
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
......@@ -146,7 +146,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
prob = coef_probs[band][ctx];
}
#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);
......
......@@ -391,14 +391,14 @@ static void pack_mb_tokens(aom_writer *w, TOKENEXTRA **tp,
while (p < stop && p->token != EOSB_TOKEN) {
const uint8_t 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];
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
if (!p->skip_eob_node) aom_write(w, token != EOB_TOKEN, p->context_tree[0]);
if (token != EOB_TOKEN) {
......@@ -1229,7 +1229,7 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
}
default: assert(0);
}
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
av1_coef_pareto_cdfs(cpi->common.fc);
#endif // CONFIG_RANS
}
......
......@@ -318,15 +318,15 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
}
static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
#if CONFIG_RANS
const rans_lut *token_cdf,
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS],
#endif // CONFIG_RANS
int32_t extra, uint8_t token,
uint8_t skip_eob_node, unsigned int *counts) {
(*t)->token = token;
(*t)->extra = extra;
(*t)->context_tree = context_tree;
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
(*t)->token_cdf = token_cdf;
#endif // CONFIG_RANS
(*t)->skip_eob_node = skip_eob_node;
......@@ -334,16 +334,15 @@ static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
++counts[token];
}
static INLINE void add_token_no_extra(TOKENEXTRA **t,
const aom_prob *context_tree,
#if CONFIG_RANS
const rans_lut *token_cdf,
static INLINE void add_token_no_extra(
TOKENEXTRA **t, const aom_prob *context_tree,
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS],
#endif // CONFIG_RANS
uint8_t token, uint8_t skip_eob_node,
unsigned int *counts) {
uint8_t token, uint8_t skip_eob_node, unsigned int *counts) {
(*t)->token = token;
(*t)->context_tree = context_tree;
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
(*t)->token_cdf = token_cdf;
#endif // CONFIG_RANS
(*t)->skip_eob_node = skip_eob_node;
......@@ -423,8 +422,8 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
td->rd_counts.coef_counts[tx_size][type][ref];
aom_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
cpi->common.fc->coef_probs[tx_size][type][ref];
#if CONFIG_RANS
rans_lut (*const coef_cdfs)[COEFF_CONTEXTS] =
#if CONFIG_RANS || CONFIG_DAALA_EC
aom_cdf_prob (*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
cpi->common.fc->coef_cdfs[tx_size][type][ref];
#endif
unsigned int (*const eob_branch)[COEFF_CONTEXTS] =
......@@ -446,11 +445,12 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
v = qcoeff[scan[c]];
while (!v) {
add_token_no_extra(&t, coef_probs[band[c]][pt],
#if CONFIG_RANS
(const rans_lut *)&coef_cdfs[band[c]][pt],
add_token_no_extra(
&t, coef_probs[band[c]][pt],
#if CONFIG_RANS || CONFIG_DAALA_EC
(const aom_cdf_prob(*)[ENTROPY_TOKENS]) & coef_cdfs[band[c]][pt],
#endif
ZERO_TOKEN, skip_eob, counts[band[c]][pt]);
ZERO_TOKEN, skip_eob, counts[band[c]][pt]);
eob_branch[band[c]][pt] += !skip_eob;
skip_eob = 1;
......@@ -463,8 +463,8 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
av1_get_token_extra(v, &token, &extra);
add_token(&t, coef_probs[band[c]][pt],
#if CONFIG_RANS
(const rans_lut *)&coef_cdfs[band[c]][pt],
#if CONFIG_RANS || CONFIG_DAALA_EC
(const aom_cdf_prob(*)[ENTROPY_TOKENS]) & coef_cdfs[band[c]][pt],
#endif
extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
eob_branch[band[c]][pt] += !skip_eob;
......@@ -475,7 +475,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
}
if (c < seg_eob) {
add_token_no_extra(&t, coef_probs[band[c]][pt],
#if CONFIG_RANS
#if CONFIG_RANS || CONFIG_DAALA_EC
NULL,
#endif
EOB_TOKEN, 0, counts[band[c]][pt]);
......
......@@ -36,8 +36,8 @@ typedef struct {
typedef struct {
const aom_prob *context_tree;
#if CONFIG_RANS
const rans_lut *token_cdf;
#if CONFIG_RANS || CONFIG_DAALA_EC
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS];
#endif
EXTRABIT extra;
uint8_t token;
......
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