diff options
author | Nathan E. Egge <negge@mozilla.com> | 2017-02-12 19:04:04 -0500 |
---|---|---|
committer | Nathan Egge <negge@mozilla.com> | 2017-02-16 08:35:52 +0000 |
commit | 0f11c78dae1ecb59e4a63253dd93e12dbfe10865 (patch) | |
tree | 30af8fb657c762f56c89de70a0e6edaec9c1f6bf /aom_dsp/daalaboolwriter.h | |
parent | 55ce9e0f35e52ff1bfb5eb06e7fa2fdb893431ec (diff) |
Fix DAALA_EC when EC_MULTISYMBOL disabled.
When DAALA_EC is enabled, calls to aom_read_tree() and aom_write_tree()
would automatically convert the aom_tree_index and aom_prob into a CDF
and call the aom_read_cdf() or aom_write_cdf(), which causes an
error if DAALA_EC is enabled without EC_MULTISYMBOL.
This patch moves the conversion functions from daalaboolreader.h and
daalaboolwriter.h into bitreader.h and bitwriter.h respectively, and
only calls the conversion functions if EC_MULTISYMBOL is enabled.
This allows DAALA_EC to be enabled without EC_MULTISYMBOL and is a
bitstream change when both ANS and EC_MULTISYMBOL are enabled as calls
to read and write trees will automatically be converted into calls that
read and write cdfs.
Change-Id: Id2f9aa9b5113292998cadfe69e4ba547324643ac
Diffstat (limited to 'aom_dsp/daalaboolwriter.h')
-rw-r--r-- | aom_dsp/daalaboolwriter.h | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/aom_dsp/daalaboolwriter.h b/aom_dsp/daalaboolwriter.h index 7bf5b6ec4..2f4cab1e3 100644 --- a/aom_dsp/daalaboolwriter.h +++ b/aom_dsp/daalaboolwriter.h @@ -76,45 +76,6 @@ static INLINE void daala_write_symbol(daala_writer *w, int symb, od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs); } -static INLINE void daala_write_tree_bits(daala_writer *w, - const aom_tree_index *tree, - const aom_prob *probs, int bits, - int len, aom_tree_index i) { - aom_tree_index root; - root = i; - do { - aom_cdf_prob cdf[16]; - aom_tree_index index[16]; - int path[16]; - int dist[16]; - int nsymbs; - int symb; - int j; - /* Compute the CDF of the binary tree using the given probabilities. */ - nsymbs = tree_to_cdf(tree, probs, root, cdf, index, path, dist); - /* Find the symbol to code. */ - symb = -1; - for (j = 0; j < nsymbs; j++) { - /* If this symbol codes a leaf node, */ - if (index[j] <= 0) { - if (len == dist[j] && path[j] == bits) { - symb = j; - break; - } - } else { - if (len > dist[j] && path[j] == bits >> (len - dist[j])) { - symb = j; - break; - } - } - } - OD_ASSERT(symb != -1); - daala_write_symbol(w, symb, cdf, nsymbs); - bits &= (1 << (len - dist[symb])) - 1; - len -= dist[symb]; - } while (len); -} - #ifdef __cplusplus } // extern "C" #endif |