Commit f8cfb72a authored by Geza Lore's avatar Geza Lore
Browse files

Refactor bsse and skip_txfm in MACROBLOCK.

Simple refactoring to 2 dimensional arrays, in preparation for 128
wide superblocks.

Change-Id: I40d447bd9fbd4f755534ea3cc82fc8f4676cea07
parent efe7d4e5
......@@ -164,12 +164,12 @@ struct macroblock {
int quant_fp;
// skip forward transform and quantization
uint8_t skip_txfm[MAX_MB_PLANE << 2];
uint8_t skip_txfm[MAX_MB_PLANE][4];
#define SKIP_TXFM_NONE 0
#define SKIP_TXFM_AC_DC 1
#define SKIP_TXFM_AC_ONLY 2
int64_t bsse[MAX_MB_PLANE << 2];
int64_t bsse[MAX_MB_PLANE][4];
// Used to store sub partition's choices.
MV pred_mv[MAX_REF_FRAMES];
......
......@@ -5273,7 +5273,7 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td,
// to reuse distortion values from the RD estimation, so we reset these
// flags here before evaluating RD for supertx coding.
for (plane = 0 ; plane < MAX_MB_PLANE ; plane++)
x->skip_txfm[plane << 2] = SKIP_TXFM_NONE;
x->skip_txfm[plane][0] = SKIP_TXFM_NONE;
mbmi = &xd->mi[0]->mbmi;
best_tx_nostx = mbmi->tx_type;
......
......@@ -449,7 +449,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#endif
if (x->quant_fp) {
// Encoding process for rtc mode
if (x->skip_txfm[0] == SKIP_TXFM_AC_DC && plane == 0) {
if (x->skip_txfm[0][0] == SKIP_TXFM_AC_DC && plane == 0) {
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
......@@ -460,12 +460,12 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
}
} else {
if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
int blk_index = (block >> (tx_size << 1));
if (x->skip_txfm[plane][blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_B);
} else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
} else if (x->skip_txfm[plane][blk_index] == SKIP_TXFM_AC_ONLY) {
// fast path forward transform and quantization
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_DC);
......
......@@ -764,18 +764,18 @@ static void model_rd_for_sb(VP10_COMP *cpi, BLOCK_SIZE bsize,
var = cpi->fn_ptr[unit_size].vf(src, p->src.stride,
dst, pd->dst.stride, &sse);
x->bsse[(i << 2) + block_idx] = sse;
x->bsse[i][block_idx] = sse;
sum_sse += sse;
x->skip_txfm[(i << 2) + block_idx] = SKIP_TXFM_NONE;
x->skip_txfm[i][block_idx] = SKIP_TXFM_NONE;
if (!x->select_tx_size) {
// Check if all ac coefficients can be quantized to zero.
if (var < ac_thr || var == 0) {
x->skip_txfm[(i << 2) + block_idx] = SKIP_TXFM_AC_ONLY;
x->skip_txfm[i][block_idx] = SKIP_TXFM_AC_ONLY;
// Check if dc coefficient can be quantized to zero.
if (sse - var < dc_thr || sse == var) {
x->skip_txfm[(i << 2) + block_idx] = SKIP_TXFM_AC_DC;
x->skip_txfm[i][block_idx] = SKIP_TXFM_AC_DC;
if (!sse || (var < low_ac_thr && sse - var < low_dc_thr))
low_err_skip = 1;
......@@ -1168,21 +1168,21 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
dist = (int64_t)tmp * 16;
}
} else if (max_txsize_lookup[plane_bsize] == tx_size) {
if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
if (x->skip_txfm[plane][block >> (tx_size << 1)] ==
SKIP_TXFM_NONE) {
// full forward transform and quantization
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_B);
dist_block(args->cpi, x, plane, block, blk_row, blk_col,
tx_size, &dist, &sse);
} else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
} else if (x->skip_txfm[plane][block >> (tx_size << 1)] ==
SKIP_TXFM_AC_ONLY) {
// compute DC coefficient
tran_low_t *const coeff = BLOCK_OFFSET(x->plane[plane].coeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block);
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_DC);
sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4;
sse = x->bsse[plane][block >> (tx_size << 1)] << 4;
dist = sse;
if (x->plane[plane].eobs[block]) {
const int64_t orig_sse = (int64_t)coeff[0] * coeff[0];
......@@ -1200,7 +1200,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
// SKIP_TXFM_AC_DC
// skip forward transform
x->plane[plane].eobs[block] = 0;
sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4;
sse = x->bsse[plane][block >> (tx_size << 1)] << 4;
dist = sse;
}
} else {
......@@ -6073,8 +6073,8 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
int orig_dst_stride[MAX_MB_PLANE];
int rs = 0;
INTERP_FILTER best_filter = SWITCHABLE;
uint8_t skip_txfm[MAX_MB_PLANE << 2] = {0};
int64_t bsse[MAX_MB_PLANE << 2] = {0};
uint8_t skip_txfm[MAX_MB_PLANE][4] = {{0}};
int64_t bsse[MAX_MB_PLANE][4] = {{0}};
int skip_txfm_sb = 0;
int64_t skip_sse_sb = INT64_MAX;
......
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