From: Scott LaVarnway Date: Mon, 6 Dec 2010 17:41:09 +0000 (-0800) Subject: Merge "Improve MV prediction accuracy to achieve performance gain" X-Git-Tag: v0.9.6~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d283d9bb307fe2e93107a4271bb984d8cd6c6736;p=libvpx Merge "Improve MV prediction accuracy to achieve performance gain" --- d283d9bb307fe2e93107a4271bb984d8cd6c6736 diff --cc vp8/encoder/onyx_if.c index 3c2200427,fd7b5668a..7e9a0f0d8 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@@ -4190,6 -4183,60 +4208,60 @@@ static void encode_frame_to_data_rat } #endif - - - ++ // Update the GF useage maps. ++ // This is done after completing the compression of a frame when all modes etc. are finalized but before loop filter ++ vp8_update_gf_useage_maps(cpi, cm, &cpi->mb); + //////////////////////////////// + //////////////////////////////// + // This frame's MVs are saved and will be used in next frame's MV prediction. + if(cm->show_frame) //do not save for altref frame + { + int mb_row; + int mb_col; + MODE_INFO *tmp = cm->mip; //point to beginning of allocated MODE_INFO arrays. + //static int last_video_frame = 0; + + /* + if (cm->current_video_frame == 0) //first frame: set to 0 + { + for (mb_row = 0; mb_row < cm->mb_rows+1; mb_row ++) + { + for (mb_col = 0; mb_col < cm->mb_cols+1; mb_col ++) + { + cpi->lfmv[mb_col + mb_row*(cm->mode_info_stride)].as_int = 0; + cpi->lf_ref_frame_sign_bias[mb_col + mb_row*(cm->mode_info_stride)] = 0; + cpi->lf_ref_frame[mb_col + mb_row*(cm->mode_info_stride)] = 0; + } + } + }else + */ + + if(cm->frame_type != KEY_FRAME) + { + for (mb_row = 0; mb_row < cm->mb_rows+1; mb_row ++) + { + for (mb_col = 0; mb_col < cm->mb_cols+1; mb_col ++) + { + if(tmp->mbmi.ref_frame != INTRA_FRAME) + cpi->lfmv[mb_col + mb_row*(cm->mode_info_stride)].as_int = tmp->mbmi.mv.as_int; + + cpi->lf_ref_frame_sign_bias[mb_col + mb_row*(cm->mode_info_stride)] = cm->ref_frame_sign_bias[tmp->mbmi.ref_frame]; + cpi->lf_ref_frame[mb_col + mb_row*(cm->mode_info_stride)] = tmp->mbmi.ref_frame; + //printf("[%d, %d] ", cpi->lfmv[mb_col + mb_row*(cm->mode_info_stride-1)].as_mv.row, cpi->lfmv[mb_col + mb_row*(cm->mode_info_stride-1)].as_mv.col); + tmp++; + } + } + + //last_video_frame = cm->current_video_frame; + } + } + + //printf("after: %d %d \n", cm->current_video_frame, cm->show_frame ); + + + + + // Update the GF useage maps. // This is done after completing the compression of a frame when all modes etc. are finalized but before loop filter vp8_update_gf_useage_maps(cpi, cm, &cpi->mb);