ref: 6ac8a0c9b01b9a4b65e5926814d399f13981902f
parent: 343c4dca644aaa78315866a8e166c27d9b2b85cb
author: angiebird <angiebird@google.com>
date: Mon Aug 10 15:53:10 EDT 2020
Avoid re-allocating fp_motion_vector_info Replace fp_motion_vector_info_init() by fp_motion_vector_info_reset() in first_pass_encode() Change-Id: Iadacb1ecc4f07435340399564fdd3bfd4ac702f4
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -1025,12 +1025,19 @@
VP9_COMMON *const cm = &cpi->common;
const int unit_width = get_num_unit_16x16(cpi->frame_info.frame_width);
const int unit_height = get_num_unit_16x16(cpi->frame_info.frame_height);
- int i;
CHECK_MEM_ERROR(cm, cpi->fp_motion_vector_info,
(MOTION_VECTOR_INFO *)vpx_calloc(unit_width * unit_height,
sizeof(MOTION_VECTOR_INFO)));
+}
+
+static INLINE void fp_motion_vector_info_reset(
+ int frame_width, int frame_height,
+ MOTION_VECTOR_INFO *fp_motion_vector_info) {
+ const int unit_width = get_num_unit_16x16(frame_width);
+ const int unit_height = get_num_unit_16x16(frame_height);
+ int i;
for (i = 0; i < unit_width * unit_height; ++i) {
- reset_mv_info(cpi->fp_motion_vector_info + i);
+ reset_mv_info(fp_motion_vector_info + i);
}
}
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1388,7 +1388,9 @@
vp9_tile_init(tile, cm, 0, 0);
#if CONFIG_RATE_CTRL
- fp_motion_vector_info_init(cpi);
+ fp_motion_vector_info_reset(cpi->frame_info.frame_width,
+ cpi->frame_info.frame_height,
+ cpi->fp_motion_vector_info);
#endif
for (mb_row = 0; mb_row < cm->mb_rows; ++mb_row) {