Commit e65c564c authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Adding vp9_swap_mi_and_prev_mi() function.

Change-Id: I18b3939f0b51085cdd25c9182c3a9c7536ca7e3e
parent 069e2458
......@@ -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;
}
......@@ -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
......
......@@ -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;
// 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;
}
if (!cm->show_existing_frame)
vp9_swap_mi_and_prev_mi(cm);
cm->current_video_frame++;
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment