Commit 2e52fb25 authored by Angie Chiang's avatar Angie Chiang
Browse files

Replace get_tx1d_size(), get_tx2d_size() by tx_size_1d tx_size_2d arrays

Change-Id: Id6b0e27a91dc42ae3a0aad1d55716001fef9e91c
parent d58f39d5
......@@ -11,6 +11,7 @@
#include <assert.h>
#include "av1/common/common_data.h"
#include "av1/common/scan.h"
DECLARE_ALIGNED(16, static const int16_t, default_scan_4x4[16]) = {
......@@ -744,10 +745,6 @@ const SCAN_ORDER av1_scan_orders[TX_SIZES][TX_TYPES] = {
#define COEFF_IDX_SIZE (1 << COEFF_IDX_BITS)
#define COEFF_IDX_MASK (COEFF_IDX_SIZE - 1)
int get_tx1d_size(TX_SIZE tx_size) { return 1 << (tx_size + 2); }
int get_tx2d_size(TX_SIZE tx_size) { return 1 << ((tx_size + 2) * 2); }
static uint32_t *get_non_zero_prob(FRAME_CONTEXT *fc, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
......@@ -809,7 +806,7 @@ void av1_update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
uint32_t *prev_non_zero_prob = get_non_zero_prob(pre_fc, tx_size, tx_type);
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
int tx2d_size = get_tx2d_size(tx_size);
const int tx2d_size = tx_size_2d[tx_size];
unsigned int block_num = cm->counts.txb_count[tx_size][tx_type];
int i;
for (i = 0; i < tx2d_size; i++) {
......@@ -878,8 +875,8 @@ static void dfs_scan(int tx1d_size, int *scan_idx, int coeff_idx, int16_t *scan,
void av1_update_neighbors(int tx_size, const int16_t *scan,
const int16_t *iscan, int16_t *neighbors) {
const int tx1d_size = get_tx1d_size(tx_size);
const int tx2d_size = get_tx2d_size(tx_size);
const int tx1d_size = tx_size_1d[tx_size];
const int tx2d_size = tx_size_2d[tx_size];
int scan_idx;
for (scan_idx = 0; scan_idx < tx2d_size; ++scan_idx) {
const int coeff_idx = scan[scan_idx];
......@@ -909,8 +906,8 @@ void av1_update_neighbors(int tx_size, const int16_t *scan,
void av1_update_sort_order(TX_SIZE tx_size, const uint32_t *non_zero_prob,
int16_t *sort_order) {
uint32_t temp[COEFF_IDX_SIZE];
const int tx1d_size = get_tx1d_size(tx_size);
const int tx2d_size = get_tx2d_size(tx_size);
const int tx1d_size = tx_size_1d[tx_size];
const int tx2d_size = tx_size_2d[tx_size];
int sort_idx;
assert(tx2d_size <= COEFF_IDX_SIZE);
memcpy(temp, non_zero_prob, tx2d_size * sizeof(*non_zero_prob));
......@@ -927,8 +924,8 @@ void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan,
int coeff_idx;
int scan_idx;
int sort_idx;
const int tx1d_size = get_tx1d_size(tx_size);
const int tx2d_size = get_tx2d_size(tx_size);
const int tx1d_size = tx_size_1d[tx_size];
const int tx2d_size = tx_size_2d[tx_size];
for (coeff_idx = 0; coeff_idx < tx2d_size; ++coeff_idx) {
iscan[coeff_idx] = -1;
......@@ -948,7 +945,7 @@ void av1_update_scan_order_facade(AV1_COMMON *cm, TX_SIZE tx_size,
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);
int tx2d_size = get_tx2d_size(tx_size);
const int tx2d_size = tx_size_2d[tx_size];
assert(tx2d_size <= 1024);
av1_update_sort_order(tx_size, non_zero_prob, sort_order);
av1_update_scan_order(tx_size, sort_order, scan, iscan);
......@@ -961,7 +958,7 @@ void av1_init_scan_order(AV1_COMMON *cm) {
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);
const int tx2d_size = tx_size_2d[tx_size];
int i;
SCAN_ORDER *sc = &cm->fc->sc[tx_size][tx_type];
for (i = 0; i < tx2d_size; ++i) {
......
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