Commit fabbd7eb authored by Angie Chiang's avatar Angie Chiang

Generate scan order one frame earlier

This should relief the concern of latency incurred by generating
scan order

The performance on lowres and midres remains neutral

Change-Id: If155f055540126ee834f5be1ab4b23013090ee89
parent 60669136
......@@ -50,6 +50,10 @@ typedef uint16_t aom_cdf_prob;
#define BR_NODE 1
#if CONFIG_ADAPT_SCAN
#define CACHE_SCAN_PROB 1
#endif
#define aom_prob_half ((aom_prob)128)
typedef int8_t aom_tree_index;
......
......@@ -6993,9 +6993,13 @@ void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan,
}
static void update_scan_order_facade(AV1_COMMON *cm, TX_SIZE tx_size,
TX_TYPE tx_type) {
TX_TYPE tx_type, int use_curr_frame) {
int16_t sort_order[COEFF_IDX_SIZE];
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
uint32_t *non_zero_prob;
if (use_curr_frame)
non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
else
non_zero_prob = get_non_zero_prob(cm->pre_fc, tx_size, tx_type);
int16_t *scan = get_adapt_scan(cm->fc, tx_size, tx_type);
int16_t *iscan = get_adapt_iscan(cm->fc, tx_size, tx_type);
int16_t *nb = get_adapt_nb(cm->fc, tx_size, tx_type);
......@@ -7052,7 +7056,7 @@ void av1_init_scan_order(AV1_COMMON *cm) {
non_zero_prob[i] =
(1 << ADAPT_SCAN_PROB_PRECISION) / 2; // init non_zero_prob to 0.5
}
update_scan_order_facade(cm, tx_size, tx_type);
update_scan_order_facade(cm, tx_size, tx_type, 1);
sc->scan = get_adapt_scan(cm->fc, tx_size, tx_type);
sc->iscan = get_adapt_iscan(cm->fc, tx_size, tx_type);
sc->neighbors = get_adapt_nb(cm->fc, tx_size, tx_type);
......@@ -7063,6 +7067,12 @@ void av1_init_scan_order(AV1_COMMON *cm) {
void av1_adapt_scan_order(AV1_COMMON *cm) {
TX_SIZE tx_size;
#if CACHE_SCAN_PROB
int use_curr_frame = 0;
#else // CACHE_SCAN_PROB
int use_curr_frame = 1;
#endif // CACHE_SCAN_PROB
for (tx_size = 0; tx_size < TX_SIZES_ALL; ++tx_size) {
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
if (tx_size > TX_32X16) continue;
......@@ -7072,7 +7082,7 @@ void av1_adapt_scan_order(AV1_COMMON *cm) {
TX_TYPE tx_type;
for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) {
update_scan_prob(cm, tx_size, tx_type, ADAPT_SCAN_UPDATE_RATE);
update_scan_order_facade(cm, tx_size, tx_type);
update_scan_order_facade(cm, tx_size, tx_type, use_curr_frame);
update_eob_threshold(cm, tx_size, tx_type);
}
}
......
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