Commit 69babd39 authored by Attila Nagy's avatar Attila Nagy Committed by Gerrit Code Review
Browse files

Merge "Fix encoder mem allocation when picture size is changed"

parents b78d9070 cbc249ba
......@@ -1103,22 +1103,47 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
cpi->gf_update_recommended = 0;
/* Structures used to minitor GF usage */
/* Structures used to monitor GF usage */
vpx_free(cpi->gf_active_flags);
CHECK_MEM_ERROR(cpi->gf_active_flags,
vpx_calloc(1, cm->mb_rows * cm->mb_cols));
vpx_calloc(sizeof(*cpi->gf_active_flags),
cm->mb_rows * cm->mb_cols));
cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
vpx_free(cpi->mb_activity_map);
CHECK_MEM_ERROR(cpi->mb_activity_map,
vpx_calloc(sizeof(unsigned int),
vpx_calloc(sizeof(*cpi->mb_activity_map),
cm->mb_rows * cm->mb_cols));
vpx_free(cpi->mb_norm_activity_map);
CHECK_MEM_ERROR(cpi->mb_norm_activity_map,
vpx_calloc(sizeof(unsigned int),
vpx_calloc(sizeof(*cpi->mb_norm_activity_map),
cm->mb_rows * cm->mb_cols));
/* allocate memory for storing last frame's MVs for MV prediction. */
vpx_free(cpi->lfmv);
CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
sizeof(*cpi->lfmv)));
vpx_free(cpi->lf_ref_frame_sign_bias);
CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias,
vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
sizeof(*cpi->lf_ref_frame_sign_bias)));
vpx_free(cpi->lf_ref_frame);
CHECK_MEM_ERROR(cpi->lf_ref_frame,
vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
sizeof(*cpi->lf_ref_frame)));
/* Create the encoder segmentation map and set all entries to 0 */
vpx_free(cpi->segmentation_map);
CHECK_MEM_ERROR(cpi->segmentation_map,
vpx_calloc(cm->mb_rows * cm->mb_cols,
sizeof(*cpi->segmentation_map)));
vpx_free(cpi->active_map);
CHECK_MEM_ERROR(cpi->active_map,
vpx_calloc(cm->mb_rows * cm->mb_cols,
sizeof(*cpi->active_map)));
vpx_memset(cpi->active_map , 1, (cm->mb_rows * cm->mb_cols));
#if CONFIG_MULTITHREAD
if (width < 640)
cpi->mt_sync_range = 1;
......@@ -1133,14 +1158,13 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
{
vpx_free(cpi->mt_current_mb_col);
CHECK_MEM_ERROR(cpi->mt_current_mb_col,
vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
}
#endif
vpx_free(cpi->tplist);
CHECK_MEM_ERROR(cpi->tplist,
vpx_malloc(sizeof(TOKENLIST) * cpi->common.mb_rows));
CHECK_MEM_ERROR(cpi->tplist, vpx_malloc(sizeof(TOKENLIST) * cm->mb_rows));
}
......@@ -1767,16 +1791,6 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->alt_is_last = 0 ;
cpi->gold_is_alt = 0 ;
/* allocate memory for storing last frame's MVs for MV prediction. */
CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int_mv)));
CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int)));
CHECK_MEM_ERROR(cpi->lf_ref_frame, vpx_calloc((cpi->common.mb_rows+2) * (cpi->common.mb_cols+2), sizeof(int)));
/* Create the encoder segmentation map and set all entries to 0 */
CHECK_MEM_ERROR(cpi->segmentation_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
CHECK_MEM_ERROR(cpi->active_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
vpx_memset(cpi->active_map , 1, (cpi->common.mb_rows * cpi->common.mb_cols));
cpi->active_map_enabled = 0;
#if 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment