Commit 41d61528 authored by Hui Su's avatar Hui Su

lv-map: replace read/write_bin with read/write_symbol

Change-Id: I9e16b5de0a3ae1814982660434812d417955d94f
parent 5f7f3677
......@@ -46,13 +46,6 @@
#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))
#define aom_read_symbol4(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol4_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#endif
#ifdef __cplusplus
extern "C" {
#endif
......@@ -150,17 +143,6 @@ static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
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);
if (r->allow_update_cdf) update_bin(cdf, ret, nsymbs);
// printf("bin: %d\n", this_cdf[0]);
return ret;
}
#endif
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -101,15 +101,6 @@ static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
if (w->allow_update_cdf) update_cdf(cdf, symb, nsymbs);
}
#if CONFIG_LV_MAP
static INLINE void aom_write_bin(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
aom_write_cdf(w, symb, cdf, nsymbs);
if (w->allow_update_cdf) update_bin(cdf, symb, nsymbs);
// printf("bin: %d\n", this_cdf[0]);
}
#endif
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -681,12 +681,6 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
cdf[nsymbs] += (cdf[nsymbs] < 32);
}
#if CONFIG_LV_MAP
static INLINE void update_bin(aom_cdf_prob *cdf, int val, int nsymbs) {
update_cdf(cdf, val, nsymbs);
}
#endif
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -106,9 +106,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
int8_t signs[MAX_TX_SQUARE] = { 0 };
uint16_t update_pos[MAX_TX_SQUARE];
const int all_zero = av1_read_record_bin(
counts, r, ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2,
ACCT_STR);
const int all_zero = aom_read_symbol(
r, ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2, ACCT_STR);
// printf("txb_skip: %d %2d\n", txs_ctx, txb_ctx->txb_skip_ctx);
*eob = 0;
if (all_zero) {
......@@ -219,9 +218,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
// printf("Dec: ");
if (k_eob_offset_bits[eob_pt] > 0) {
int bit = av1_read_record_bin(
counts, r, ec_ctx->eob_extra_cdf[txs_ctx][plane_type][eob_pt], 2,
ACCT_STR);
int bit = aom_read_symbol(
r, ec_ctx->eob_extra_cdf[txs_ctx][plane_type][eob_pt], 2, ACCT_STR);
// printf("eob_extra_cdf: %d %d %2d\n", txs_ctx, plane_type, eob_pt);
if (bit) {
eob_extra += (1 << (k_eob_offset_bits[eob_pt] - 1));
......@@ -304,8 +302,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
if (levels[get_padded_idx(pos, bwl)] == 0) continue;
if (c == 0) {
const int dc_sign_ctx = txb_ctx->dc_sign_ctx;
*sign = av1_read_record_bin(
counts, r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2, ACCT_STR);
*sign = aom_read_symbol(r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx],
2, ACCT_STR);
} else {
*sign = av1_read_record_bit(counts, r, ACCT_STR);
}
......
......@@ -471,8 +471,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
DECLARE_ALIGNED(16, uint8_t, level_counts[MAX_TX_SQUARE]);
DECLARE_ALIGNED(16, int8_t, coeff_contexts[MAX_TX_SQUARE]);
aom_write_bin(w, eob == 0,
ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
aom_write_symbol(w, eob == 0,
ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
#if CONFIG_TXK_SEL
if (plane == 0 && eob == 0) {
assert(tx_type == DCT_DCT);
......@@ -527,8 +527,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (k_eob_offset_bits[eob_pt] > 0) {
int eob_shift = k_eob_offset_bits[eob_pt] - 1;
int bit = (eob_extra & (1 << eob_shift)) ? 1 : 0;
aom_write_bin(w, bit, ec_ctx->eob_extra_cdf[txs_ctx][plane_type][eob_pt],
2);
aom_write_symbol(w, bit, ec_ctx->eob_extra_cdf[txs_ctx][plane_type][eob_pt],
2);
for (int i = 1; i < k_eob_offset_bits[eob_pt]; i++) {
eob_shift = k_eob_offset_bits[eob_pt] - 1 - i;
bit = (eob_extra & (1 << eob_shift)) ? 1 : 0;
......@@ -564,8 +564,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (level == 0) continue;
if (c == 0) {
aom_write_bin(w, sign,
ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
aom_write_symbol(
w, sign, ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
} else {
aom_write_bit(w, sign);
}
......@@ -2216,9 +2216,10 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
#if CONFIG_ENTROPY_STATS
++td->counts->txb_skip[txsize_ctx][txb_ctx.txb_skip_ctx][eob == 0];
#endif // CONFIG_ENTROPY_STATS
if (allow_update_cdf)
update_bin(ec_ctx->txb_skip_cdf[txsize_ctx][txb_ctx.txb_skip_ctx], eob == 0,
if (allow_update_cdf) {
update_cdf(ec_ctx->txb_skip_cdf[txsize_ctx][txb_ctx.txb_skip_ctx], eob == 0,
2);
}
x->mbmi_ext->txb_skip_ctx[plane][block] = txb_ctx.txb_skip_ctx;
x->mbmi_ext->eobs[plane][block] = eob;
......@@ -2279,7 +2280,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
++td->counts->dc_sign[plane_type][dc_sign_ctx][sign];
#endif // CONFIG_ENTROPY_STATS
if (allow_update_cdf)
update_bin(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], sign, 2);
update_cdf(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], sign, 2);
x->mbmi_ext->dc_sign_ctx[plane][block] = dc_sign_ctx;
}
......
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