Commit f25bae44 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Use aom_reader with od_decode_cdf_adapt().

Change the od_decode_cdf_adapt() function to take an aom_reader
 struct instead of an od_ec_dec struct.
Rename od_decode_cdf_adapt() to aom_decode_cdf_adapt().

Change-Id: I0713d2f56acfea3f67f1b4087c0feee77c2e25cb
parent b97f1c47
......@@ -26,13 +26,15 @@
generic_decode_(r, model, max, ex_q16, integration, str)
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate, str)
# define od_decode_cdf_adapt(enc, cdf, n, increment, str) od_decode_cdf_adapt_(enc, cdf, n, increment, str)
# define aom_decode_cdf_adapt(r, cdf, n, increment, str) \
aom_decode_cdf_adapt_(r, cdf, n, increment, str)
#else
# define generic_decode(r, model, max, ex_q16, integration, str) \
generic_decode_(r, model, max, ex_q16, integration)
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate)
# define od_decode_cdf_adapt(enc, cdf, n, increment, str) od_decode_cdf_adapt_(enc, cdf, n, increment)
# define aom_decode_cdf_adapt(r, cdf, n, increment, str) \
aom_decode_cdf_adapt_(r, cdf, n, increment)
#endif
typedef struct {
......@@ -68,7 +70,7 @@ void aom_encode_cdf_adapt_q15(aom_writer *w, int val, uint16_t *cdf, int n,
void aom_encode_cdf_adapt(aom_writer *w, int val, uint16_t *cdf, int n,
int increment);
int od_decode_cdf_adapt_(od_ec_dec *ec, uint16_t *cdf, int n,
int aom_decode_cdf_adapt_(aom_reader *r, uint16_t *cdf, int n,
int increment OD_ACC_STR);
void generic_encode(aom_writer *w, generic_encoder *model, int x, int max,
......
......@@ -406,18 +406,14 @@ static int av1_pvq_decode_helper2(MACROBLOCKD *const xd,
eob = 0;
dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
#if CONFIG_DAALA_EC
// decode ac/dc coded flag. bit0: DC coded, bit1 : AC coded
// NOTE : we don't use 5 symbols for luma here in aom codebase,
// since block partition is taken care of by aom.
// So, only AC/DC skip info is coded
ac_dc_coded = od_decode_cdf_adapt(
&xd->daala_dec.r->ec,
ac_dc_coded = aom_decode_cdf_adapt(
xd->daala_dec.r,
xd->daala_dec.state.adapt.skip_cdf[2 * tx_size + (plane != 0)], 4,
xd->daala_dec.state.adapt.skip_increment, "skip");
#else
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
if (ac_dc_coded) {
int xdec = pd->subsampling_x;
int seg_id = mbmi->segment_id;
......
......@@ -61,11 +61,11 @@ int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
*
* @retval decoded variable
*/
int od_decode_cdf_adapt_(od_ec_dec *ec, uint16_t *cdf, int n,
int aom_decode_cdf_adapt_(aom_reader *r, uint16_t *cdf, int n,
int increment OD_ACC_STR) {
int i;
int val;
val = od_ec_decode_cdf_unscaled(ec, cdf, n);
val = aom_read_cdf_unscaled(r, cdf, n, ACCT_STR);
if (cdf[n-1] + increment > 32767) {
for (i = 0; i < n; i++) {
/* Second term ensures that the pdf is non-null */
......
......@@ -41,9 +41,9 @@ static int aom_decode_pvq_split_(aom_reader *r, od_pvq_codeword_ctx *adapt,
if (sum == 0) return 0;
shift = OD_MAXI(0, OD_ILOG(sum) - 3);
fctx = 7*ctx + (sum >> shift) - 1;
#if CONFIG_DAALA_EC
msbs = od_decode_cdf_adapt(&r->ec, adapt->pvq_split_cdf[fctx],
msbs = aom_decode_cdf_adapt(r, adapt->pvq_split_cdf[fctx],
(sum >> shift) + 1, adapt->pvq_split_increment, ACCT_STR);
#if CONFIG_DAALA_EC
if (shift) count = od_ec_dec_bits(&r->ec, shift, ACCT_STR);
#else
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
......@@ -75,12 +75,8 @@ void aom_decode_band_pvq_splits(aom_reader *r, od_pvq_codeword_ctx *adapt,
int pos;
cdf_id = od_pvq_k1_ctx(n, level == 0);
OD_CLEAR(y, n);
#if CONFIG_DAALA_EC
pos = od_decode_cdf_adapt(&r->ec, adapt->pvq_k1_cdf[cdf_id], n,
pos = aom_decode_cdf_adapt(r, adapt->pvq_k1_cdf[cdf_id], n,
adapt->pvq_k1_increment, "pvq:k1");
#else
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
y[pos] = 1;
}
else {
......
......@@ -169,13 +169,9 @@ static void pvq_decode_partition(aom_reader *r,
/* Jointly decode gain, itheta and noref for small values. Then we handle
larger gain. We need to wait for itheta because in the !nodesync case
it depends on max_theta, which depends on the gain. */
#if CONFIG_DAALA_EC
id = od_decode_cdf_adapt(&r->ec, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
id = aom_decode_cdf_adapt(r, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
8 + 7*has_skip, adapt->pvq.pvq_gaintheta_increment,
"pvq:gaintheta");
#else
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
if (!is_keyframe && id >= 10) id++;
if (is_keyframe && id >= 8) id++;
if (id >= 8) {
......@@ -368,13 +364,9 @@ void od_pvq_decode(daala_dec_ctx *dec,
if (i == 0 && !skip_rest[0] && bs > 0) {
int skip_dir;
int j;
#if CONFIG_DAALA_EC
skip_dir = od_decode_cdf_adapt(&dec->r->ec,
skip_dir = aom_decode_cdf_adapt(dec->r,
&dec->state.adapt.pvq.pvq_skip_dir_cdf[(pli != 0) + 2*(bs - 1)][0], 7,
dec->state.adapt.pvq.pvq_skip_dir_increment, "pvq:skiprest");
#else
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
for (j = 0; j < 3; j++) skip_rest[j] = !!(skip_dir & (1 << j));
}
}
......
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