Commit 1c904831 authored by Angie Chiang's avatar Angie Chiang

Add av1_up_sample_scan_count()

Change-Id: I25030297e0333f326d39f6c5b64cb2e4f3906852
parent 36967373
......@@ -6635,6 +6635,29 @@ void av1_down_sample_scan_count(uint32_t *non_zero_count_ds,
}
}
}
void av1_up_sample_scan_count(uint32_t *non_zero_count,
const uint32_t *non_zero_count_ds,
TX_SIZE tx_size, unsigned int block_num) {
const int tx_w = tx_size_wide[tx_size];
const int tx_h = tx_size_high[tx_size];
const int tx_w_ds = tx_w >> 1;
const int tx_h_ds = tx_h >> 1;
for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) {
for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) {
const int ci_ds = r_ds * tx_w_ds + c_ds;
const int r = r_ds << 1;
const int c = c_ds << 1;
const int ci = r * tx_w + c;
uint32_t count = ROUND_POWER_OF_TWO(non_zero_count_ds[ci_ds], 2);
clamp64(count, 0, block_num);
non_zero_count[ci] = count;
non_zero_count[ci + 1] = count;
non_zero_count[ci + tx_w] = count;
non_zero_count[ci + tx_w + 1] = count;
}
}
}
#endif
static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
......@@ -6645,8 +6668,6 @@ static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
const int tx2d_size = tx_size_2d[tx_size];
unsigned int block_num = cm->counts.txb_count[tx_size][tx_type];
uint32_t *non_zero_count_new = non_zero_count;
int count_size = tx2d_size;
#if USE_2X2_PROB
#if CONFIG_TX64X64
DECLARE_ALIGNED(16, uint32_t, non_zero_count_ds[1024]);
......@@ -6657,17 +6678,16 @@ static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
#endif // CONFIG_TX64X64
if (do_down_sample(tx_size)) {
av1_down_sample_scan_count(non_zero_count_ds, non_zero_count, tx_size);
non_zero_count_new = non_zero_count_ds;
count_size = tx2d_size >> 2;
block_num <<= 2;
av1_up_sample_scan_count(non_zero_count, non_zero_count_ds, tx_size,
block_num);
}
#endif
int i;
for (i = 0; i < count_size; i++) {
for (i = 0; i < tx2d_size; i++) {
int64_t curr_prob =
block_num == 0
? 0
: (non_zero_count_new[i] << ADAPT_SCAN_PROB_PRECISION) / block_num;
: (non_zero_count[i] << ADAPT_SCAN_PROB_PRECISION) / block_num;
int64_t prev_prob = prev_non_zero_prob[i];
int64_t pred_prob =
(curr_prob * rate +
......
......@@ -30,7 +30,7 @@ extern const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES];
extern const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES];
#if CONFIG_ADAPT_SCAN
#define USE_2X2_PROB 0
#define USE_2X2_PROB 1
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);
......
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