diff --git a/aom_dsp/daalaboolreader.h b/aom_dsp/daalaboolreader.h index cb7581ec8..0ed0de4ac 100644 --- a/aom_dsp/daalaboolreader.h +++ b/aom_dsp/daalaboolreader.h @@ -52,7 +52,7 @@ static INLINE int daala_read_tree_bits(daala_reader *r, const aom_prob *probs) { aom_tree_index i = 0; do { - uint16_t cdf[16]; + aom_cdf_prob cdf[16]; aom_tree_index index[16]; int path[16]; int dist[16]; @@ -66,7 +66,7 @@ static INLINE int daala_read_tree_bits(daala_reader *r, return -i; } -static INLINE int daala_read_symbol(daala_reader *r, const uint16_t *cdf, +static INLINE int daala_read_symbol(daala_reader *r, const aom_cdf_prob *cdf, int nsymbs) { return od_ec_decode_cdf_q15(&r->ec, cdf, nsymbs, "aom"); } diff --git a/aom_dsp/daalaboolwriter.h b/aom_dsp/daalaboolwriter.h index c80cd4f42..5183a907e 100644 --- a/aom_dsp/daalaboolwriter.h +++ b/aom_dsp/daalaboolwriter.h @@ -46,7 +46,7 @@ static INLINE void daala_write_tree_bits(daala_writer *w, aom_tree_index root; root = i; do { - uint16_t cdf[16]; + aom_cdf_prob cdf[16]; aom_tree_index index[16]; int path[16]; int dist[16]; @@ -79,7 +79,7 @@ static INLINE void daala_write_tree_bits(daala_writer *w, } static INLINE void daala_write_symbol(daala_writer *w, int symb, - const uint16_t *cdf, int nsymbs) { + const aom_cdf_prob *cdf, int nsymbs) { od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs); } diff --git a/aom_dsp/prob.c b/aom_dsp/prob.c index d65ace899..d3556cb84 100644 --- a/aom_dsp/prob.c +++ b/aom_dsp/prob.c @@ -68,7 +68,7 @@ struct tree_node { int len; int l; int r; - uint16_t pdf; + aom_cdf_prob pdf; }; /* Compute the probability of this node in Q23 */ @@ -96,7 +96,8 @@ static int tree_node_cmp(tree_node a, tree_node b) { /* Given a Q15 probability for symbol subtree rooted at tree[n], this function computes the probability of each symbol (defined as a node that has no children). */ -static uint16_t tree_node_compute_probs(tree_node *tree, int n, uint16_t pdf) { +static aom_cdf_prob tree_node_compute_probs(tree_node *tree, int n, + aom_cdf_prob pdf) { if (tree[n].l == 0) { /* This prevents probability computations in Q15 that underflow from producing a symbol that has zero probability. */ @@ -106,15 +107,15 @@ static uint16_t tree_node_compute_probs(tree_node *tree, int n, uint16_t pdf) { } else { /* We process the smaller probability first, */ if (tree[n].prob < 128) { - uint16_t lp; - uint16_t rp; + aom_cdf_prob lp; + aom_cdf_prob rp; lp = (((uint32_t)pdf) * tree[n].prob + 128) >> 8; lp = tree_node_compute_probs(tree, tree[n].l, lp); rp = tree_node_compute_probs(tree, tree[n].r, lp > pdf ? 0 : pdf - lp); return lp + rp; } else { - uint16_t rp; - uint16_t lp; + aom_cdf_prob rp; + aom_cdf_prob lp; rp = (((uint32_t)pdf) * (256 - tree[n].prob) + 128) >> 8; rp = tree_node_compute_probs(tree, tree[n].r, rp); lp = tree_node_compute_probs(tree, tree[n].l, rp > pdf ? 0 : pdf - rp); @@ -123,8 +124,9 @@ static uint16_t tree_node_compute_probs(tree_node *tree, int n, uint16_t pdf) { } } -static int tree_node_extract(tree_node *tree, int n, int symb, uint16_t *pdf, - aom_tree_index *index, int *path, int *len) { +static int tree_node_extract(tree_node *tree, int n, int symb, + aom_cdf_prob *pdf, aom_tree_index *index, + int *path, int *len) { if (tree[n].l == 0) { pdf[symb] = tree[n].pdf; if (index != NULL) index[symb] = tree[n].index; @@ -138,7 +140,7 @@ static int tree_node_extract(tree_node *tree, int n, int symb, uint16_t *pdf, } int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs, - aom_tree_index root, uint16_t *cdf, aom_tree_index *index, + aom_tree_index root, aom_cdf_prob *cdf, aom_tree_index *index, int *path, int *len) { tree_node symb[2 * 16 - 1]; int nodes; diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h index 3ae34b825..bf9abbf22 100644 --- a/aom_dsp/prob.h +++ b/aom_dsp/prob.h @@ -98,11 +98,11 @@ void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs, #if CONFIG_DAALA_EC int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs, - aom_tree_index root, uint16_t *cdf, aom_tree_index *ind, + aom_tree_index root, aom_cdf_prob *cdf, aom_tree_index *ind, int *pth, int *len); static INLINE void av1_tree_to_cdf(const aom_tree_index *tree, - const aom_prob *probs, uint16_t *cdf) { + const aom_prob *probs, aom_cdf_prob *cdf) { aom_tree_index index[16]; int path[16]; int dist[16]; diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 77c73bf81..7821b3929 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h @@ -54,9 +54,6 @@ typedef struct frame_contexts { aom_prob partition_prob[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1]; #else aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; -#endif -#if CONFIG_DAALA_EC - uint16_t partition_cdf[PARTITION_CONTEXTS][PARTITION_TYPES]; #endif av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; #if CONFIG_ANS || CONFIG_DAALA_EC @@ -135,10 +132,11 @@ typedef struct frame_contexts { aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1]; #endif // CONFIG_LOOP_RESTORATION #if CONFIG_DAALA_EC - uint16_t switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] - [SWITCHABLE_FILTERS]; - uint16_t intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][TX_TYPES]; - uint16_t inter_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES]; + aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][PARTITION_TYPES]; + aom_cdf_prob + switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; + aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][TX_TYPES]; + aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES]; #endif } FRAME_CONTEXT;