|
@@ -1915,6 +1915,17 @@ static void alloc_copy_partition_data(VP9_COMP *cpi) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void free_copy_partition_data(VP9_COMP *cpi) {
|
|
|
+ vpx_free(cpi->prev_partition);
|
|
|
+ cpi->prev_partition = NULL;
|
|
|
+ vpx_free(cpi->prev_segment_id);
|
|
|
+ cpi->prev_segment_id = NULL;
|
|
|
+ vpx_free(cpi->prev_variance_low);
|
|
|
+ cpi->prev_variance_low = NULL;
|
|
|
+ vpx_free(cpi->copied_frame_cnt);
|
|
|
+ cpi->copied_frame_cnt = NULL;
|
|
|
+}
|
|
|
+
|
|
|
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|
|
VP9_COMMON *const cm = &cpi->common;
|
|
|
RATE_CONTROL *const rc = &cpi->rc;
|
|
@@ -1999,6 +2010,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|
|
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
|
|
|
if (cm->mi_alloc_size < new_mi_size) {
|
|
|
vp9_free_context_buffers(cm);
|
|
|
+ vp9_free_pc_tree(&cpi->td);
|
|
|
+ vpx_free(cpi->mbmi_ext_base);
|
|
|
alloc_compressor_data(cpi);
|
|
|
realloc_segmentation_maps(cpi);
|
|
|
cpi->initial_width = cpi->initial_height = 0;
|
|
@@ -2014,8 +2027,18 @@ 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) {
|
|
|
- memset(cpi->consec_zero_mv, 0,
|
|
|
- cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv));
|
|
|
+ vpx_free(cpi->consec_zero_mv);
|
|
|
+ CHECK_MEM_ERROR(
|
|
|
+ cm, cpi->consec_zero_mv,
|
|
|
+ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(*cpi->consec_zero_mv)));
|
|
|
+
|
|
|
+ vpx_free(cpi->skin_map);
|
|
|
+ CHECK_MEM_ERROR(
|
|
|
+ cm, cpi->skin_map,
|
|
|
+ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(cpi->skin_map[0])));
|
|
|
+
|
|
|
+ free_copy_partition_data(cpi);
|
|
|
+ alloc_copy_partition_data(cpi);
|
|
|
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
|
|
|
vp9_cyclic_refresh_reset_resize(cpi);
|
|
|
rc->rc_1_frame = 0;
|