Commit 41c7f448 authored by Jingning Han's avatar Jingning Han Committed by Yaowu Xu

Fix lv-map tile independence unit test

BUG=aomedia:719

Change-Id: Id47c2c68cb61e142ce62fee5e97f7c474b3dc273
parent 14cca44c
......@@ -45,12 +45,13 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int blk_row, int blk_col, int block,
int plane, tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
TX_SIZE tx_size, int16_t *max_scan_line, int *eob) {
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
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 = cm->fc->nz_map[txs_ctx][plane_type];
aom_prob *eob_flag = cm->fc->eob_flag[txs_ctx][plane_type];
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];
......@@ -69,10 +70,10 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if LV_MAP_PROB
int all_zero = aom_read_symbol(
r, cm->fc->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2, ACCT_STR);
r, ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2, ACCT_STR);
#else
int all_zero =
aom_read(r, cm->fc->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx], ACCT_STR);
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];
......@@ -105,7 +106,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (c < seg_eob - 1) {
#if LV_MAP_PROB
is_nz = aom_read_symbol(
r, cm->fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2, ACCT_STR);
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
......@@ -126,7 +127,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (is_nz) {
#if LV_MAP_PROB
int is_eob = aom_read_symbol(
r, cm->fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2, ACCT_STR);
r, ec_ctx->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
......@@ -141,7 +142,7 @@ 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 = cm->fc->coeff_base[txs_ctx][plane_type][i];
aom_prob *coeff_base = ec_ctx->coeff_base[txs_ctx][plane_type][i];
#endif
update_eob = 0;
for (c = *eob - 1; c >= 0; --c) {
......@@ -155,7 +156,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if LV_MAP_PROB
if (aom_read_symbol(r,
cm->fc->coeff_base_cdf[txs_ctx][plane_type][i][ctx],
ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx],
2, ACCT_STR))
#else
if (aom_read(r, coeff_base[ctx], ACCT_STR))
......@@ -170,10 +171,10 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
int dc_sign_ctx = txb_ctx->dc_sign_ctx;
#if LV_MAP_PROB
sign = aom_read_symbol(
r, cm->fc->dc_sign_cdf[plane_type][dc_sign_ctx], 2, ACCT_STR);
r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2, ACCT_STR);
#else
sign =
aom_read(r, cm->fc->dc_sign[plane_type][dc_sign_ctx], ACCT_STR);
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 {
......@@ -201,10 +202,10 @@ 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 = aom_read_symbol(r, cm->fc->dc_sign_cdf[plane_type][dc_sign_ctx], 2,
sign = aom_read_symbol(r, ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], 2,
ACCT_STR);
#else
sign = aom_read(r, cm->fc->dc_sign[plane_type][dc_sign_ctx], ACCT_STR);
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 {
......@@ -213,14 +214,14 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
ctx = get_br_ctx(tcoeffs, scan[c], bwl, height);
if (cm->fc->coeff_lps[txs_ctx][plane_type][ctx] == 0) exit(0);
if (ec_ctx->coeff_lps[txs_ctx][plane_type][ctx] == 0) exit(0);
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
#if LV_MAP_PROB
if (aom_read_symbol(r, cm->fc->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2,
if (aom_read_symbol(r, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx], 2,
ACCT_STR))
#else
if (aom_read(r, cm->fc->coeff_lps[txs_ctx][plane_type][ctx], ACCT_STR))
if (aom_read(r, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx], ACCT_STR))
#endif
{
*v = (idx + 1 + NUM_BASE_LEVELS);
......
......@@ -4969,7 +4969,7 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
#endif
#if CONFIG_LV_MAP
av1_fill_coeff_costs(&td->mb, cm->fc);
av1_fill_coeff_costs(&td->mb, td->mb.e_mbd.tile_ctx);
#endif
for (mi_row = tile_info->mi_row_start; mi_row < tile_info->mi_row_end;
......
......@@ -113,15 +113,16 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
const int height = tx_size_high[tx_size];
const int seg_eob = tx_size_2d[tx_size];
uint16_t update_eob = 0;
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)blk_row;
(void)blk_col;
#if LV_MAP_PROB
aom_write_symbol(w, eob == 0,
cm->fc->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
ec_ctx->txb_skip_cdf[txs_ctx][txb_ctx->txb_skip_ctx], 2);
#else
aom_write(w, eob == 0, cm->fc->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx]);
aom_write(w, eob == 0, ec_ctx->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx]);
#endif
if (eob == 0) return;
......@@ -131,8 +132,8 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#endif
#if !LV_MAP_PROB
nz_map = cm->fc->nz_map[txs_ctx][plane_type];
eob_flag = cm->fc->eob_flag[txs_ctx][plane_type];
nz_map = ec_ctx->nz_map[txs_ctx][plane_type];
eob_flag = ec_ctx->eob_flag[txs_ctx][plane_type];
#endif
for (c = 0; c < eob; ++c) {
......@@ -146,7 +147,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if LV_MAP_PROB
aom_write_symbol(w, is_nz,
cm->fc->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2);
#else
aom_write(w, is_nz, nz_map[coeff_ctx]);
#endif
......@@ -154,7 +155,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (is_nz) {
#if LV_MAP_PROB
aom_write_symbol(w, c == (eob - 1),
cm->fc->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2);
ec_ctx->eob_flag_cdf[txs_ctx][plane_type][eob_ctx], 2);
#else
aom_write(w, c == (eob - 1), eob_flag[eob_ctx]);
#endif
......@@ -164,7 +165,7 @@ void av1_write_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 = cm->fc->coeff_base[txs_ctx][plane_type][i];
aom_prob *coeff_base = ec_ctx->coeff_base[txs_ctx][plane_type][i];
#endif
update_eob = 0;
for (c = eob - 1; c >= 0; --c) {
......@@ -180,17 +181,17 @@ 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, cm->fc->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2);
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, cm->fc->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx],
w, sign, ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx],
2);
#else
aom_write(w, sign, cm->fc->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
aom_write(w, sign, ec_ctx->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
#endif
} else {
aom_write_bit(w, sign);
......@@ -200,7 +201,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if LV_MAP_PROB
aom_write_symbol(w, 0,
cm->fc->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2);
ec_ctx->coeff_base_cdf[txs_ctx][plane_type][i][ctx], 2);
#else
aom_write(w, 0, coeff_base[ctx]);
#endif
......@@ -220,9 +221,9 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (c == 0) {
#if LV_MAP_PROB
aom_write_symbol(
w, sign, cm->fc->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
w, sign, ec_ctx->dc_sign_cdf[plane_type][txb_ctx->dc_sign_ctx], 2);
#else
aom_write(w, sign, cm->fc->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
aom_write(w, sign, ec_ctx->dc_sign[plane_type][txb_ctx->dc_sign_ctx]);
#endif
} else {
aom_write_bit(w, sign);
......@@ -233,18 +234,18 @@ 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, cm->fc->coeff_lps_cdf[txs_ctx][plane_type][ctx],
aom_write_symbol(w, 1, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
#else
aom_write(w, 1, cm->fc->coeff_lps[txs_ctx][plane_type][ctx]);
aom_write(w, 1, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx]);
#endif
break;
}
#if LV_MAP_PROB
aom_write_symbol(w, 0, cm->fc->coeff_lps_cdf[txs_ctx][plane_type][ctx],
aom_write_symbol(w, 0, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2);
#else
aom_write(w, 0, cm->fc->coeff_lps[txs_ctx][plane_type][ctx]);
aom_write(w, 0, ec_ctx->coeff_lps[txs_ctx][plane_type][ctx]);
#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