Commit e0698495 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Split aom_read_cdf() from aom_read_symbol().

Separate the aom_read_cdf() functionality from aom_read_symbol() which
 can optionally adapt the cdf when run with --enable-ec_adapt.

Change-Id: I5446d6402835dfcf68d3462a2bd8835704fe6603
parent 39051a77
......@@ -52,10 +52,12 @@
aom_read_literal_(r, bits ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_tree_bits(r, tree, probs, ACCT_STR_NAME) \
aom_read_tree_bits_(r, tree, probs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_cdf_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_symbol_unscaled(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol_unscaled_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_cdf_unscaled(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_cdf_unscaled_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#ifdef __cplusplus
extern "C" {
......@@ -221,8 +223,8 @@ static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree,
}
#if CONFIG_EC_MULTISYMBOL
static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
static INLINE int aom_read_cdf_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
(void)nsymbs;
......@@ -235,20 +237,25 @@ static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
"coder. Enable daala_ec or ans for a valid configuration."
#endif
#if CONFIG_EC_ADAPT
update_cdf(cdf, ret, nsymbs);
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif
return ret;
}
static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
ret = aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME);
#if CONFIG_EC_ADAPT
update_cdf(cdf, ret, nsymbs);
#endif
return ret;
}
#if CONFIG_PVQ
static INLINE int aom_read_symbol_unscaled_(aom_reader *r,
const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
static INLINE int aom_read_cdf_unscaled_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
#if CONFIG_DAALA_EC
ret = od_ec_decode_cdf_unscaled(&r->ec, cdf, nsymbs);
......
......@@ -46,7 +46,7 @@ int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
cdf[i] = cdf[i]*32768/ft;
}
}
val = aom_read_symbol(r, cdf, n, ACCT_STR);
val = aom_read_cdf(r, cdf, n, ACCT_STR);
aom_cdf_adapt_q15(val, cdf, n, count, rate);
return val;
}
......@@ -110,8 +110,8 @@ int generic_decode_(aom_reader *r, generic_encoder *model, int max,
id = OD_MINI(GENERIC_TABLES - 1, lg_q1);
cdf = model->cdf[id];
ms = (max + (1 << shift >> 1)) >> shift;
if (max == -1) xs = aom_read_symbol_unscaled(r, cdf, 16, ACCT_STR);
else xs = aom_read_symbol_unscaled(r, cdf, OD_MINI(ms + 1, 16), ACCT_STR);
if (max == -1) xs = aom_read_cdf_unscaled(r, cdf, 16, ACCT_STR);
else xs = aom_read_cdf_unscaled(r, cdf, OD_MINI(ms + 1, 16), ACCT_STR);
if (xs == 15) {
int e;
unsigned decay;
......
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