From 707e6c301ef9aab779ab685646d0514b6b148835 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Fri, 12 Oct 2012 11:38:10 -0700 Subject: [PATCH] removed the dependency cross key frame boundary This allowed decoding from any key frame after skipping the frames prior. Change-Id: I096fccad5346d75ae50a017c94eb8d772a7e8b00 --- vp8/common/alloccommon.c | 4 ++-- vp8/decoder/decodframe.c | 9 +++++++++ vp8/encoder/ratectrl.c | 11 +++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c index 2c5b64cee..4323fdf4c 100644 --- a/vp8/common/alloccommon.c +++ b/vp8/common/alloccommon.c @@ -21,7 +21,7 @@ extern void vp8_init_scan_order_mask(); -static void update_mode_info_border(VP8_COMMON *cpi, MODE_INFO *mi_base) { +void update_mode_info_border(VP8_COMMON *cpi, MODE_INFO *mi_base) { int stride = cpi->mode_info_stride; int i; @@ -33,7 +33,7 @@ static void update_mode_info_border(VP8_COMMON *cpi, MODE_INFO *mi_base) { vpx_memset(&mi_base[i * stride], 0, sizeof(MODE_INFO)); } } -static void update_mode_info_in_image(VP8_COMMON *cpi, MODE_INFO *mi) { +void update_mode_info_in_image(VP8_COMMON *cpi, MODE_INFO *mi) { int i, j; // For each in image mode_info element set the in image flag to 1 diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 3fa6660aa..c46957202 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -825,6 +825,7 @@ static void init_frame(VP8D_COMP *pbi) { vp8_init_mv_probs(pc); vp8_init_mbmode_probs(pc); + vp8_default_bmode_probs(pc->fc.bmode_prob); vp8_default_coef_probs(pc); vp8_kf_default_bmode_probs(pc->kf_bmode_prob); @@ -858,6 +859,14 @@ static void init_frame(VP8D_COMP *pbi) { vpx_memcpy(pbi->common.fc.vp8_mode_contexts, pbi->common.fc.mode_context, sizeof(pbi->common.fc.mode_context)); + vpx_memset(pc->prev_mip, 0, + (pc->mb_cols + 1) * (pc->mb_rows + 1)* sizeof(MODE_INFO)); + vpx_memset(pc->mip, 0, + (pc->mb_cols + 1) * (pc->mb_rows + 1)* sizeof(MODE_INFO)); + + update_mode_info_border(pc, pc->mip); + update_mode_info_in_image(pc, pc->mi); + } else { if (!pc->use_bilinear_mc_filter) diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 2864a6b15..2b5f699b6 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -267,10 +267,12 @@ void vp8_restore_coding_context(VP8_COMP *cpi) { void vp8_setup_key_frame(VP8_COMP *cpi) { + VP8_COMMON *cm = &cpi->common; // Setup for Key frame: vp8_default_coef_probs(& cpi->common); vp8_kf_default_bmode_probs(cpi->common.kf_bmode_prob); vp8_init_mbmode_probs(& cpi->common); + vp8_default_bmode_probs(cm->fc.bmode_prob); vp8_init_mv_probs(& cpi->common); #if CONFIG_NEWMVENTROPY == 0 @@ -297,6 +299,15 @@ void vp8_setup_key_frame(VP8_COMP *cpi) { vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc)); vpx_memcpy(&cpi->common.lfc_a, &cpi->common.fc, sizeof(cpi->common.fc)); + vpx_memset(cm->prev_mip, 0, + (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); + vpx_memset(cm->mip, 0, + (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); + + update_mode_info_border(cm, cm->mip); + update_mode_info_in_image(cm, cm->mi); + + } void vp8_setup_inter_frame(VP8_COMP *cpi) { -- 2.40.0