Commit 770911d4 authored by Alex Converse's avatar Alex Converse Committed by Gerrit Code Review
Browse files

Merge changes I319cb856,Ib009b6b6 into nextgenv2

* changes:
  Remove multi-entropy coder hacks from the treewriter
  Rename rans_dec_lut to rans_lut
parents d54e5a04 5847de75
......@@ -39,8 +39,6 @@ typedef uint16_t AnsP10;
// This is now just a boring cdf. It starts with an explicit zero.
// TODO(aconverse): Remove starting zero.
typedef uint16_t rans_lut[16];
// TODO(aconverse): Update callers and remove this shim
#define rans_dec_lut rans_lut
void aom_rans_build_cdf_from_pdf(const AnsP10 token_probs[], rans_lut cdf_tab);
......
......@@ -2801,7 +2801,7 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
}
#if CONFIG_ANS
void av1_build_token_cdfs(const aom_prob *pdf_model, rans_dec_lut cdf) {
void av1_build_token_cdfs(const aom_prob *pdf_model, rans_lut cdf) {
AnsP10 pdf_tab[ENTROPY_TOKENS - 1];
assert(pdf_model[2] != 0);
// TODO(aconverse): Investigate making the precision of the zero and EOB tree
......
......@@ -192,7 +192,7 @@ extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
extern const AnsP10 av1_pareto8_token_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 2];
typedef rans_dec_lut coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS];
typedef rans_lut coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS];
#endif // CONFIG_ANS
typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
......
......@@ -265,10 +265,10 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd, PLANE_TYPE type,
const int tx_size_ctx = txsize_sqr_map[tx_size];
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size_ctx][type][ref];
const rans_dec_lut(*coef_cdfs)[COEFF_CONTEXTS] =
const rans_lut(*coef_cdfs)[COEFF_CONTEXTS] =
fc->coef_cdfs[tx_size_ctx][type][ref];
const aom_prob *prob;
const rans_dec_lut *cdf;
const rans_lut *cdf;
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
uint8_t token_cache[MAX_TX_SQUARE];
......
......@@ -738,7 +738,7 @@ static void pack_mb_tokens(struct BufAnsCoder *ans, const TOKENEXTRA **tp,
if (t != EOB_TOKEN) {
struct rans_sym s;
const rans_dec_lut *token_cdf = p->token_cdf;
const rans_lut *token_cdf = p->token_cdf;
assert(token_cdf);
s.cum_prob = (*token_cdf)[t - ZERO_TOKEN];
s.prob = (*token_cdf)[t - ZERO_TOKEN + 1] - s.cum_prob;
......
......@@ -145,7 +145,7 @@ static void cost(int *costs, aom_tree tree, const aom_prob *probs, int i,
#if CONFIG_ANS
void av1_cost_tokens_ans(int *costs, const aom_prob *tree_probs,
const rans_dec_lut token_cdf, int skip_eob) {
const rans_lut token_cdf, int skip_eob) {
int c_tree = 0; // Cost of the "tree" nodes EOB and ZERO.
int i;
costs[EOB_TOKEN] = av1_cost_bit(tree_probs[0], 0);
......
......@@ -60,7 +60,7 @@ void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree);
#if CONFIG_ANS
void av1_cost_tokens_ans(int *costs, const aom_prob *tree_probs,
const rans_dec_lut token_cdf, int skip_eob);
const rans_lut token_cdf, int skip_eob);
#endif
#ifdef __cplusplus
......
......@@ -363,7 +363,7 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
#if CONFIG_ANS
const rans_dec_lut *token_cdf,
const rans_lut *token_cdf,
#endif // CONFIG_ANS
int32_t extra, uint8_t token,
uint8_t skip_eob_node, unsigned int *counts) {
......@@ -469,7 +469,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
#endif // CONFIG_ENTROPY
#if CONFIG_ANS
rans_dec_lut(*const coef_cdfs)[COEFF_CONTEXTS] =
rans_lut(*const coef_cdfs)[COEFF_CONTEXTS] =
cpi->common.fc->coef_cdfs[txsize_sqr_map[tx_size]][type][ref];
#endif // CONFIG_ANS
unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
......@@ -493,7 +493,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
add_token(&t, coef_probs[band[c]][pt],
#if CONFIG_ANS
(const rans_dec_lut *)&coef_cdfs[band[c]][pt],
(const rans_lut *)&coef_cdfs[band[c]][pt],
#endif // CONFIG_ANS
extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
......
......@@ -37,7 +37,7 @@ typedef struct {
typedef struct {
const aom_prob *context_tree;
#if CONFIG_ANS
const rans_dec_lut *token_cdf;
const rans_lut *token_cdf;
#endif // CONFIG_ANS
EXTRABIT extra;
uint8_t token;
......
......@@ -12,15 +12,7 @@
#ifndef AV1_ENCODER_TREEWRITER_H_
#define AV1_ENCODER_TREEWRITER_H_
#ifdef AV1_FORCE_AOMBOOL_TREEWRITER
#include "aom_dsp/dkboolwriter.h"
#define tree_writer aom_dk_writer
#define tree_bit_write aom_dk_write
#else
#include "aom_dsp/bitwriter.h"
#define tree_writer aom_writer
#define tree_bit_write aom_write
#endif
#ifdef __cplusplus
extern "C" {
......@@ -37,24 +29,22 @@ struct av1_token {
void av1_tokens_from_tree(struct av1_token *, const aom_tree_index *);
static INLINE void av1_write_tree(tree_writer *w, const aom_tree_index *tree,
static INLINE void av1_write_tree(aom_writer *w, const aom_tree_index *tree,
const aom_prob *probs, int bits, int len,
aom_tree_index i) {
do {
const int bit = (bits >> --len) & 1;
tree_bit_write(w, bit, probs[i >> 1]);
aom_write(w, bit, probs[i >> 1]);
i = tree[i + bit];
} while (len);
}
static INLINE void av1_write_token(tree_writer *w, const aom_tree_index *tree,
static INLINE void av1_write_token(aom_writer *w, const aom_tree_index *tree,
const aom_prob *probs,
const struct av1_token *token) {
av1_write_tree(w, tree, probs, token->value, token->len, 0);
}
#undef tree_writer
#undef tree_bit_write
#ifdef __cplusplus
} // extern "C"
#endif
......
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