This commit is contained in:
Anthony Minessale
2019-09-11 15:51:47 +00:00
committed by Andrey Volk
parent 34fcadbd53
commit ceb051af4e
821 changed files with 89961 additions and 48650 deletions

View File

@@ -173,9 +173,8 @@ static int get_prediction_error(BLOCK *be, BLOCKD *b) {
static int pick_intra4x4block(MACROBLOCK *x, int ib,
B_PREDICTION_MODE *best_mode,
const int *mode_costs,
int *bestrate, int *bestdistortion) {
const int *mode_costs, int *bestrate,
int *bestdistortion) {
BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->block[ib];
int dst_stride = x->e_mbd.dst.y_stride;
@@ -564,7 +563,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO best_mbmode;
int_mv best_ref_mv_sb[2];
int_mv best_ref_mv_sb[2] = { { 0 }, { 0 } };
int_mv mode_mv_sb[2][MB_MODE_COUNT];
int_mv best_ref_mv;
int_mv *mode_mv;
@@ -602,7 +601,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
/* search range got from mv_pred(). It uses step_param levels. (0-7) */
int sr = 0;
unsigned char *plane[4][3];
unsigned char *plane[4][3] = { { 0, 0 } };
int ref_frame_map[4];
int sign_bias = 0;
int dot_artifact_candidate = 0;
@@ -631,13 +630,16 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
}
}
#endif
assert(plane[LAST_FRAME][0] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_y, stride, plane[LAST_FRAME][0], mb_row, mb_col, 0);
// If not found in Y channel, check UV channel.
if (!dot_artifact_candidate) {
assert(plane[LAST_FRAME][1] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_u, stride_uv, plane[LAST_FRAME][1], mb_row, mb_col, 1);
if (!dot_artifact_candidate) {
assert(plane[LAST_FRAME][2] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_v, stride_uv, plane[LAST_FRAME][2], mb_row, mb_col,
2);
@@ -741,10 +743,10 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
/* If the frame has big static background and current MB is in low
* motion area, its mode decision is biased to ZEROMV mode.
* No adjustment if cpu_used is <= -12 (i.e., cpi->Speed >= 12).
* At such speed settings, ZEROMV is already heavily favored.
*/
* motion area, its mode decision is biased to ZEROMV mode.
* No adjustment if cpu_used is <= -12 (i.e., cpi->Speed >= 12).
* At such speed settings, ZEROMV is already heavily favored.
*/
if (cpi->Speed < 12) {
calculate_zeromv_rd_adjustment(cpi, x, &rd_adjustment);
}
@@ -1068,10 +1070,12 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
rate2 +=
vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, cpi->mb.mvcost, 128);
}
// fall through
case NEARESTMV:
case NEARMV:
if (mode_mv[this_mode].as_int == 0) continue;
// fall through
case ZEROMV:
@@ -1301,9 +1305,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
update_mvcount(x, &best_ref_mv);
}
void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_) {
void vp8_pick_intra_mode(MACROBLOCK *x, int *rate) {
int error4x4, error16x16 = INT_MAX;
int rate, best_rate = 0, distortion, best_sse;
int rate_, best_rate = 0, distortion, best_sse;
MB_PREDICTION_MODE mode, best_mode = DC_PRED;
int this_rd;
unsigned int sse;
@@ -1321,23 +1325,23 @@ void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_) {
xd->predictor, 16);
distortion = vpx_variance16x16(*(b->base_src), b->src_stride, xd->predictor,
16, &sse);
rate = x->mbmode_cost[xd->frame_type][mode];
this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
rate_ = x->mbmode_cost[xd->frame_type][mode];
this_rd = RDCOST(x->rdmult, x->rddiv, rate_, distortion);
if (error16x16 > this_rd) {
error16x16 = this_rd;
best_mode = mode;
best_sse = sse;
best_rate = rate;
best_rate = rate_;
}
}
xd->mode_info_context->mbmi.mode = best_mode;
error4x4 = pick_intra4x4mby_modes(x, &rate, &best_sse);
error4x4 = pick_intra4x4mby_modes(x, &rate_, &best_sse);
if (error4x4 < error16x16) {
xd->mode_info_context->mbmi.mode = B_PRED;
best_rate = rate;
best_rate = rate_;
}
*rate_ = best_rate;
*rate = best_rate;
}