FPMT: Initialize max_mv_magnitude for parallel encode frames
Initialized 'max_mv_magnitude' for frame parallel level 2 frames in
a parallel encode set. Also cleaned up the redundant max_mv_magnitude
copy in AV1_PRIMARY and associated code.
Change-Id: I43a43e3f1e84af285eb334adfeeb162ed68c0565
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 89194c3..b38bd3e 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1809,12 +1809,6 @@
cm->quant_params.using_qmatrix = oxcf->q_cfg.using_qm;
}
-#if CONFIG_FRAME_PARALLEL_ENCODE
- // Copy previous frame's largest MV component from ppi to cpi.
- if (!is_stat_generation_stage(cpi) && cpi->do_frame_data_update)
- cpi->mv_search_params.max_mv_magnitude = cpi->ppi->max_mv_magnitude;
-#endif // CONFIG_FRAME_PARALLEL_ENCODE
-
#if CONFIG_REALTIME_ONLY
if (av1_encode(cpi, dest, &frame_input, &frame_params, &frame_results) !=
AOM_CODEC_OK) {
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 13de6c5..2acd97a 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -884,7 +884,6 @@
ppi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
ppi->frames_left = oxcf->input_cfg.limit;
#if CONFIG_FRAME_PARALLEL_ENCODE
- ppi->max_mv_magnitude = 0;
ppi->num_fp_contexts = 1;
#endif
@@ -4086,10 +4085,6 @@
cpi->ppi->filter_level_u = lf->filter_level_u;
cpi->ppi->filter_level_v = lf->filter_level_v;
}
-
- // Store current frame max_mv_magnitude in ppi, if update flag is set.
- if (!is_stat_generation_stage(cpi))
- cpi->ppi->max_mv_magnitude = cpi->mv_search_params.max_mv_magnitude;
}
// Store frame level mv_stats from cpi to ppi.
@@ -4557,6 +4552,8 @@
cur_cpi->rc.frames_to_key = frames_to_key;
cur_cpi->rc.frames_to_fwd_kf = frames_to_fwd_kf;
cur_cpi->rc.active_worst_quality = first_cpi->rc.active_worst_quality;
+ cur_cpi->mv_search_params.max_mv_magnitude =
+ first_cpi->mv_search_params.max_mv_magnitude;
if (gf_group->update_type[cur_cpi->gf_frame_index] == INTNL_ARF_UPDATE) {
cur_cpi->common.lf.mode_ref_delta_enabled = 1;
}
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 7844764..81f2dc1 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -2321,12 +2321,6 @@
int filter_level_v;
/*!
- * Largest MV component used in previous encoded frame during
- * stats consumption stage.
- */
- int max_mv_magnitude;
-
- /*!
* Start time stamp of the last encoded show frame
*/
int64_t ts_start_last_show_frame;