ref: 8caabd077a94641c29d7c18204644537ec0c2470
parent: be51a7731d009be79cbc4cdd0a3009fc4c287291
parent: 81f94b893b2bd64eb28a8817bb9684380770e16c
author: Angie Chiang <angiebird@google.com>
date: Mon Oct 15 20:43:25 EDT 2018
Merge "Add indep loop for motion_compensated_prediction"
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5468,12 +5468,14 @@
#if CONFIG_NON_GREEDY_MV
static void prepare_nb_full_mvs(const TplDepFrame *tpl_frame, int mi_row,
- int mi_col, int rf_idx, int_mv *nb_full_mvs) {
+ int mi_col, int rf_idx, BLOCK_SIZE bsize,
+ int_mv *nb_full_mvs) {
+ const int mi_unit = num_8x8_blocks_wide_lookup[bsize];
const int dirs[NB_MVS_NUM][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } };
int i;
for (i = 0; i < NB_MVS_NUM; ++i) {
- int r = dirs[i][0];
- int c = dirs[i][1];
+ int r = dirs[i][0] * mi_unit;
+ int c = dirs[i][1] * mi_unit;
if (mi_row + r >= 0 && mi_row + r < tpl_frame->mi_rows && mi_col + c >= 0 &&
mi_col + c < tpl_frame->mi_cols) {
const TplDepStats *tpl_ptr =
@@ -5544,7 +5546,7 @@
#if CONFIG_NON_GREEDY_MV
(void)search_method;
(void)sadpb;
- prepare_nb_full_mvs(&cpi->tpl_stats[frame_idx], mi_row, mi_col, rf_idx,
+ prepare_nb_full_mvs(&cpi->tpl_stats[frame_idx], mi_row, mi_col, rf_idx, bsize,
nb_full_mvs);
vp9_full_pixel_diamond_new(cpi, x, &best_ref_mv1_full, step_param, lambda,
MAX_MVSEARCH_STEPS - 1 - step_param, 1,
@@ -5842,21 +5844,12 @@
for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
int_mv mv;
if (ref_frame[rf_idx] == NULL) {
-#if CONFIG_NON_GREEDY_MV
- tpl_stats->ready[rf_idx] = 0;
-#endif
continue;
} else {
-#if CONFIG_NON_GREEDY_MV
- tpl_stats->ready[rf_idx] = 1;
-#endif
}
#if CONFIG_NON_GREEDY_MV
- motion_compensated_prediction(
- cpi, td, frame_idx, xd->cur_buf->y_buffer + mb_y_offset,
- ref_frame[rf_idx]->y_buffer + mb_y_offset, xd->cur_buf->y_stride, bsize,
- mi_row, mi_col, tpl_stats, rf_idx);
+ (void)td;
mv.as_int = tpl_stats->mv_arr[rf_idx].as_int;
#else
motion_compensated_prediction(
@@ -6023,6 +6016,31 @@
tpl_frame->mv_dist_sum[rf_idx] = 0;
tpl_frame->mv_cost_sum[rf_idx] = 0;
}
+
+ for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col += mi_width) {
+ const int mb_y_offset =
+ mi_row * MI_SIZE * xd->cur_buf->y_stride + mi_col * MI_SIZE;
+ TplDepStats *tpl_stats =
+ &tpl_frame->tpl_stats_ptr[mi_row * tpl_frame->stride + mi_col];
+
+ set_mv_limits(cm, x, mi_row, mi_col);
+
+ for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ if (ref_frame[rf_idx] == NULL) {
+ tpl_stats->ready[rf_idx] = 0;
+ continue;
+ } else {
+ tpl_stats->ready[rf_idx] = 1;
+ }
+ motion_compensated_prediction(
+ cpi, td, frame_idx, xd->cur_buf->y_buffer + mb_y_offset,
+ ref_frame[rf_idx]->y_buffer + mb_y_offset, xd->cur_buf->y_stride,
+ bsize, mi_row, mi_col, tpl_stats, rf_idx);
+ }
+ }
+ }
+
#endif
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += mi_width) {