Commit bd47bfaa authored by Dake He's avatar Dake He
Browse files

[level map] cleanup and remove assertions

Removed assertions were not properly set up and may cause decoding failure when USE_CASUAL_CTX is enabled. This CL does not change bitstream.

Change-Id: Ib9193cbda32f342335a79aca39e9cc49204a0ec9
parent dee00eb0
...@@ -160,7 +160,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -160,7 +160,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
c = *eob - 1 - i; c = *eob - 1 - i;
int is_nz; int is_nz;
int coeff_ctx = get_nz_map_ctx(levels, c, scan, bwl, height, tx_type, 1); int coeff_ctx = get_nz_map_ctx(levels, c, scan, bwl, height, tx_type, 1);
// int eob_ctx = get_eob_ctx(tcoeffs, scan[c], txs_ctx, tx_type);
if (c < *eob - 1) { if (c < *eob - 1) {
is_nz = av1_read_record_bin( is_nz = av1_read_record_bin(
...@@ -180,16 +179,12 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -180,16 +179,12 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
int k; int k;
for (k = 0; k < NUM_BASE_LEVELS; ++k) { for (k = 0; k < NUM_BASE_LEVELS; ++k) {
int ctx = coeff_ctx; int ctx = coeff_ctx;
#if 0 // USE_CAUSAL_BASE_CTX read_coeffs
int is_k = av1_read_record_bit(counts, r, ACCT_STR);
#else
int is_k = av1_read_record_bin( int is_k = av1_read_record_bin(
counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][k][ctx], 2, counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][k][ctx], 2,
ACCT_STR); ACCT_STR);
if (counts) ++counts->coeff_base[txs_ctx][plane_type][k][ctx][is_k]; if (counts) ++counts->coeff_base[txs_ctx][plane_type][k][ctx][is_k];
#endif // semantic: is_k = 1 if level > (k+1)
// is_k = 1 if level > (k+1)
if (is_k == 0) { if (is_k == 0) {
cul_level += k + 1; cul_level += k + 1;
break; break;
......
...@@ -318,7 +318,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -318,7 +318,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
for (int i = 0; i < eob; ++i) { for (int i = 0; i < eob; ++i) {
c = eob - 1 - i; c = eob - 1 - i;
coeff_ctx = get_nz_map_ctx(tcoeff, c, scan, bwl, height, tx_type, 0); coeff_ctx = get_nz_map_ctx(tcoeff, c, scan, bwl, height, tx_type, 0);
if (c == eob - 1) assert(coeff_ctx == 0);
tran_low_t v = tcoeff[scan[c]]; tran_low_t v = tcoeff[scan[c]];
int is_nz = (v != 0); int is_nz = (v != 0);
...@@ -587,7 +586,6 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane, ...@@ -587,7 +586,6 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
int level = abs(v); int level = abs(v);
#if USE_CAUSAL_BASE_CTX #if USE_CAUSAL_BASE_CTX
coeff_ctx = get_nz_map_ctx(qcoeff, c, scan, bwl, height, tx_type, 0); coeff_ctx = get_nz_map_ctx(qcoeff, c, scan, bwl, height, tx_type, 0);
if (c == eob - 1) assert(coeff_ctx == 0);
#endif #endif
if (c < eob - 1) { if (c < eob - 1) {
...@@ -2018,7 +2016,6 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row, ...@@ -2018,7 +2016,6 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
#if USE_CAUSAL_BASE_CTX #if USE_CAUSAL_BASE_CTX
coeff_ctx = get_nz_map_ctx(tcoeff, c, scan, bwl, height, tx_type, 0); coeff_ctx = get_nz_map_ctx(tcoeff, c, scan, bwl, height, tx_type, 0);
if (c == eob - 1) assert(coeff_ctx == 0);
if (c < eob - 1) { if (c < eob - 1) {
++(*nz_map_count)[coeff_ctx][is_nz]; ++(*nz_map_count)[coeff_ctx][is_nz];
update_cdf(ec_ctx->nz_map_cdf[txsize_ctx][plane_type][coeff_ctx], is_nz, update_cdf(ec_ctx->nz_map_cdf[txsize_ctx][plane_type][coeff_ctx], is_nz,
......
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