Commit c5da5c58 authored by Angie Chiang's avatar Angie Chiang
Browse files

Add init_scan_order()

init_scan_order will set non_zero_prob at every position in the block to
0.5 and then sort the non_zero_prob to get a zig zag scan order as
initialize scan order

Change-Id: I5cd9379b16e7a601e89783cc8a59355429a1f0c2
parent 8303fc70
......@@ -11,6 +11,7 @@
#include "aom_mem/aom_mem.h"
#include "av1/common/scan.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/seg_common.h"
......@@ -1169,6 +1170,10 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
av1_default_coef_probs(cm);
init_mode_probs(cm->fc);
av1_init_mv_probs(cm);
#if CONFIG_ADAPT_SCAN
init_scan_order(cm);
#endif
cm->fc->initialized = 1;
if (cm->frame_type == KEY_FRAME || cm->error_resilient_mode ||
......
......@@ -950,4 +950,20 @@ void update_scan_order_facade(AV1_COMMON *cm, TX_SIZE tx_size,
update_neighbors(tx_size, scan, iscan, nb);
}
void init_scan_order(AV1_COMMON *cm) {
TX_SIZE tx_size;
TX_TYPE tx_type;
for (tx_size = TX_4X4; tx_size < TX_SIZES; ++tx_size) {
for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) {
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
int tx2d_size = get_tx2d_size(tx_size);
int i;
for (i = 0; i < tx2d_size; ++i) {
non_zero_prob[i] = (1 << 16) / 2; // init non_zero_prob to 0.5
}
update_scan_order_facade(cm, tx_size, tx_type);
}
}
}
#endif
......@@ -59,6 +59,7 @@ void update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan,
// neighbors[] accordingly.
void update_neighbors(int tx_size, const int16_t *scan, const int16_t *iscan,
int16_t *neighbors);
void init_scan_order(AV1_COMMON *cm);
#endif
static INLINE int get_coef_context(const int16_t *neighbors,
......
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