Commit 8787227a authored by Hui Su's avatar Hui Su

Remove code about tree and probability

Change-Id: I66a542da0c7b8fdb9ac2d4efee73aa62414c10f9
parent b70615b9
......@@ -130,45 +130,6 @@ static INLINE aom_prob get_prob(unsigned int num, unsigned int den) {
}
}
static INLINE aom_prob get_binary_prob(unsigned int n0, unsigned int n1) {
const unsigned int den = n0 + n1;
if (den == 0) return 128u;
return get_prob(n0, den);
}
/* This function assumes prob1 and prob2 are already within [1,255] range. */
static INLINE aom_prob weighted_prob(int prob1, int prob2, int factor) {
return ROUND_POWER_OF_TWO(prob1 * (256 - factor) + prob2 * factor, 8);
}
static INLINE aom_prob merge_probs(aom_prob pre_prob, const unsigned int ct[2],
unsigned int count_sat,
unsigned int max_update_factor) {
const aom_prob prob = get_binary_prob(ct[0], ct[1]);
const unsigned int count = AOMMIN(ct[0] + ct[1], count_sat);
const unsigned int factor = max_update_factor * count / count_sat;
return weighted_prob(pre_prob, prob, factor);
}
// MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT;
static const int count_to_update_factor[MODE_MV_COUNT_SAT + 1] = {
0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64,
70, 76, 83, 89, 96, 102, 108, 115, 121, 128
};
static INLINE aom_prob mode_mv_merge_probs(aom_prob pre_prob,
const unsigned int ct[2]) {
const unsigned int den = ct[0] + ct[1];
if (den == 0) {
return pre_prob;
} else {
const unsigned int count = AOMMIN(den, MODE_MV_COUNT_SAT);
const unsigned int factor = count_to_update_factor[count];
const aom_prob prob = get_prob(ct[0], den);
return weighted_prob(pre_prob, prob, factor);
}
}
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
int rate;
const int rate2 = 5;
......
This diff is collapsed.
......@@ -115,13 +115,8 @@ DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]);
#define CAT5_MIN_VAL 35
#define CAT6_MIN_VAL 67
#define CAT6_BIT_SIZE 18
// Extra bit probabilities.
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat1_prob[1]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat2_prob[2]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat3_prob[3]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat4_prob[4]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat5_prob[5]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat6_prob[18]);
extern const aom_cdf_prob *av1_cat1_cdf[];
extern const aom_cdf_prob *av1_cat2_cdf[];
extern const aom_cdf_prob *av1_cat3_cdf[];
......@@ -151,8 +146,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
int tx_offset = (int)(tx_size - TX_4X4);
int bits = (int)bit_depth + 3 + tx_offset;
// Round up
bits = AOMMIN((int)sizeof(av1_cat6_prob), ((bits + 3) & ~3));
assert(bits <= (int)sizeof(av1_cat6_prob));
bits = AOMMIN(CAT6_BIT_SIZE, ((bits + 3) & ~3));
return bits;
}
......@@ -231,7 +225,6 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
#define TAIL_NODES (MODEL_NODES + 1)
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[CDF_SIZE(ENTROPY_TOKENS)];
......@@ -346,18 +339,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
static INLINE aom_prob av1_merge_probs(aom_prob pre_prob,
const unsigned int ct[2],
unsigned int count_sat,
unsigned int max_update_factor) {
return merge_probs(pre_prob, ct, count_sat, max_update_factor);
}
static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
const unsigned int ct[2]) {
return mode_mv_merge_probs(pre_prob, ct);
}
static INLINE TX_SIZE get_txsize_entropy_ctx(TX_SIZE txsize) {
return (TX_SIZE)((txsize_sqr_map[txsize] + txsize_sqr_up_map[txsize] + 1) >>
1);
......
......@@ -522,13 +522,7 @@ typedef struct AV1Common {
TXFM_CONTEXT *top_txfm_context[MAX_MB_PLANE];
TXFM_CONTEXT left_txfm_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
int above_context_alloc_cols;
// scratch memory for intraonly/keyframe forward updates from default tables
// - this is intentionally not placed in FRAME_CONTEXT since it's reset upon
// each keyframe and not used afterwards
aom_prob kf_y_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1];
WarpedMotionParams global_motion[TOTAL_REFS_PER_FRAME];
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
......
......@@ -59,8 +59,8 @@ static int token_to_value(FRAME_COUNTS *counts, aom_reader *const r, int token,
case CATEGORY5_TOKEN:
return CAT5_MIN_VAL + read_coeff(counts, av1_cat5_cdf, 5, r);
case CATEGORY6_TOKEN: {
const int skip_bits = (int)sizeof(av1_cat6_prob) -
av1_get_cat6_extrabits_size(tx_size, bit_depth);
const int skip_bits =
CAT6_BIT_SIZE - av1_get_cat6_extrabits_size(tx_size, bit_depth);
return CAT6_MIN_VAL + read_coeff(counts, av1_cat6_cdf, 18 - skip_bits, r);
}
default:
......
......@@ -437,10 +437,10 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const int is_cat6 = (extra_bits->base_val == CAT6_MIN_VAL);
// be written excluding
// the sign bit.
int skip_bits = is_cat6
? (int)sizeof(av1_cat6_prob) -
av1_get_cat6_extrabits_size(tx_size, bit_depth)
: 0;
int skip_bits =
is_cat6
? CAT6_BIT_SIZE - av1_get_cat6_extrabits_size(tx_size, bit_depth)
: 0;
assert(!(bit_string >> (bit_string_length - skip_bits + 1)));
if (bit_string_length > 0)
......
......@@ -38,34 +38,6 @@ const uint16_t av1_prob_cost[256] = {
26, 23, 20, 18, 15, 12, 9, 6, 3
};
static void cost(int *costs, aom_tree tree, const aom_prob *probs, int i,
int c) {
const aom_prob prob = probs[i / 2];
int b;
assert(prob != 0);
for (b = 0; b <= 1; ++b) {
const int cc = c + av1_cost_bit(prob, b);
const aom_tree_index ii = tree[i + b];
if (ii <= 0)
costs[-ii] = cc;
else
cost(costs, tree, probs, ii, cc);
}
}
void av1_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree) {
cost(costs, tree, probs, 0, 0);
}
void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree) {
assert(tree[0] <= 0 && tree[1] > 0);
costs[-tree[0]] = av1_cost_bit(probs[0], 0);
cost(costs, tree, probs, 2, 0);
}
void av1_cost_tokens_from_cdf(int *costs, const aom_cdf_prob *cdf,
const int *inv_map) {
int i;
......
......@@ -42,27 +42,6 @@ static INLINE int av1_cost_symbol(aom_cdf_prob p15) {
av1_cost_literal(shift);
}
static INLINE unsigned int cost_branch256(const unsigned int ct[2],
aom_prob p) {
return ct[0] * av1_cost_zero(p) + ct[1] * av1_cost_one(p);
}
static INLINE int treed_cost(aom_tree tree, const aom_prob *probs, int bits,
int len) {
int cost = 0;
aom_tree_index i = 0;
do {
const int bit = (bits >> --len) & 1;
cost += av1_cost_bit(probs[i >> 1], bit);
i = tree[i + bit];
} while (len);
return cost;
}
void av1_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree);
void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree);
void av1_cost_tokens_from_cdf(int *costs, const aom_cdf_prob *cdf,
const int *inv_map);
......
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