Adding vp9_swap_mi_and_prev_mi() function.

Change-Id: I18b3939f0b51085cdd25c9182c3a9c7536ca7e3e
This commit is contained in:
Dmitry Kovalev 2014-03-13 13:55:33 -07:00
parent 069e2458a6
commit e65c564c78
4 changed files with 21 additions and 32 deletions

View File

@ -224,3 +224,19 @@ void vp9_update_frame_size(VP9_COMMON *cm) {
if (cm->last_frame_seg_map)
vpx_memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols);
}
void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm) {
// Current mip will be the prev_mip for the next frame.
MODE_INFO *temp = cm->prev_mip;
MODE_INFO **temp2 = cm->prev_mi_grid_base;
cm->prev_mip = cm->mip;
cm->mip = temp;
cm->prev_mi_grid_base = cm->mi_grid_base;
cm->mi_grid_base = temp2;
// Update the upper left visible macroblock ptrs.
cm->mi = cm->mip + cm->mode_info_stride + 1;
cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
cm->mi_grid_visible = cm->mi_grid_base + cm->mode_info_stride + 1;
cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mode_info_stride + 1;
}

View File

@ -31,6 +31,8 @@ void vp9_free_frame_buffers(VP9_COMMON *cm);
void vp9_update_frame_size(VP9_COMMON *cm);
void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -423,25 +423,9 @@ int vp9_receive_compressed_data(VP9D_COMP *pbi,
if (!cm->show_existing_frame)
cm->last_show_frame = cm->show_frame;
if (cm->show_frame) {
if (!cm->show_existing_frame) {
// current mip will be the prev_mip for the next frame
MODE_INFO *temp = cm->prev_mip;
MODE_INFO **temp2 = cm->prev_mi_grid_base;
cm->prev_mip = cm->mip;
cm->mip = temp;
cm->prev_mi_grid_base = cm->mi_grid_base;
cm->mi_grid_base = temp2;
if (!cm->show_existing_frame)
vp9_swap_mi_and_prev_mi(cm);
// update the upper left visible macroblock ptrs
cm->mi = cm->mip + cm->mode_info_stride + 1;
cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
cm->mi_grid_visible = cm->mi_grid_base + cm->mode_info_stride + 1;
cm->prev_mi_grid_visible = cm->prev_mi_grid_base +
cm->mode_info_stride + 1;
pbi->mb.mi_8x8 = cm->mi_grid_visible;
pbi->mb.mi_8x8[0] = cm->mi;
}
cm->current_video_frame++;
}

View File

@ -3366,20 +3366,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cm->last_show_frame = cm->show_frame;
if (cm->show_frame) {
// current mip will be the prev_mip for the next frame
MODE_INFO *temp = cm->prev_mip;
MODE_INFO **temp2 = cm->prev_mi_grid_base;
cm->prev_mip = cm->mip;
cm->mip = temp;
cm->prev_mi_grid_base = cm->mi_grid_base;
cm->mi_grid_base = temp2;
// update the upper left visible macroblock ptrs
cm->mi = cm->mip + cm->mode_info_stride + 1;
cm->mi_grid_visible = cm->mi_grid_base + cm->mode_info_stride + 1;
cpi->mb.e_mbd.mi_8x8 = cm->mi_grid_visible;
cpi->mb.e_mbd.mi_8x8[0] = cm->mi;
vp9_swap_mi_and_prev_mi(cm);
// Don't increment frame counters if this was an altref buffer
// update not a real frame