Commit 00803a77 authored by Jingning Han's avatar Jingning Han
Browse files

Consolidate lv-map experiment

Change-Id: I2ae2a33574bc3072561e696a31e0ea2e0770afa9
parent 2457ec8c
......@@ -2156,20 +2156,6 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
av1_coef_pareto_cdfs(cm->fc);
}
#if CONFIG_LV_MAP
void av1_adapt_coef_probs(AV1_COMMON *cm) {
unsigned int count_sat, update_factor;
if (!frame_is_intra_only(cm) && cm->last_frame_type == KEY_FRAME) {
update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */
count_sat = COEF_COUNT_SAT_AFTER_KEY;
} else {
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
av1_adapt_txb_probs(cm, count_sat, update_factor);
}
#endif // CONFIG_LV_MAP
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
int cdf_size, const int num_tiles) {
int i;
......
......@@ -6352,9 +6352,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->hv_eob, default_hv_eob);
#endif // CONFIG_CTX1D
#if LV_MAP_PROB
av1_init_txb_probs(fc);
#endif // LV_MAP_PROB
#endif
av1_copy(fc->comp_bwdref_prob, default_comp_bwdref_p);
#if CONFIG_NEW_MULTISYMBOL
......
......@@ -165,7 +165,6 @@ typedef struct frame_contexts {
aom_prob hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS];
#endif // CONFIG_CTX1D
#if LV_MAP_PROB
aom_cdf_prob txb_skip_cdf[TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob nz_map_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS]
[CDF_SIZE(2)];
......@@ -191,7 +190,6 @@ typedef struct frame_contexts {
aom_cdf_prob hv_eob_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS]
[CDF_SIZE(2)];
#endif // CONFIG_CTX1D
#endif // LV_MAP_PROB
#endif
aom_prob newmv_prob[NEWMV_MODE_CONTEXTS];
......
......@@ -96,7 +96,6 @@ const int16_t av1_coeff_band_32x32[1024] = {
22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
};
#if LV_MAP_PROB
void av1_init_txb_probs(FRAME_CONTEXT *fc) {
TX_SIZE tx_size;
int plane, ctx, level;
......@@ -220,101 +219,6 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
}
#endif // CONFIG_CTX1D
}
#endif // LV_MAP_PROB
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor) {
FRAME_CONTEXT *fc = cm->fc;
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
TX_SIZE tx_size;
int plane, ctx, level;
// Update probability models for transform block skip flag
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size)
for (ctx = 0; ctx < TXB_SKIP_CONTEXTS; ++ctx)
fc->txb_skip[tx_size][ctx] = mode_mv_merge_probs(
pre_fc->txb_skip[tx_size][ctx], counts->txb_skip[tx_size][ctx]);
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < DC_SIGN_CONTEXTS; ++ctx)
fc->dc_sign[plane][ctx] = mode_mv_merge_probs(
pre_fc->dc_sign[plane][ctx], counts->dc_sign[plane][ctx]);
// Update probability models for non-zero coefficient map and eob flag.
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size)
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (level = 0; level < NUM_BASE_LEVELS; ++level)
for (ctx = 0; ctx < COEFF_BASE_CONTEXTS; ++ctx)
fc->coeff_base[tx_size][plane][level][ctx] =
merge_probs(pre_fc->coeff_base[tx_size][plane][level][ctx],
counts->coeff_base[tx_size][plane][level][ctx],
count_sat, update_factor);
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
for (ctx = 0; ctx < SIG_COEF_CONTEXTS; ++ctx) {
fc->nz_map[tx_size][plane][ctx] = merge_probs(
pre_fc->nz_map[tx_size][plane][ctx],
counts->nz_map[tx_size][plane][ctx], count_sat, update_factor);
}
for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx) {
fc->eob_flag[tx_size][plane][ctx] = merge_probs(
pre_fc->eob_flag[tx_size][plane][ctx],
counts->eob_flag[tx_size][plane][ctx], count_sat, update_factor);
}
}
}
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) {
fc->coeff_lps[tx_size][plane][ctx] = merge_probs(
pre_fc->coeff_lps[tx_size][plane][ctx],
counts->coeff_lps[tx_size][plane][ctx], count_sat, update_factor);
}
#if BR_NODE
for (int br = 0; br < BASE_RANGE_SETS; ++br) {
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) {
fc->coeff_br[tx_size][plane][br][ctx] =
merge_probs(pre_fc->coeff_br[tx_size][plane][br][ctx],
counts->coeff_br[tx_size][plane][br][ctx], count_sat,
update_factor);
}
}
#endif // BR_NODE
}
}
#if CONFIG_CTX1D
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class)
fc->eob_mode[tx_size][plane][tx_class] =
merge_probs(pre_fc->eob_mode[tx_size][plane][tx_class],
counts->eob_mode[tx_size][plane][tx_class], count_sat,
update_factor);
}
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class)
for (ctx = 0; ctx < EMPTY_LINE_CONTEXTS; ++ctx)
fc->empty_line[tx_size][plane][tx_class][ctx] =
merge_probs(pre_fc->empty_line[tx_size][plane][tx_class][ctx],
counts->empty_line[tx_size][plane][tx_class][ctx],
count_sat, update_factor);
}
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class)
for (ctx = 0; ctx < HV_EOB_CONTEXTS; ++ctx)
fc->hv_eob[tx_size][plane][tx_class][ctx] =
merge_probs(pre_fc->hv_eob[tx_size][plane][tx_class][ctx],
counts->hv_eob[tx_size][plane][tx_class][ctx],
count_sat, update_factor);
}
#endif
}
void av1_init_lv_map(AV1_COMMON *cm) {
LV_MAP_CTX_TABLE *coeff_ctx_table = &cm->coeff_ctx_table;
......
......@@ -607,12 +607,7 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
}
}
#if LV_MAP_PROB
void av1_init_txb_probs(FRAME_CONTEXT *fc);
#endif // LV_MAP_PROB
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor);
void av1_init_lv_map(AV1_COMMON *cm);
......
......@@ -3513,10 +3513,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
av1_diff_update_prob(&r, &fc->quarter_tx_size_prob, ACCT_STR);
#endif
#if CONFIG_LV_MAP && !LV_MAP_PROB
av1_read_txb_probs(fc, cm->tx_mode, &r, &cm->counts);
#endif // CONFIG_LV_MAP && !LV_MAP_PROB
#if !CONFIG_NEW_MULTISYMBOL
if (cm->tx_mode == TX_MODE_SELECT)
for (int i = 0; i < TXFM_PARTITION_CONTEXTS; ++i)
......@@ -3968,9 +3964,6 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data,
#else
make_update_tile_list_dec(pbi, 0, num_bwd_ctxs, tile_ctxs);
#endif
#if CONFIG_LV_MAP
av1_adapt_coef_probs(cm);
#endif // CONFIG_LV_MAP
#if CONFIG_SYMBOLRATE
av1_dump_symbol_rate(cm);
#endif
......
......@@ -65,10 +65,6 @@ static INLINE int read_nz_map(aom_reader *const r, uint8_t *const levels,
const PLANE_TYPE plane_type = get_plane_type(plane);
unsigned int(*nz_map_count)[SIG_COEF_CONTEXTS][2] =
(counts) ? &counts->nz_map[txs_ctx][plane_type] : NULL;
#if !LV_MAP_PROB
aom_prob *nz_map = fc->nz_map[txs_ctx][plane_type];
aom_prob *eob_flag = fc->eob_flag[txs_ctx][plane_type];
#endif
int c;
for (c = 0; c < seg_eob; ++c) {
int is_nz;
......@@ -76,13 +72,9 @@ static INLINE int read_nz_map(aom_reader *const r, uint8_t *const levels,
int eob_ctx = get_eob_ctx(scan[c], txs_ctx, tx_type);
if (c < seg_eob - 1) {
#if LV_MAP_PROB
is_nz = av1_read_record_bin(
counts, r, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
is_nz = aom_read(r, nz_map[coeff_ctx], ACCT_STR);
#endif
} else {
is_nz = 1;
}
......@@ -98,13 +90,9 @@ static INLINE int read_nz_map(aom_reader *const r, uint8_t *const levels,
if (counts) ++(*nz_map_count)[coeff_ctx][is_nz];
if (is_nz) {
#if LV_MAP_PROB
int is_eob = av1_read_record_bin(
counts, r, fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2,
ACCT_STR);
#else
int is_eob = aom_read(r, eob_flag[eob_ctx], ACCT_STR);
#endif
if (counts) ++counts->eob_flag[txs_ctx][plane_type][eob_ctx][is_eob];
if (is_eob) break;
}
......@@ -285,10 +273,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts = xd->counts;
TX_SIZE txs_ctx = get_txsize_context(tx_size);
PLANE_TYPE plane_type = get_plane_type(plane);
#if !LV_MAP_PROB
aom_prob *nz_map = ec_ctx->nz_map[txs_ctx][plane_type];
aom_prob *eob_flag = ec_ctx->eob_flag[txs_ctx][plane_type];
#endif
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const int seg_eob = tx_size_2d[tx_size];
int c = 0;
......@@ -303,14 +287,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
memset(tcoeffs, 0, sizeof(*tcoeffs) * seg_eob);
#if LV_MAP_PROB
int all_zero = av1_read_record_bin(
counts, r, ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2,
ACCT_STR);
#else
int all_zero =
aom_read(r, ec_ctx->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx], ACCT_STR);
#endif
if (xd->counts)
++xd->counts->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx][all_zero];
......@@ -398,13 +377,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
// int eob_ctx = get_eob_ctx(tcoeffs, scan[c], txs_ctx, tx_type);
if (c < *eob - 1) {
#if LV_MAP_PROB
is_nz = av1_read_record_bin(
counts, r, ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
is_nz = aom_read(r, nz_map[coeff_ctx], ACCT_STR);
#endif
} else {
is_nz = 1;
}
......@@ -454,9 +429,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
int i;
for (i = 0; i < NUM_BASE_LEVELS; ++i) {
#if !LV_MAP_PROB
aom_prob *coeff_base = ec_ctx->coeff_base[txs_ctx][plane_type][i];
#endif
update_eob = 0;
for (c = *eob - 1; c >= 0; --c) {
uint8_t *const level = &levels[scan[c]];
......@@ -467,14 +439,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
ctx = get_base_ctx(levels, scan[c], bwl, height, i + 1);
#if LV_MAP_PROB
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2,
ACCT_STR))
#else
if (aom_read(r, coeff_base[ctx], ACCT_STR))
#endif
{
ACCT_STR)) {
assert(*level == i + 1);
cul_level += i + 1;
......@@ -482,14 +449,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (c == 0) {
int dc_sign_ctx = txb_ctx->dc_sign_ctx;
#if LV_MAP_PROB
*sign = av1_read_record_bin(
counts, r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2,
ACCT_STR);
#else
*sign =
aom_read(r, ec_ctx->dc_sign[plane_type][dc_sign_ctx], ACCT_STR);
#endif
if (counts) ++counts->dc_sign[plane_type][dc_sign_ctx][*sign];
} else {
*sign = av1_read_record_bit(counts, r, ACCT_STR);
......@@ -514,12 +476,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (c == 0) {
int dc_sign_ctx = txb_ctx->dc_sign_ctx;
#if LV_MAP_PROB
*sign = av1_read_record_bin(
counts, r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2, ACCT_STR);
#else
*sign = aom_read(r, ec_ctx->dc_sign[plane_type][dc_sign_ctx], ACCT_STR);
#endif
if (counts) ++counts->dc_sign[plane_type][dc_sign_ctx][*sign];
} else {
*sign = av1_read_record_bit(counts, r, ACCT_STR);
......@@ -529,30 +487,18 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if BR_NODE
for (idx = 0; idx < BASE_RANGE_SETS; ++idx) {
#if LV_MAP_PROB
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_br_cdf[txs_ctx][plane_type][idx][ctx], 2,
ACCT_STR))
#else // LV_MAP_PROB
if (aom_read(r, ec_ctx->coeff_br[txs_ctx][plane_type][idx][ctx],
ACCT_STR))
#endif // LV_MAP_PROB
{
ACCT_STR)) {
int extra_bits = (1 << br_extra_bits[idx]) - 1;
// int br_offset = aom_read_literal(r, extra_bits, ACCT_STR);
int br_offset = 0;
int tok;
if (counts) ++counts->coeff_br[txs_ctx][plane_type][idx][ctx][1];
for (tok = 0; tok < extra_bits; ++tok) {
#if LV_MAP_PROB
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2,
ACCT_STR))
#else
if (aom_read(r, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx],
ACCT_STR))
#endif
{
ACCT_STR)) {
br_offset = tok;
if (counts) ++counts->coeff_lps[txs_ctx][plane_type][ctx][1];
break;
......@@ -645,50 +591,3 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
av1_set_contexts(xd, pd, plane, tx_size, cul_level, col, row);
return cul_level;
}
#if !LV_MAP_PROB
static void read_txb_probs(FRAME_CONTEXT *fc, const TX_SIZE tx_size,
aom_reader *r, FRAME_COUNTS *counts) {
#if !CONFIG_SYMBOLRATE
(void)counts;
#endif
int plane, ctx, level;
if (av1_read_record_bit(counts, r, ACCT_STR) == 0) return;
for (ctx = 0; ctx < TXB_SKIP_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->txb_skip[tx_size][ctx], ACCT_STR);
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < SIG_COEF_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->nz_map[tx_size][plane][ctx], ACCT_STR);
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->eob_flag[tx_size][plane][ctx], ACCT_STR);
for (level = 0; level < NUM_BASE_LEVELS; ++level)
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < COEFF_BASE_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->coeff_base[tx_size][plane][level][ctx],
ACCT_STR);
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->coeff_lps[tx_size][plane][ctx], ACCT_STR);
}
void av1_read_txb_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r,
FRAME_COUNTS *counts) {
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
TX_SIZE tx_size;
int ctx, plane;
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < DC_SIGN_CONTEXTS; ++ctx)
av1_diff_update_prob(r, &fc->dc_sign[plane][ctx], ACCT_STR);
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
read_txb_probs(fc, tx_size, r, counts);
}
#endif // !LV_MAP_PROB
......@@ -28,8 +28,4 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
int plane, tran_low_t *tcoeffs,
TX_SIZE tx_size, int16_t *max_scan_line,
int *eob);
#if !LV_MAP_PROB
void av1_read_txb_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r,
FRAME_COUNTS *counts);
#endif // !LV_MAP_PROB
#endif // DECODETXB_H_
......@@ -4557,9 +4557,6 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_cond_prob_diff_update(header_bc, &cm->fc->quarter_tx_size_prob,
cm->counts.quarter_tx_size, probwt);
#endif
#if CONFIG_LV_MAP
av1_write_txb_probs(cpi, header_bc);
#endif // CONFIG_LV_MAP
#if !CONFIG_NEW_MULTISYMBOL
if (cm->tx_mode == TX_MODE_SELECT)
......
......@@ -3311,7 +3311,7 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
MODE_INFO **mi = cm->mi_grid_visible + idx_str;
PC_TREE *const pc_root = td->pc_root[cm->mib_size_log2 - MIN_MIB_SIZE_LOG2];
#if CONFIG_LV_MAP && LV_MAP_PROB
#if CONFIG_LV_MAP
av1_fill_coeff_costs(&td->mb, xd->tile_ctx);
#else
av1_fill_token_costs_from_cdf(x->token_head_costs,
......
......@@ -5585,9 +5585,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
&cm->counts);
#endif // CONFIG_ENTROPY_STATS
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
#if CONFIG_LV_MAP
av1_adapt_coef_probs(cm);
#endif // CONFIG_LV_MAP
av1_adapt_intra_frame_probs(cm);
#if CONFIG_SIMPLE_BWD_ADAPT
make_update_tile_list_enc(cpi, cm->largest_tile_id, 1, tile_ctxs);
......
......@@ -144,21 +144,18 @@ void av1_update_eob_context(int eob, int seg_eob, TX_SIZE txsize,
for (int i = 1; i < max_eob_pt; i++) {
int eob_pos_ctx = get_eob_pos_ctx(i);
counts->eob_flag[txsize][plane][eob_pos_ctx][eob_pt == i]++;
#if LV_MAP_PROB
update_cdf(ec_ctx->eob_flag_cdf[txsize][plane][eob_pos_ctx], eob_pt == i,
2);
#endif
if (eob_pt == i) {
break;
}
}
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;
counts->eob_extra[txsize][plane][eob_pt][bit]++;
#if LV_MAP_PROB
update_cdf(ec_ctx->eob_extra_cdf[txsize][plane][eob_pt], bit, 2);
#endif
}
}
......@@ -268,10 +265,6 @@ static INLINE void write_nz_map(aom_writer *w, const tran_low_t *tcoeff,
#else
const int seg_eob = tx_size_2d[tx_size];
#endif
#if !LV_MAP_PROB
aom_prob *nz_map = fc->nz_map[txs_ctx][plane_type];
aom_prob *eob_flag = fc->eob_flag[txs_ctx][plane_type];
#endif
for (int c = 0; c < eob; ++c) {
int coeff_ctx = get_nz_map_ctx(tcoeff, c, scan, bwl, height, tx_type, 0);
......@@ -282,20 +275,11 @@ static INLINE void write_nz_map(aom_writer *w, const tran_low_t *tcoeff,
if (c == seg_eob - 1) break;
#if LV_MAP_PROB
aom_write_bin(w, is_nz, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
#else
aom_write(w, is_nz, nz_map[coeff_ctx]);
#endif
if (is_nz) {
#if LV_MAP_PROB
if (is_nz)
aom_write_bin(w, c == (eob - 1),
fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2);
#else
aom_write(w, c == (eob - 1), eob_flag[eob_ctx]);
#endif
}
}
}
......@@ -442,12 +426,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
(void)blk_row;
(void)blk_col;
#if LV_MAP_PROB
aom_write_bin(w, eob == 0,
ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
#else
aom_write(w, eob == 0, ec_ctx->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx]);
#endif
if (eob == 0) return;
......@@ -461,11 +441,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
get_min_tx_size(tx_size), w);
#endif
#if !LV_MAP_PROB
nz_map = ec_ctx->nz_map[txs_ctx][plane_type];
eob_flag = ec_ctx->eob_flag[txs_ctx][plane_type];
#endif
#if CONFIG_EOB_FIRST
int16_t eob_extra;
int16_t eob_pt = get_eob_pos_token(eob, &eob_extra);
......@@ -505,14 +480,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
tran_low_t v = tcoeff[scan[c]];
int is_nz = (v != 0);
#if LV_MAP_PROB
aom_write_bin(w, is_nz, ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx],
2);
// aom_write_symbol(w, is_nz,
// ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
#else
aom_write(w, is_nz, nz_map[coeff_ctx]);
#endif
}
#else // CONFIG_EOB_FIRST
......@@ -551,9 +520,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#endif // CONFIG_EOB_FIRST
for (int i = 0; i < NUM_BASE_LEVELS; ++i) {
#if !LV_MAP_PROB
aom_prob *coeff_base = ec_ctx->coeff_base[txs_ctx][plane_type][i];
#endif
update_eob = 0;
for (c = eob - 1; c >= 0; --c) {
const int level = levels[scan[c]];
......@@ -565,32 +531,20 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
ctx = get_base_ctx(levels, scan[c], bwl, height, i + 1);
if (level == i + 1) {
#if LV_MAP_PROB
aom_write_bin(w, 1, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx],
2);
#else
aom_write(w, 1, coeff_base[ctx]);
#endif
if (c == 0) {
#if LV_MAP_PROB
aom_write_bin(w, sign,
ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx],
2);
#else
aom_write(w, sign, ec_ctx->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
#endif
} else {
aom_write_bit(w, sign);
}
continue;
}
#if LV_MAP_PROB
aom_write_bin(w, 0, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx],
2);
#else
aom_write(w, 0, coeff_base[ctx]);
#endif
update_eob = AOMMAX(update_eob, c);
}
}
......@@ -604,12 +558,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (level <= NUM_BASE_LEVELS) continue;
if (c == 0) {
#if LV_MAP_PROB
aom_write_bin(w, sign,
ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
#else
aom_write(w, sign, ec_ctx->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
#endif
} else {
aom_write_bit(w, sign);
}
......@@ -2477,16 +2427,12 @@ static INLINE void av1_update_nz_eob_counts(FRAME_CONTEXT *fc,
if (c == seg_eob - 1) break;
++(*nz_map_count)[coeff_ctx][is_nz];
#if LV_MAP_PROB
update_bin(fc->nz_map_cdf[txsize_ctx][plane_type][coeff_ctx], is_nz, 2);
#endif
if (is_nz) {
++counts->eob_flag[txsize_ctx][plane_type][eob_ctx][c == (eob - 1)];