summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encoder.c
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2016-04-21 14:00:26 -0700
committerMarco <marpan@google.com>2016-04-22 08:09:39 -0700
commitadf8533cee11093dfe200ba7e9b60b09237aa272 (patch)
tree9cba913a5e89b062ce72693f031cf3cfadd0b822 /vp9/encoder/vp9_encoder.c
parentd179b784f93e7a1a4f4e89248edaf0a6dee81952 (diff)
downloadlibvpx-adf8533cee11093dfe200ba7e9b60b09237aa272.tar
libvpx-adf8533cee11093dfe200ba7e9b60b09237aa272.tar.gz
libvpx-adf8533cee11093dfe200ba7e9b60b09237aa272.tar.bz2
libvpx-adf8533cee11093dfe200ba7e9b60b09237aa272.zip
vp9: Move consec_zero_mv from cyclic refresh to cpi struct.
So it can be used even with aq-mode=3 not enabled. Also cleans up some code in the places where its used. No change in behavior. Change-Id: Ib6b265308dbd483f691200da9a0be4da4b380dbc
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 &&