summaryrefslogtreecommitdiff
path: root/vp8/decoder/decodframe.c
diff options
context:
space:
mode:
authorJim Bankoski <jimbankoski@google.com>2012-09-07 16:38:15 -0700
committerJim Bankoski <jimbankoski@google.com>2012-09-07 16:38:15 -0700
commit2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e (patch)
tree67f1d17b043e89b4a57d68a0c4ac495e2f4a071a /vp8/decoder/decodframe.c
parent488ba1ab9ca875e48e6ea8f0f30a6bca6b730664 (diff)
downloadlibvpx-2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e.tar
libvpx-2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e.tar.gz
libvpx-2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e.tar.bz2
libvpx-2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e.zip
valgrind caught uninitialized cond
If the decoder crashes and returned an error before it set up block offsets but after it set up frame buffers. We had a problem decoding the next keyframe because the block offsets were never set. Change-Id: Ied2866e9770d80fc66241d5e0d978d4f5f9cdd89
Diffstat (limited to 'vp8/decoder/decodframe.c')
-rw-r--r--vp8/decoder/decodframe.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 750dae674..1a462a2cc 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -1001,8 +1001,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
int corrupt_tokens = 0;
int prev_independent_partitions = pbi->independent_partitions;
- int frame_size_change = 0;
-
/* start with no corruption of current frame */
xd->corrupted = 0;
pc->yv12_fb[pc->new_fb_idx].corrupted = 0;
@@ -1040,6 +1038,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
vp8_setup_version(pc);
+
if (pc->frame_type == KEY_FRAME)
{
const int Width = pc->Width;
@@ -1091,6 +1090,18 @@ int vp8_decode_frame(VP8D_COMP *pbi)
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffers");
+ vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+ vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+
+#if CONFIG_MULTITHREAD
+ for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
+ {
+ pbi->mb_row_di[i].mbd.dst = pc->yv12_fb[pc->new_fb_idx];
+ vp8_build_block_doffsets(&pbi->mb_row_di[i].mbd);
+ }
+#endif
+ vp8_build_block_doffsets(&pbi->mb);
+
/* allocate memory for last frame MODE_INFO array */
#if CONFIG_ERROR_CONCEALMENT
@@ -1126,11 +1137,14 @@ int vp8_decode_frame(VP8D_COMP *pbi)
#else
(void)prev_mb_rows;
#endif
- frame_size_change = 1;
}
}
+ else
+ {
+ vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+ vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+ }
}
-
if ((!pbi->decoded_key_frame && pc->frame_type != KEY_FRAME) ||
pc->Width == 0 || pc->Height == 0)
{
@@ -1381,8 +1395,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
}
}
- vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
- vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
/* set up frame new frame for intra coded blocks */
#if CONFIG_MULTITHREAD
@@ -1390,17 +1402,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
#endif
vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]);
- if(frame_size_change)
- {
-#if CONFIG_MULTITHREAD
- for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
- {
- pbi->mb_row_di[i].mbd.dst = pc->yv12_fb[pc->new_fb_idx];
- vp8_build_block_doffsets(&pbi->mb_row_di[i].mbd);
- }
-#endif
- vp8_build_block_doffsets(&pbi->mb);
- }
/* clear out the coeff buffer */
vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));