Merge changes Ic1ce346a,Ic0b4e92c
* changes: Simplify model_rd_for_sb HBD ifdefs Simplify dist_block HBD ifdefs
This commit is contained in:
commit
90e563d91f
@ -172,6 +172,12 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
|
||||
const int shift = 6;
|
||||
int rate;
|
||||
int64_t dist;
|
||||
const int dequant_shift =
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
(xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ?
|
||||
xd->bd - 5 :
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
3;
|
||||
|
||||
x->pred_sse[ref] = 0;
|
||||
|
||||
@ -237,12 +243,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
|
||||
if (cpi->sf.simple_model_rd_from_var) {
|
||||
int64_t rate;
|
||||
const int64_t square_error = sum_sse;
|
||||
int quantizer = (pd->dequant[1] >> 3);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
quantizer >>= (xd->bd - 8);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
int quantizer = (pd->dequant[1] >> dequant_shift);
|
||||
|
||||
if (quantizer < 120)
|
||||
rate = (square_error * (280 - quantizer)) >> 8;
|
||||
@ -252,19 +253,9 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
|
||||
rate_sum += rate;
|
||||
dist_sum += dist;
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
vp9_model_rd_from_var_lapndz(sum_sse, num_pels_log2_lookup[bs],
|
||||
pd->dequant[1] >> (xd->bd - 5),
|
||||
&rate, &dist);
|
||||
} else {
|
||||
vp9_model_rd_from_var_lapndz(sum_sse, num_pels_log2_lookup[bs],
|
||||
pd->dequant[1] >> 3, &rate, &dist);
|
||||
}
|
||||
#else
|
||||
vp9_model_rd_from_var_lapndz(sum_sse, num_pels_log2_lookup[bs],
|
||||
pd->dequant[1] >> 3, &rate, &dist);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
pd->dequant[1] >> dequant_shift,
|
||||
&rate, &dist);
|
||||
rate_sum += rate;
|
||||
dist_sum += dist;
|
||||
}
|
||||
@ -427,9 +418,6 @@ static int cost_coeffs(MACROBLOCK *x,
|
||||
}
|
||||
|
||||
static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size,
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
int bd,
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
int64_t *out_dist, int64_t *out_sse) {
|
||||
const int ss_txfrm_size = tx_size << 1;
|
||||
MACROBLOCKD* const xd = &x->e_mbd;
|
||||
@ -440,6 +428,7 @@ static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size,
|
||||
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
|
||||
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const int bd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? xd->bd : 8;
|
||||
*out_dist = vp9_highbd_block_error(coeff, dqcoeff, 16 << ss_txfrm_size,
|
||||
&this_sse, bd) >> shift;
|
||||
#else
|
||||
@ -451,11 +440,11 @@ static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size,
|
||||
if (x->skip_encode && !is_inter_block(&xd->mi[0]->mbmi)) {
|
||||
// TODO(jingning): tune the model to better capture the distortion.
|
||||
int64_t p = (pd->dequant[1] * pd->dequant[1] *
|
||||
(1 << ss_txfrm_size)) >> (shift + 2);
|
||||
(1 << ss_txfrm_size)) >>
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
p >>= ((xd->bd - 8) * 2);
|
||||
}
|
||||
(shift + 2 + (bd - 8) * 2);
|
||||
#else
|
||||
(shift + 2);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
*out_dist += (p >> 4);
|
||||
*out_sse += p;
|
||||
@ -490,29 +479,13 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
|
||||
if (!is_inter_block(mbmi)) {
|
||||
struct encode_b_args arg = {x, NULL, &mbmi->skip};
|
||||
vp9_encode_block_intra(plane, block, plane_bsize, tx_size, &arg);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
dist_block(x, plane, block, tx_size, xd->bd, &dist, &sse);
|
||||
} else {
|
||||
dist_block(x, plane, block, tx_size, 8, &dist, &sse);
|
||||
}
|
||||
#else
|
||||
dist_block(x, plane, block, tx_size, &dist, &sse);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} else if (max_txsize_lookup[plane_bsize] == tx_size) {
|
||||
if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
|
||||
SKIP_TXFM_NONE) {
|
||||
// full forward transform and quantization
|
||||
vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
dist_block(x, plane, block, tx_size, xd->bd, &dist, &sse);
|
||||
} else {
|
||||
dist_block(x, plane, block, tx_size, 8, &dist, &sse);
|
||||
}
|
||||
#else
|
||||
dist_block(x, plane, block, tx_size, &dist, &sse);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
|
||||
SKIP_TXFM_AC_ONLY) {
|
||||
// compute DC coefficient
|
||||
@ -543,15 +516,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
|
||||
} else {
|
||||
// full forward transform and quantization
|
||||
vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
dist_block(x, plane, block, tx_size, xd->bd, &dist, &sse);
|
||||
} else {
|
||||
dist_block(x, plane, block, tx_size, 8, &dist, &sse);
|
||||
}
|
||||
#else
|
||||
dist_block(x, plane, block, tx_size, &dist, &sse);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
rd = RDCOST(x->rdmult, x->rddiv, 0, dist);
|
||||
|
Loading…
x
Reference in New Issue
Block a user