GF_PICTURE *gf_picture, int frame_idx,
TplDepFrame *tpl_frame, int rf_idx,
BLOCK_SIZE bsize, int mi_row, int mi_col,
- double *rd) {
+ double *future_rd_diff) {
const int mi_height = num_8x8_blocks_high_lookup[bsize];
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
int tmp_mv_mode_arr[kMvPreCheckSize];
int stride = tpl_frame->stride;
double new_mv_rd = 0;
double no_new_mv_rd = 0;
+ double this_new_mv_rd = 0;
+ double this_no_new_mv_rd = 0;
int idx;
int tmp_idx;
assert(kMvPreCheckSize == (kMvPreCheckLines * (kMvPreCheckLines + 1)) >> 1);
mv_mode_arr[nb_row * stride + nb_col] =
find_best_ref_mv_mode(cpi, x, gf_picture, frame_idx, tpl_frame,
rf_idx, bsize, nb_row, nb_col, &this_rd, mv);
+ if (r == 0 && c == 0) {
+ this_no_new_mv_rd = this_rd;
+ }
no_new_mv_rd += this_rd;
tmp_mv_mode_arr[tmp_idx] = mv_mode_arr[nb_row * stride + nb_col];
tmp_select_mv_arr[tmp_idx] = select_mv_arr[nb_row * stride + nb_col];
// new mv
mv_mode_arr[mi_row * stride + mi_col] = NEW_MV_MODE;
- new_mv_rd = eval_mv_mode(NEW_MV_MODE, cpi, x, gf_picture, frame_idx,
- tpl_frame, rf_idx, bsize, mi_row, mi_col,
- &select_mv_arr[mi_row * stride + mi_col]);
+ this_new_mv_rd = eval_mv_mode(NEW_MV_MODE, cpi, x, gf_picture, frame_idx,
+ tpl_frame, rf_idx, bsize, mi_row, mi_col,
+ &select_mv_arr[mi_row * stride + mi_col]);
+ new_mv_rd = this_new_mv_rd;
// We start from idx = 1 because idx = 0 is evaluated as NEW_MV_MODE
// beforehand.
for (idx = 1; idx < kMvPreCheckLines; ++idx) {
// update best_mv_mode
tmp_idx = 0;
if (no_new_mv_rd < new_mv_rd) {
- *rd = no_new_mv_rd;
for (idx = 0; idx < kMvPreCheckLines; ++idx) {
int r;
for (r = 0; r <= idx; ++r) {
}
}
}
+ *future_rd_diff = 0;
} else {
- *rd = new_mv_rd;
+ *future_rd_diff =
+ (no_new_mv_rd - this_no_new_mv_rd) - (new_mv_rd - this_new_mv_rd);
}
}
int r;
for (r = VPXMAX(idx - unit_cols + 1, 0); r <= VPXMIN(idx, unit_rows - 1);
++r) {
- double rd; // TODO(angiebird): Use this information later.
+ double future_rd_diff; // TODO(angiebird): Use this information later.
int c = idx - r;
int mi_row = r * mi_height;
int mi_col = c * mi_width;
assert(mi_row >= 0 && mi_row < tpl_frame->mi_rows);
assert(mi_col >= 0 && mi_col < tpl_frame->mi_cols);
predict_mv_mode(cpi, x, gf_picture, frame_idx, tpl_frame, rf_idx, bsize,
- mi_row, mi_col, &rd);
+ mi_row, mi_col, &future_rd_diff);
}
}
}