Commit 5d0b310b authored by Jingning Han's avatar Jingning Han

Make adapt-scan support multi-thread encoding

This commit makes the adaptive scan order system support multi-
thread encoding. It fixes unit test failure issue associated with
AV1/AVxEncoderThreadTest.EncoderResultTest/0.

BUG=aomedia:353

Change-Id: I61cbf9531c8deab97fb3bb17428d0b2a63cf309a
parent cb512283
......@@ -6629,13 +6629,13 @@ static void update_scan_count(int16_t *scan, int max_scan,
}
}
void av1_update_scan_count_facade(AV1_COMMON *cm, TX_SIZE tx_size,
TX_TYPE tx_type, const tran_low_t *dqcoeffs,
int max_scan) {
void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts,
TX_SIZE tx_size, TX_TYPE tx_type,
const tran_low_t *dqcoeffs, int max_scan) {
int16_t *scan = get_adapt_scan(cm->fc, tx_size, tx_type);
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
uint32_t *non_zero_count = get_non_zero_counts(counts, tx_size, tx_type);
update_scan_count(scan, max_scan, dqcoeffs, non_zero_count);
++cm->counts.txb_count[tx_size][tx_type];
++counts->txb_count[tx_size][tx_type];
}
static int cmp_prob(const void *a, const void *b) {
......
......@@ -32,9 +32,9 @@ extern const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES];
#if CONFIG_ADAPT_SCAN
void av1_update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
int rate_16);
void av1_update_scan_count_facade(AV1_COMMON *cm, TX_SIZE tx_size,
TX_TYPE tx_type, const tran_low_t *dqcoeffs,
int max_scan);
void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts,
TX_SIZE tx_size, TX_TYPE tx_type,
const tran_low_t *dqcoeffs, int max_scan);
// embed r + c and coeff_idx info with nonzero probabilities. When sorting the
// nonzero probabilities, if there is a tie, the coefficient with smaller r + c
......
......@@ -522,7 +522,8 @@ static void predict_and_reconstruct_intra_block(
av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#if CONFIG_ADAPT_SCAN
av1_update_scan_count_facade(cm, tx_size, tx_type, pd->dqcoeff, eob);
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,
......@@ -562,7 +563,8 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
av1_decode_block_tokens(xd, plane, sc, blk_col, blk_row, plane_tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#if CONFIG_ADAPT_SCAN
av1_update_scan_count_facade(cm, tx_size, tx_type, pd->dqcoeff, eob);
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)
......@@ -615,7 +617,8 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
#if CONFIG_ADAPT_SCAN
av1_update_scan_count_facade(cm, tx_size, tx_type, pd->dqcoeff, eob);
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,
......
......@@ -589,7 +589,8 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
// av1_update_scan_count_facade(). The update behavior should be the same
// because av1_update_scan_count_facade() only cares if coefficients are zero
// or not.
av1_update_scan_count_facade((AV1_COMMON *)cm, tx_size, tx_type, qcoeff, c);
av1_update_scan_count_facade((AV1_COMMON *)cm, td->counts, tx_size, tx_type,
qcoeff, c);
#endif
av1_set_contexts(xd, pd, plane, tx_size, c > 0, blk_col, blk_row);
......
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