Commit ef97ec0b authored by Thomas Davies's avatar Thomas Davies

EC_ADAPT: faster CDF update.

Also fix warning.

Change-Id: Ia515360af9c3269901eb0d002d326b7af43a00e7
parent 674bffdc
......@@ -138,9 +138,21 @@ DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);
#if CONFIG_EC_ADAPT
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
const int rate = 4 + get_msb(nsymbs);
int i, diff, tmp;
const int rate2 = 12 - rate;
int i, tmp;
int diff;
#if 1
const int tmp0 = 1 << rate2;
tmp = tmp0;
diff = ((32768 - (nsymbs << rate2)) >> rate) << rate;
// Single loop (faster)
for (i = 0; i < nsymbs - 1; ++i, tmp += tmp0) {
tmp += (i == val ? diff : 0);
cdf[i] -= ((cdf[i] - tmp) >> rate);
}
#else
for (i = 0; i < nsymbs; ++i) {
tmp = (i + 1) << (12 - rate);
tmp = (i + 1) << rate2;
cdf[i] -= ((cdf[i] - tmp) >> rate);
}
diff = 32768 - cdf[nsymbs - 1];
......@@ -148,6 +160,7 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
for (i = val; i < nsymbs; ++i) {
cdf[i] += diff;
}
#endif
}
#endif
......
......@@ -85,7 +85,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
fc->coef_cdfs[tx_size_ctx][type][ref];
aom_cdf_prob(*cdf)[ENTROPY_TOKENS];
#endif // CONFIG_EC_MULTISYMBOL
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
uint8_t token_cache[MAX_TX_SQUARE];
const uint8_t *band_translate = get_band_translate(tx_size);
......
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