Commit 94cea4ac authored by Jingning Han's avatar Jingning Han

Experiment probability precision for lv-map coding

Experiment probability precision for binary coding in the lv-map
coding system.

Change-Id: I8d9c49eee6dc7ca7970390fa5febe25b80bfab3c
parent 237cf1b2
......@@ -50,6 +50,11 @@
#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))
#endif
#ifdef __cplusplus
extern "C" {
#endif
......@@ -198,6 +203,16 @@ 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);
update_cdf(cdf, ret, nsymbs);
return ret;
}
#endif
static INLINE int aom_read_tree_as_cdf(aom_reader *r,
const aom_tree_index *tree,
const aom_prob *probs) {
......
......@@ -142,6 +142,14 @@ static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *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);
update_cdf(cdf, symb, nsymbs);
}
#endif
static INLINE void aom_write_tree_as_cdf(aom_writer *w,
const aom_tree_index *tree,
const aom_prob *probs, int bits,
......
......@@ -195,6 +195,12 @@ 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
......
......@@ -76,7 +76,7 @@ static INLINE int read_nz_map(aom_reader *r, tran_low_t *tcoeffs, int plane,
if (c < seg_eob - 1) {
#if LV_MAP_PROB
is_nz = av1_read_record_symbol(
is_nz = av1_read_record_bin(
counts, r, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
......@@ -98,7 +98,7 @@ static INLINE int read_nz_map(aom_reader *r, tran_low_t *tcoeffs, int plane,
if (is_nz) {
#if LV_MAP_PROB
int is_eob = av1_read_record_symbol(
int is_eob = av1_read_record_bin(
counts, r, fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2,
ACCT_STR);
#else
......@@ -130,7 +130,7 @@ static INLINE int read_nz_map_vert(aom_reader *r, tran_low_t *tcoeffs,
for (int col = 0; col < width; ++col) {
int el_ctx = get_empty_line_ctx(col, eob_ls);
#if LV_MAP_PROB
int empty_line = av1_read_record_symbol(
int empty_line = av1_read_record_bin(
counts, r, fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx], 2,
ACCT_STR);
#else
......@@ -147,7 +147,7 @@ static INLINE int read_nz_map_vert(aom_reader *r, tran_low_t *tcoeffs,
get_nz_map_ctx(tcoeffs, coeff_idx, bwl, height, tx_type);
if (row + 1 != height) {
#if LV_MAP_PROB
int is_nz = av1_read_record_symbol(
int is_nz = av1_read_record_bin(
counts, r, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
......@@ -160,7 +160,7 @@ static INLINE int read_nz_map_vert(aom_reader *r, tran_low_t *tcoeffs,
if (row + 1 != height) {
int eob_ctx = get_hv_eob_ctx(col, row, eob_ls);
#if LV_MAP_PROB
int is_eob = av1_read_record_symbol(
int is_eob = av1_read_record_bin(
counts, r,
fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx], 2,
ACCT_STR);
......@@ -206,7 +206,7 @@ static INLINE int read_nz_map_horiz(aom_reader *r, tran_low_t *tcoeffs,
for (int row = 0; row < height; ++row) {
int el_ctx = get_empty_line_ctx(row, eob_ls);
#if LV_MAP_PROB
int empty_line = av1_read_record_symbol(
int empty_line = av1_read_record_bin(
counts, r, fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx], 2,
ACCT_STR);
#else
......@@ -223,7 +223,7 @@ static INLINE int read_nz_map_horiz(aom_reader *r, tran_low_t *tcoeffs,
get_nz_map_ctx(tcoeffs, coeff_idx, bwl, height, tx_type);
if (col + 1 != width) {
#if LV_MAP_PROB
int is_nz = av1_read_record_symbol(
int is_nz = av1_read_record_bin(
counts, r, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
......@@ -235,7 +235,7 @@ static INLINE int read_nz_map_horiz(aom_reader *r, tran_low_t *tcoeffs,
eob = AOMMAX(eob, iscan[coeff_idx] + 1);
int eob_ctx = get_hv_eob_ctx(row, col, eob_ls);
#if LV_MAP_PROB
int is_eob = av1_read_record_symbol(
int is_eob = av1_read_record_bin(
counts, r,
fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx], 2,
ACCT_STR);
......@@ -286,7 +286,7 @@ 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_symbol(
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
......@@ -324,7 +324,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
read_nz_map(r, tcoeffs, plane, scan, tx_size, tx_type, ec_ctx, counts);
} else {
#if LV_MAP_PROB
const int eob_mode = av1_read_record_symbol(
const int eob_mode = av1_read_record_bin(
counts, r, ec_ctx->eob_mode_cdf[txs_ctx][plane_type][tx_class], 2,
ACCT_STR);
#else
......@@ -366,7 +366,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
ctx = get_base_ctx(tcoeffs, scan[c], bwl, height, i + 1);
#if LV_MAP_PROB
if (av1_read_record_symbol(
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2,
ACCT_STR))
#else
......@@ -381,7 +381,7 @@ 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_symbol(
sign = av1_read_record_bin(
counts, r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2,
ACCT_STR);
#else
......@@ -414,7 +414,7 @@ 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_symbol(
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);
......@@ -431,7 +431,7 @@ 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_symbol(
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
......@@ -446,7 +446,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
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_symbol(
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2,
ACCT_STR))
#else
......@@ -476,9 +476,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#else
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
#if LV_MAP_PROB
if (av1_read_record_symbol(
counts, r, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2,
ACCT_STR))
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
......
......@@ -28,6 +28,16 @@ static INLINE int av1_read_record_symbol(FRAME_COUNTS *counts, aom_reader *r,
return aom_read_symbol(r, cdf, nsymbs, str);
}
#if CONFIG_LV_MAP
static INLINE int av1_read_record_bin(FRAME_COUNTS *counts, aom_reader *r,
aom_cdf_prob *cdf, int nsymbs,
const char *str) {
(void)str;
if (counts) ++counts->symbol_num[0];
return aom_read_bin(r, cdf, nsymbs, str);
}
#endif
static INLINE int av1_read_record(FRAME_COUNTS *counts, aom_reader *r, int prob,
const char *str) {
(void)str;
......@@ -59,6 +69,11 @@ static INLINE void av1_record_coeff(FRAME_COUNTS *counts, tran_low_t qcoeff) {
#define av1_read_record_symbol(counts, r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME)
#if CONFIG_LV_MAP
#define av1_read_record_bin(counts, r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_bin(r, cdf, nsymbs, ACCT_STR_NAME)
#endif
#define av1_read_record(counts, r, prob, ACCT_STR_NAME) \
aom_read(r, prob, ACCT_STR_NAME)
......
......@@ -125,16 +125,15 @@ 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_symbol(w, is_nz, fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx],
2);
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
aom_write_symbol(w, c == (eob - 1),
fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2);
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
......@@ -165,9 +164,8 @@ static INLINE void write_nz_map_vert(aom_writer *w, const tran_low_t *tcoeff,
assert(veob <= height);
int el_ctx = get_empty_line_ctx(c, eob_ls);
#if LV_MAP_PROB
aom_write_symbol(w, veob == 0,
fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
2);
aom_write_bin(w, veob == 0,
fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx], 2);
#else
aom_write(w, veob == 0,
fc->empty_line[txs_ctx][plane_type][tx_class][el_ctx]);
......@@ -179,15 +177,15 @@ static INLINE void write_nz_map_vert(aom_writer *w, const tran_low_t *tcoeff,
int coeff_ctx = get_nz_map_ctx(tcoeff, coeff_idx, bwl, height, tx_type);
if (r + 1 != height) {
#if LV_MAP_PROB
aom_write_symbol(w, is_nz,
fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
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) {
int eob_ctx = get_hv_eob_ctx(c, r, eob_ls);
#if LV_MAP_PROB
aom_write_symbol(
aom_write_bin(
w, r == veob - 1,
fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx], 2);
#else
......@@ -222,9 +220,8 @@ static INLINE void write_nz_map_horiz(aom_writer *w, const tran_low_t *tcoeff,
int16_t heob = eob_ls[r];
int el_ctx = get_empty_line_ctx(r, eob_ls);
#if LV_MAP_PROB
aom_write_symbol(w, heob == 0,
fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
2);
aom_write_bin(w, heob == 0,
fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx], 2);
#else
aom_write(w, heob == 0,
fc->empty_line[txs_ctx][plane_type][tx_class][el_ctx]);
......@@ -236,15 +233,15 @@ static INLINE void write_nz_map_horiz(aom_writer *w, const tran_low_t *tcoeff,
int coeff_ctx = get_nz_map_ctx(tcoeff, coeff_idx, bwl, height, tx_type);
if (c + 1 != width) {
#if LV_MAP_PROB
aom_write_symbol(w, is_nz,
fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
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) {
int eob_ctx = get_hv_eob_ctx(r, c, eob_ls);
#if LV_MAP_PROB
aom_write_symbol(
aom_write_bin(
w, c == heob - 1,
fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx], 2);
#else
......@@ -280,8 +277,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
(void)blk_col;
#if LV_MAP_PROB
aom_write_symbol(w, eob == 0,
ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
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
......@@ -301,8 +298,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
const int eob_offset = width + height;
const int eob_mode = eob > eob_offset;
#if LV_MAP_PROB
aom_write_symbol(w, eob_mode,
ec_ctx->eob_mode_cdf[txs_ctx][plane_type][tx_class], 2);
aom_write_bin(w, eob_mode,
ec_ctx->eob_mode_cdf[txs_ctx][plane_type][tx_class], 2);
#else
aom_write(w, eob_mode, ec_ctx->eob_mode[txs_ctx][plane_type][tx_class]);
#endif
......@@ -340,16 +337,16 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (level == i + 1) {
#if LV_MAP_PROB
aom_write_symbol(
w, 1, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2);
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_symbol(
w, sign, ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx],
2);
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
......@@ -360,8 +357,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
}
#if LV_MAP_PROB
aom_write_symbol(w, 0,
ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2);
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
......@@ -380,8 +377,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (c == 0) {
#if LV_MAP_PROB
aom_write_symbol(
w, sign, ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
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
......@@ -404,20 +401,20 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
br_set_idx = coeff_to_br_index[base_range];
for (idx = 0; idx < BASE_RANGE_SETS; ++idx) {
aom_write_symbol(w, idx == br_set_idx,
ec_ctx->coeff_br_cdf[txs_ctx][plane_type][idx][ctx], 2);
aom_write_bin(w, idx == br_set_idx,
ec_ctx->coeff_br_cdf[txs_ctx][plane_type][idx][ctx], 2);
if (idx == br_set_idx) {
br_base = br_index_to_coeff[br_set_idx];
br_offset = base_range - br_base;
int extra_bits = (1 << br_extra_bits[idx]) - 1;
for (int tok = 0; tok < extra_bits; ++tok) {
if (tok == br_offset) {
aom_write_symbol(
w, 1, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2);
aom_write_bin(w, 1, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
break;
}
aom_write_symbol(w, 0,
ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2);
aom_write_bin(w, 0, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
}
// aom_write_literal(w, br_offset, br_extra_bits[idx]);
break;
......@@ -429,16 +426,14 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
#if LV_MAP_PROB
aom_write_symbol(w, 1, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
aom_write_bin(w, 1, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2);
#else
aom_write(w, 1, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx]);
#endif
break;
}
#if LV_MAP_PROB
aom_write_symbol(w, 0, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
aom_write_bin(w, 0, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2);
#else
aom_write(w, 0, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx]);
#endif
......@@ -2004,13 +1999,13 @@ static INLINE void av1_update_nz_eob_counts(FRAME_CONTEXT *fc,
++(*nz_map_count)[coeff_ctx][is_nz];
#if LV_MAP_PROB
update_cdf(fc->nz_map_cdf[txsize_ctx][plane_type][coeff_ctx], is_nz, 2);
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)];
#if LV_MAP_PROB
update_cdf(fc->eob_flag_cdf[txsize_ctx][plane_type][eob_ctx],
update_bin(fc->eob_flag_cdf[txsize_ctx][plane_type][eob_ctx],
c == (eob - 1), 2);
#endif
}
......@@ -2040,7 +2035,7 @@ static INLINE void av1_update_nz_eob_counts_vert(
int el_ctx = get_empty_line_ctx(c, eob_ls);
++counts->empty_line[txs_ctx][plane_type][tx_class][el_ctx][veob == 0];
#if LV_MAP_PROB
update_cdf(fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
update_bin(fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
veob == 0, 2);
#endif
if (veob) {
......@@ -2052,14 +2047,14 @@ static INLINE void av1_update_nz_eob_counts_vert(
get_nz_map_ctx(tcoeff, coeff_idx, bwl, height, tx_type);
++(*nz_map_count)[coeff_ctx][is_nz];
#if LV_MAP_PROB
update_cdf(fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], is_nz, 2);
update_bin(fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], is_nz, 2);
#endif
if (is_nz) {
int eob_ctx = get_hv_eob_ctx(c, r, eob_ls);
++counts->hv_eob[txs_ctx][plane_type][tx_class][eob_ctx]
[r == veob - 1];
#if LV_MAP_PROB
update_cdf(fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx],
update_bin(fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx],
r == veob - 1, 2);
#endif
}
......@@ -2090,7 +2085,7 @@ static INLINE void av1_update_nz_eob_counts_horiz(
int el_ctx = get_empty_line_ctx(r, eob_ls);
++counts->empty_line[txs_ctx][plane_type][tx_class][el_ctx][heob == 0];
#if LV_MAP_PROB
update_cdf(fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
update_bin(fc->empty_line_cdf[txs_ctx][plane_type][tx_class][el_ctx],
heob == 0, 2);
#endif
if (heob) {
......@@ -2102,14 +2097,14 @@ static INLINE void av1_update_nz_eob_counts_horiz(
get_nz_map_ctx(tcoeff, coeff_idx, bwl, height, tx_type);
++(*nz_map_count)[coeff_ctx][is_nz];
#if LV_MAP_PROB
update_cdf(fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], is_nz, 2);
update_bin(fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], is_nz, 2);
#endif
if (is_nz) {
int eob_ctx = get_hv_eob_ctx(r, c, eob_ls);
++counts->hv_eob[txs_ctx][plane_type][tx_class][eob_ctx]
[c == heob - 1];
#if LV_MAP_PROB
update_cdf(fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx],
update_bin(fc->hv_eob_cdf[txs_ctx][plane_type][tx_class][eob_ctx],
c == heob - 1, 2);
#endif
}
......@@ -2157,7 +2152,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
++td->counts->txb_skip[txsize_ctx][txb_ctx.txb_skip_ctx][eob == 0];
#if LV_MAP_PROB
update_cdf(ec_ctx->txb_skip_cdf[txsize_ctx][txb_ctx.txb_skip_ctx], eob == 0,
update_bin(ec_ctx->txb_skip_cdf[txsize_ctx][txb_ctx.txb_skip_ctx], eob == 0,
2);
#endif
x->mbmi_ext->txb_skip_ctx[plane][block] = txb_ctx.txb_skip_ctx;
......@@ -2186,7 +2181,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
const TX_SIZE txs_ctx = get_txsize_context(tx_size);
++td->counts->eob_mode[txs_ctx][plane_type][tx_class][eob_mode];
#if LV_MAP_PROB
update_cdf(ec_ctx->eob_mode_cdf[txs_ctx][plane_type][tx_class], eob_mode,
update_bin(ec_ctx->eob_mode_cdf[txs_ctx][plane_type][tx_class], eob_mode,
2);
#endif
if (eob_mode == 0) {
......@@ -2222,7 +2217,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
if (level == i + 1) {
++td->counts->coeff_base[txsize_ctx][plane_type][i][ctx][1];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][i][ctx], 1,
update_bin(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][i][ctx], 1,
2);
#endif
if (c == 0) {
......@@ -2230,7 +2225,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
++td->counts->dc_sign[plane_type][dc_sign_ctx][v < 0];
#if LV_MAP_PROB
update_cdf(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], v < 0, 2);
update_bin(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], v < 0, 2);
#endif
x->mbmi_ext->dc_sign_ctx[plane][block] = dc_sign_ctx;
}
......@@ -2239,7 +2234,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
}
++td->counts->coeff_base[txsize_ctx][plane_type][i][ctx][0];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][i][ctx], 0, 2);
update_bin(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][i][ctx], 0, 2);
#endif
update_eob = AOMMAX(update_eob, c);
}
......@@ -2259,7 +2254,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
++td->counts->dc_sign[plane_type][dc_sign_ctx][v < 0];
#if LV_MAP_PROB
update_cdf(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], v < 0, 2);
update_bin(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], v < 0, 2);
#endif
x->mbmi_ext->dc_sign_ctx[plane][block] = dc_sign_ctx;
}
......@@ -2279,7 +2274,7 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
int br_offset = base_range - br_base;
++td->counts->coeff_br[txsize_ctx][plane_type][idx][ctx][1];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_br_cdf[txsize_ctx][plane_type][idx][ctx], 1,
update_bin(ec_ctx->coeff_br_cdf[txsize_ctx][plane_type][idx][ctx], 1,
2);
#endif
int extra_bits = (1 << br_extra_bits[idx]) - 1;
......@@ -2287,21 +2282,21 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
if (br_offset == tok) {
++td->counts->coeff_lps[txsize_ctx][plane_type][ctx][1];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 1,
update_bin(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 1,
2);
#endif
break;
}
++td->counts->coeff_lps[txsize_ctx][plane_type][ctx][0];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 0, 2);
update_bin(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 0, 2);
#endif
}
break;
}
++td->counts->coeff_br[txsize_ctx][plane_type][idx][ctx][0];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_br_cdf[txsize_ctx][plane_type][idx][ctx], 0, 2);
update_bin(ec_ctx->coeff_br_cdf[txsize_ctx][plane_type][idx][ctx], 0, 2);
#endif
}
#else // BR_NODE
......@@ -2309,13 +2304,13 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
++td->counts->coeff_lps[txsize_ctx][plane_type][ctx][1];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 1, 2);
update_bin(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 1, 2);
#endif
break;
}
++td->counts->coeff_lps[txsize_ctx][plane_type][ctx][0];
#if LV_MAP_PROB
update_cdf(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 0, 2);
update_bin(ec_ctx->coeff_lps_cdf[txsize_ctx][plane_type][ctx], 0, 2);
#endif
}
if (idx < COEFF_BASE_RANGE) continue;
......
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