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