From 24e7b1b90d802dacea4daeeb03984184c7b74d2a Mon Sep 17 00:00:00 2001 From: Attila Nagy Date: Tue, 24 Apr 2012 15:33:44 +0300 Subject: Moves error concealment allocations from common parts to decoder The backup MODE_INFO buffer used in the error concealment was allocated in the codec common parts allocation even though this is a decoder only resource. Moved the allocation to the decoder side. No need to update_mode_info_border as mode_info buffers are zero allocated. This fixes also a potential memory leak as the EC overlaps buffer was not properly released before reallocation after a frame size change. Change-Id: I12803d3e012308d95669069980b1c95973fb775f --- vp8/decoder/decodframe.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'vp8/decoder/decodframe.c') diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 3332f6702..d11933e24 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -821,20 +821,40 @@ int vp8_decode_frame(VP8D_COMP *pbi) vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR, "Failed to allocate frame buffers"); + /* allocate memory for last frame MODE_INFO array */ #if CONFIG_ERROR_CONCEALMENT - pbi->overlaps = NULL; + if (pbi->ec_enabled) { + /* old prev_mip was released by vp8_de_alloc_frame_buffers() + * called in vp8_alloc_frame_buffers() */ + pc->prev_mip = vpx_calloc( + (pc->mb_cols + 1) * (pc->mb_rows + 1), + sizeof(MODE_INFO)); + + if (!pc->prev_mip) + { + vp8_de_alloc_frame_buffers(pc); + vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR, + "Failed to allocate" + "last frame MODE_INFO array"); + } + + pc->prev_mi = pc->prev_mip + pc->mode_info_stride + 1; + if (vp8_alloc_overlap_lists(pbi)) vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR, "Failed to allocate overlap lists " "for error concealment"); } + #endif #if CONFIG_MULTITHREAD + if (pbi->b_multithreaded_rd) vp8mt_alloc_temp_buffers(pbi, pc->Width, prev_mb_rows); + #endif frame_size_change = 1; } -- cgit v1.2.3