summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom_dsp/bitreader.h
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-19 21:52:15 -0500
committertrav90 <travawine@palemoon.org>2018-10-19 21:52:20 -0500
commitbbcc64772580c8a979288791afa02d30bc476d2e (patch)
tree437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/aom_dsp/bitreader.h
parent14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff)
downloadUXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/aom_dsp/bitreader.h')
-rw-r--r--third_party/aom/aom_dsp/bitreader.h109
1 files changed, 7 insertions, 102 deletions
diff --git a/third_party/aom/aom_dsp/bitreader.h b/third_party/aom/aom_dsp/bitreader.h
index 00424fa76..328935be9 100644
--- a/third_party/aom/aom_dsp/bitreader.h
+++ b/third_party/aom/aom_dsp/bitreader.h
@@ -15,15 +15,11 @@
#include <assert.h>
#include <limits.h>
-#include "./aom_config.h"
+#include "config/aom_config.h"
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
-#if CONFIG_ANS
-#include "aom_dsp/ansreader.h"
-#else
#include "aom_dsp/daalaboolreader.h"
-#endif
#include "aom_dsp/prob.h"
#include "av1/common/odintrin.h"
@@ -50,72 +46,37 @@
#define aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
-#if CONFIG_LV_MAP
-#define aom_read_bin(r, cdf, nsymbs, ACCT_STR_NAME) \
- aom_read_bin_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
-#if CONFIG_ANS
-typedef struct AnsDecoder aom_reader;
-#else
typedef struct daala_reader aom_reader;
-#endif
static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
- size_t size, aom_decrypt_cb decrypt_cb,
- void *decrypt_state) {
- (void)decrypt_cb;
- (void)decrypt_state;
-#if CONFIG_ANS
- if (size > INT_MAX) return 1;
- return ans_read_init(r, buffer, (int)size);
-#else
+ size_t size) {
return aom_daala_reader_init(r, buffer, (int)size);
-#endif
+}
+
+static INLINE const uint8_t *aom_reader_find_begin(aom_reader *r) {
+ return aom_daala_reader_find_begin(r);
}
static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
-#if CONFIG_ANS
- (void)r;
- assert(0 && "Use the raw buffer size with ANS");
- return NULL;
-#else
return aom_daala_reader_find_end(r);
-#endif
}
static INLINE int aom_reader_has_error(aom_reader *r) {
-#if CONFIG_ANS
- return ans_reader_has_error(r);
-#else
return aom_daala_reader_has_error(r);
-#endif
}
// Returns the position in the bit reader in bits.
static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
-#if CONFIG_ANS
- (void)r;
- assert(0 && "aom_reader_tell() is unimplemented for ANS");
- return 0;
-#else
return aom_daala_reader_tell(r);
-#endif
}
// Returns the position in the bit reader in 1/8th bits.
static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
-#if CONFIG_ANS
- (void)r;
- assert(0 && "aom_reader_tell_frac() is unimplemented for ANS");
- return 0;
-#else
return aom_daala_reader_tell_frac(r);
-#endif
}
#if CONFIG_ACCOUNTING
@@ -139,11 +100,7 @@ static INLINE void aom_update_symb_counts(const aom_reader *r, int is_binary) {
static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
int ret;
-#if CONFIG_ANS
- ret = rabs_read(r, prob);
-#else
ret = aom_daala_read(r, prob);
-#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
aom_update_symb_counts(r, 1);
@@ -153,15 +110,7 @@ static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
int ret;
-#if CONFIG_ANS
- ret = rabs_read_bit(r); // Non trivial optimization at half probability
-#elif CONFIG_RAWBITS
- // Note this uses raw bits and is not the same as aom_daala_read(r, 128);
- // Calls to this function are omitted from raw symbol accounting.
- ret = aom_daala_read_bit(r);
-#else
ret = aom_read(r, 128, NULL); // aom_prob_half
-#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif
@@ -181,12 +130,7 @@ static INLINE int aom_read_literal_(aom_reader *r, int bits ACCT_STR_PARAM) {
static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
-#if CONFIG_ANS
- (void)nsymbs;
- ret = rans_read(r, cdf);
-#else
ret = daala_read_symbol(r, cdf, nsymbs);
-#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
@@ -199,46 +143,7 @@ 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);
- update_cdf(cdf, ret, nsymbs);
- return ret;
-}
-
-#if CONFIG_LV_MAP
-static INLINE int aom_read_bin_(aom_reader *r, aom_cdf_prob *cdf,
- int nsymbs ACCT_STR_PARAM) {
- int ret;
- ret = aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME);
- update_cdf(cdf, ret, nsymbs);
- return ret;
-}
-#endif
-
-static INLINE int aom_read_tree_as_cdf(aom_reader *r,
- const aom_tree_index *tree,
- const aom_prob *probs) {
- aom_tree_index i = 0;
- do {
- aom_cdf_prob cdf[16];
- aom_tree_index index[16];
- int path[16];
- int dist[16];
- int nsymbs;
- int symb;
- nsymbs = tree_to_cdf(tree, probs, i, cdf, index, path, dist);
- symb = aom_read_cdf(r, cdf, nsymbs, NULL);
- OD_ASSERT(symb >= 0 && symb < nsymbs);
- i = index[symb];
- } while (i > 0);
- return -i;
-}
-
-static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree,
- const aom_prob *probs ACCT_STR_PARAM) {
- int ret;
- ret = aom_read_tree_as_cdf(r, tree, probs);
-#if CONFIG_ACCOUNTING
- if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
-#endif
+ if (r->allow_update_cdf) update_cdf(cdf, ret, nsymbs);
return ret;
}