summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r--vp9/encoder/vp9_encoder.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 4e5377889..9ed70b628 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -375,6 +375,9 @@ static void dealloc_compressor_data(VP9_COMP *cpi) {
vpx_free(cpi->active_map.map);
cpi->active_map.map = NULL;
+ vpx_free(cpi->consec_zero_mv);
+ cpi->consec_zero_mv = NULL;
+
vp9_free_ref_frame_buffers(cm->buffer_pool);
#if CONFIG_VP9_POSTPROC
vp9_free_postproc_buffers(cm);
@@ -1549,9 +1552,12 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
update_frame_size(cpi);
- if ((last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) &&
- cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
- vp9_cyclic_refresh_reset_resize(cpi);
+ if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
+ memset(cpi->consec_zero_mv, 0,
+ cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv));
+ if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
+ vp9_cyclic_refresh_reset_resize(cpi);
+ }
if ((cpi->svc.number_temporal_layers > 1 &&
cpi->oxcf.rc_mode == VPX_CBR) ||
@@ -1698,6 +1704,10 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf,
realloc_segmentation_maps(cpi);
+ CHECK_MEM_ERROR(cm, cpi->consec_zero_mv,
+ vpx_calloc(cm->mi_rows * cm->mi_cols,
+ sizeof(*cpi->consec_zero_mv)));
+
CHECK_MEM_ERROR(cm, cpi->nmvcosts[0],
vpx_calloc(MV_VALS, sizeof(*cpi->nmvcosts[0])));
CHECK_MEM_ERROR(cm, cpi->nmvcosts[1],
@@ -3430,6 +3440,12 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
cpi->unscaled_last_source,
&cpi->scaled_last_source,
(cpi->oxcf.pass == 0));
+
+ if (cm->frame_type == KEY_FRAME || cpi->resize_pending != 0) {
+ memset(cpi->consec_zero_mv, 0,
+ cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv));
+ }
+
vp9_update_noise_estimate(cpi);
if (cpi->oxcf.pass == 0 &&