Commit 87d44dc7 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Split aom_write_cdf() from aom_write_symbol().

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

Change-Id: Ibc58690eddb647d69f08d72f0f0712779aab11d1
parent 482016d0
......@@ -183,8 +183,8 @@ static INLINE void aom_write_tree_record(aom_writer *w,
}
#if CONFIG_EC_MULTISYMBOL
static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
static INLINE void aom_write_cdf(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
#if CONFIG_ANS
struct rans_sym s;
(void)nsymbs;
......@@ -199,16 +199,19 @@ static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
"CONFIG_EC_MULTISYMBOL is selected without a valid backing entropy " \
"coder. Enable daala_ec or ans for a valid configuration."
#endif
}
static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
aom_write_cdf(w, symb, cdf, nsymbs);
#if CONFIG_EC_ADAPT
update_cdf(cdf, symb, nsymbs);
#endif
}
#if CONFIG_PVQ
static INLINE void aom_write_symbol_unscaled(aom_writer *w, int symb,
const aom_cdf_prob *cdf,
int nsymbs) {
static INLINE void aom_write_cdf_unscaled(aom_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
#if CONFIG_DAALA_EC
od_ec_encode_cdf_unscaled(&w->ec, symb, cdf, nsymbs);
#else
......
......@@ -47,7 +47,7 @@ void aom_encode_cdf_adapt_q15(aom_writer *w, int val, uint16_t *cdf, int n,
cdf[i] = cdf[i]*32768/ft;
}
}
aom_write_symbol(w, val, cdf, n);
aom_write_cdf(w, val, cdf, n);
aom_cdf_adapt_q15(val, cdf, n, count, rate);
}
......@@ -107,9 +107,9 @@ void generic_encode(aom_writer *w, generic_encoder *model, int x, int max,
xs = (x + (1 << shift >> 1)) >> shift;
ms = (max + (1 << shift >> 1)) >> shift;
OD_ASSERT(max == -1 || xs <= ms);
if (max == -1) aom_write_symbol_unscaled(w, OD_MINI(15, xs), cdf, 16);
if (max == -1) aom_write_cdf_unscaled(w, OD_MINI(15, xs), cdf, 16);
else {
aom_write_symbol_unscaled(w, OD_MINI(15, xs), cdf, OD_MINI(ms + 1, 16));
aom_write_cdf_unscaled(w, OD_MINI(15, xs), cdf, OD_MINI(ms + 1, 16));
}
if (xs >= 15) {
int e;
......
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