Commit 5c0568a1 authored by Angie Chiang's avatar Angie Chiang

Sync ENC/DEC behaviors of update scan count

Change-Id: Id70fbfbca6c53a0aa15ff5606bb972e7412b3ed0
parent 0eb767b8
......@@ -567,14 +567,9 @@ static void predict_and_reconstruct_intra_block(
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size,
av1_decode_block_tokens(cm, xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
pd->dqcoeff, eob);
#endif
if (eob)
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
......@@ -616,15 +611,10 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
#else // CONFIG_LV_MAP
const SCAN_ORDER *sc = get_scan(cm, plane_tx_size, tx_type, 1);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(xd, plane, sc, blk_col, blk_row, plane_tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
const int eob = av1_decode_block_tokens(
cm, xd, plane, sc, blk_col, blk_row, plane_tx_size, tx_type,
&max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
pd->dqcoeff, eob);
#endif
inverse_transform_block(xd, plane, tx_type, plane_tx_size,
&pd->dst.buf[(blk_row * pd->dst.stride + blk_col)
<< tx_size_wide_log2[0]],
......@@ -678,16 +668,11 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
int16_t max_scan_line = 0;
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 1);
const int eob =
av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size, tx_type,
&max_scan_line, r, segment_id);
av1_decode_block_tokens(cm, xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, segment_id);
#endif // CONFIG_LV_MAP
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
eob);
#endif
if (eob)
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
......
......@@ -199,7 +199,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
return cul_level;
}
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm, MACROBLOCKD *xd,
uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line, int *eob) {
......@@ -225,6 +225,13 @@ uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm, MACROBLOCKD *xd,
pd->left_context + row, &txb_ctx);
uint8_t cul_level = av1_read_coeffs_txb(cm, xd, r, block, plane, tcoeffs,
&txb_ctx, max_scan_line, eob);
#if CONFIG_ADAPT_SCAN
PLANE_TYPE plane_type = get_plane_type(plane);
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
if (xd->counts && *eob > 0)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
*eob);
#endif
av1_set_contexts(xd, pd, plane, tx_size, cul_level, col, row);
return cul_level;
}
......@@ -23,7 +23,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
int16_t *max_scan_line, int *eob);
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm, MACROBLOCKD *xd,
uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line, int *eob);
......
......@@ -440,7 +440,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
#endif // CONFIG_PALETTE
#if !CONFIG_PVQ || CONFIG_VAR_TX
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
int av1_decode_block_tokens(AV1_COMMON *cm, MACROBLOCKD *const xd, int plane,
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
TX_TYPE tx_type, int16_t *max_scan_line,
aom_reader *r, int seg_id) {
......@@ -464,6 +464,11 @@ int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
#endif // CONFIG_AOM_QM
ctx, sc->scan, sc->neighbors, max_scan_line, r);
av1_set_contexts(xd, pd, plane, tx_size, eob > 0, x, y);
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
eob);
#endif
return eob;
}
#endif // !CONFIG_PVQ
......@@ -29,7 +29,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, aom_reader *r);
#endif // CONFIG_PALETTE
#if !CONFIG_PVQ || CONFIG_VAR_TX
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
int av1_decode_block_tokens(AV1_COMMON *cm, MACROBLOCKD *const xd, int plane,
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
TX_TYPE tx_type, int16_t *max_scan_line,
aom_reader *r, int seg_id);
......
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