diff options
author | Yaowu Xu <yaowu@google.com> | 2012-12-13 23:53:11 -0800 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2013-01-08 08:54:45 -0800 |
commit | c14439c3d3db8dfa44a30c4edc50f56250ce4cd3 (patch) | |
tree | bce53b055d8a02eb8520e52f4b5553252a29dc17 | |
parent | 08e207ad04f4c12b6ce874a8119b97b771493ba4 (diff) | |
download | libvpx-c14439c3d3db8dfa44a30c4edc50f56250ce4cd3.tar libvpx-c14439c3d3db8dfa44a30c4edc50f56250ce4cd3.tar.gz libvpx-c14439c3d3db8dfa44a30c4edc50f56250ce4cd3.tar.bz2 libvpx-c14439c3d3db8dfa44a30c4edc50f56250ce4cd3.zip |
reset segement map on key frame
This is to fix a decoder crash when decoder skips a number of frame to
continue decoding from a later key frame.
Change-Id: I3ba116eba6c3440e0528a21f53745f694302e4ad
-rw-r--r-- | vp9/decoder/vp9_decodframe.c | 9 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index d524ade66..36eadc482 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -40,7 +40,7 @@ #define COEFCOUNT_TESTING -// #define DEC_DEBUG +//#define DEC_DEBUG #ifdef DEC_DEBUG int dec_debug = 0; #endif @@ -1311,7 +1311,10 @@ static void init_frame(VP9D_COMP *pbi) { MACROBLOCKD *const xd = &pbi->mb; if (pc->frame_type == KEY_FRAME) { - /* Various keyframe initializations */ + + if (pc->last_frame_seg_map) + vpx_memset(pc->last_frame_seg_map, 0, (pc->mb_rows * pc->mb_cols)); + vp9_init_mv_probs(pc); vp9_init_mbmode_probs(pc); @@ -1354,6 +1357,7 @@ static void init_frame(VP9D_COMP *pbi) { vp9_update_mode_info_border(pc, pc->mip); vp9_update_mode_info_in_image(pc, pc->mi); + } else { if (!pc->use_bilinear_mc_filter) @@ -1600,6 +1604,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { pc->ref_pred_probs[0] = 120; pc->ref_pred_probs[1] = 80; pc->ref_pred_probs[2] = 40; + } else { for (i = 0; i < PREDICTION_PROBS; i++) { if (vp9_read_bit(&header_bc)) diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 08ad54b51..ee87fba03 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -255,6 +255,9 @@ void vp9_setup_key_frame(VP9_COMP *cpi) { vp9_init_mbmode_probs(& cpi->common); vp9_default_bmode_probs(cm->fc.bmode_prob); + if(cm->last_frame_seg_map) + vpx_memset(cm->last_frame_seg_map, 0, (cm->mb_rows * cm->mb_cols)); + vp9_init_mv_probs(& cpi->common); // cpi->common.filter_level = 0; // Reset every key frame. |