summaryrefslogtreecommitdiff
path: root/vp8/decoder/decodframe.c
diff options
context:
space:
mode:
authorAttila Nagy <attilanagy@google.com>2012-04-24 15:33:44 +0300
committerAttila Nagy <attilanagy@google.com>2012-04-26 11:49:15 +0300
commit24e7b1b90d802dacea4daeeb03984184c7b74d2a (patch)
treeebda17a7b045a4f2b0781af3bf459216dff80f23 /vp8/decoder/decodframe.c
parent0c483d6b683fa4313cf7dadf448a707fe32714a4 (diff)
downloadlibvpx-24e7b1b90d802dacea4daeeb03984184c7b74d2a.tar
libvpx-24e7b1b90d802dacea4daeeb03984184c7b74d2a.tar.gz
libvpx-24e7b1b90d802dacea4daeeb03984184c7b74d2a.tar.bz2
libvpx-24e7b1b90d802dacea4daeeb03984184c7b74d2a.zip
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
Diffstat (limited to 'vp8/decoder/decodframe.c')
-rw-r--r--vp8/decoder/decodframe.c22
1 files changed, 21 insertions, 1 deletions
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;
}