Commit 380fecd6 authored by Angie Chiang's avatar Angie Chiang

Turn on adaptive scan order

Change-Id: I43b3ce9bdee07107cbb5bc4b1ab216b3f0c5295d
parent 9afaec78
......@@ -38,6 +38,12 @@ extern "C" {
struct AV1Common;
typedef struct {
const int16_t *scan;
const int16_t *iscan;
const int16_t *neighbors;
} SCAN_ORDER;
struct tx_probs {
aom_prob p32x32[TX_SIZE_CONTEXTS][TX_SIZES - 1];
aom_prob p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 2];
......@@ -89,6 +95,8 @@ typedef struct frame_contexts {
int16_t nb_8X8[TX_TYPES][(64 + 1) * 2];
int16_t nb_16X16[TX_TYPES][(256 + 1) * 2];
int16_t nb_32X32[TX_TYPES][(1024 + 1) * 2];
SCAN_ORDER sc[TX_SIZES][TX_TYPES];
#endif
#if CONFIG_REF_MV
......
......@@ -963,10 +963,14 @@ void av1_init_scan_order(AV1_COMMON *cm) {
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;
SCAN_ORDER *sc = &cm->fc->sc[tx_size][tx_type];
for (i = 0; i < tx2d_size; ++i) {
non_zero_prob[i] = (1 << 16) / 2; // init non_zero_prob to 0.5
}
av1_update_scan_order_facade(cm, tx_size, tx_type);
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);
}
}
}
......
......@@ -16,6 +16,7 @@
#include "aom_ports/mem.h"
#include "av1/common/blockd.h"
#include "av1/common/entropymode.h"
#include "av1/common/enums.h"
#include "av1/common/onyxc_int.h"
......@@ -25,12 +26,6 @@ extern "C" {
#define MAX_NEIGHBORS 2
typedef struct {
const int16_t *scan;
const int16_t *iscan;
const int16_t *neighbors;
} SCAN_ORDER;
extern const SCAN_ORDER av1_default_scan_orders[TX_SIZES];
extern const SCAN_ORDER av1_scan_orders[TX_SIZES][TX_TYPES];
......@@ -74,6 +69,9 @@ static INLINE int get_coef_context(const int16_t *neighbors,
static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *const cm,
TX_SIZE tx_size, TX_TYPE tx_type) {
#if CONFIG_ADAPT_SCAN
return &cm->fc->sc[tx_size][tx_type];
#endif
(void)cm;
return &av1_scan_orders[tx_size][tx_type];
}
......
......@@ -27,6 +27,7 @@
#include "av1/common/entropymv.h"
#include "av1/common/quant_common.h"
#include "av1/common/reconinter.h" // av1_setup_dst_planes()
#include "av1/common/scan.h"
#include "av1/encoder/aq_variance.h"
#include "av1/encoder/block.h"
#include "av1/encoder/encodeframe.h"
......@@ -527,6 +528,9 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
}
av1_init_mv_probs(cm);
#if CONFIG_ADAPT_SCAN
av1_init_scan_order(cm);
#endif
av1_initialize_rd_consts(cpi);
// Tiling is ignored in the first pass.
......
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