Commit 9deb614a authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Adding get_band_translate() function.

Moving code that gets band_translate array from get_scan_and_band()
function to get_band_translate() function. Renaming get_scan_and_band() to
get_scan().

Change-Id: I43047c205a1ca2a6e24be44db39dc04b7a385008
parent ba71191c
......@@ -181,28 +181,27 @@ static int get_entropy_context(TX_SIZE tx_size,
return combine_entropy_contexts(above_ec, left_ec);
}
static void get_scan_and_band(const MACROBLOCKD *xd, TX_SIZE tx_size,
PLANE_TYPE type, int block_idx,
const int16_t **scan,
const int16_t **scan_nb,
const uint8_t **band_translate) {
static const uint8_t *get_band_translate(TX_SIZE tx_size) {
return tx_size == TX_4X4 ? vp9_coefband_trans_4x4
: vp9_coefband_trans_8x8plus;
}
static void get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
PLANE_TYPE type, int block_idx,
const int16_t **scan, const int16_t **scan_nb) {
switch (tx_size) {
case TX_4X4:
get_scan_nb_4x4(get_tx_type_4x4(type, xd, block_idx), scan, scan_nb);
*band_translate = vp9_coefband_trans_4x4;
break;
case TX_8X8:
get_scan_nb_8x8(get_tx_type_8x8(type, xd), scan, scan_nb);
*band_translate = vp9_coefband_trans_8x8plus;
break;
case TX_16X16:
get_scan_nb_16x16(get_tx_type_16x16(type, xd), scan, scan_nb);
*band_translate = vp9_coefband_trans_8x8plus;
break;
case TX_32X32:
*scan = vp9_default_scan_32x32;
*scan_nb = vp9_default_scan_32x32_neighbors;
*band_translate = vp9_coefband_trans_8x8plus;
break;
default:
assert(!"Invalid transform size.");
......
......@@ -100,9 +100,9 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
const vp9_prob *prob;
vp9_coeff_count_model *coef_counts = counts->coef[tx_size];
const int16_t *scan, *nb;
const uint8_t *band_translate;
const uint8_t *const band_translate = get_band_translate(tx_size);
uint8_t token_cache[1024];
get_scan_and_band(xd, tx_size, type, block_idx, &scan, &nb, &band_translate);
get_scan(xd, tx_size, type, block_idx, &scan, &nb);
while (1) {
int val;
......
......@@ -137,12 +137,12 @@ static void optimize_b(MACROBLOCK *mb,
uint8_t token_cache[1024];
const int ib = txfrm_block_to_raster_block(plane_bsize, tx_size, block);
const int16_t *dequant_ptr = pd->dequant;
const uint8_t * band_translate;
const uint8_t *const band_translate = get_band_translate(tx_size);
assert((!type && !plane) || (type && plane));
dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block);
qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
get_scan_and_band(xd, tx_size, type, ib, &scan, &nb, &band_translate);
get_scan(xd, tx_size, type, ib, &scan, &nb);
assert(eob <= default_eob);
/* Now set up a Viterbi trellis to evaluate alternative roundings. */
......
......@@ -681,7 +681,6 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
const BLOCK_SIZE bs = get_plane_block_size(bsize, pd);
const int num_4x4_w = num_4x4_blocks_wide_lookup[bs];
const int num_4x4_h = num_4x4_blocks_high_lookup[bs];
const uint8_t *band_translate; // just for the get_scan_and_band call
init_rdcost_stack(x, tx_size, num_4x4_w, num_4x4_h,
ref_best_rd, rd_stack);
......@@ -692,8 +691,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
pd->above_context, pd->left_context,
num_4x4_w, num_4x4_h);
get_scan_and_band(xd, tx_size, pd->plane_type, 0, &rd_stack->scan,
&rd_stack->nb, &band_translate);
get_scan(xd, tx_size, pd->plane_type, 0, &rd_stack->scan, &rd_stack->nb);
foreach_transformed_block_in_plane(xd, bsize, plane,
block_yrd_txfm, rd_stack);
......
......@@ -122,7 +122,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
vp9_coeff_probs_model *const coef_probs = cpi->common.fc.coef_probs[tx_size];
const int ref = is_inter_block(mbmi);
uint8_t token_cache[1024];
const uint8_t *band_translate;
const uint8_t *const band_translate = get_band_translate(tx_size);
const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size);
int aoff, loff;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
......@@ -131,7 +131,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
pt = get_entropy_context(tx_size, pd->above_context + aoff,
pd->left_context + loff);
get_scan_and_band(xd, tx_size, type, block, &scan, &nb, &band_translate);
get_scan(xd, tx_size, type, block, &scan, &nb);
c = 0;
do {
const int band = get_coef_band(band_translate, c);
......
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