Remove implicit assumption that mode_info_stride == mb_cols + 1.

Change-Id: I3030d7adac73109aeaa1ecc0f78ac968c092d9aa
This commit is contained in:
Ronald S. Bultje 2013-04-24 12:28:27 -07:00
parent 811f80ca25
commit 8d028402d7
4 changed files with 13 additions and 10 deletions

View File

@ -33,15 +33,18 @@ void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi) {
void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi) {
int i, j;
MODE_INFO *ptr;
// For each in image mode_info element set the in image flag to 1
for (i = 0; i < cpi->mb_rows; i++) {
ptr = mi;
for (j = 0; j < cpi->mb_cols; j++) {
mi->mbmi.mb_in_image = 1;
mi++; // Next element in the row
ptr->mbmi.mb_in_image = 1;
ptr++; // Next element in the row
}
mi++; // Step over border element at start of next row
// Step over border element at start of next row
mi += cpi->mode_info_stride;
}
}

View File

@ -705,9 +705,9 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc));
vpx_memset(cm->prev_mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1)* sizeof(MODE_INFO));
vpx_memset(cm->mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1)* sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi);

View File

@ -1051,7 +1051,7 @@ static void update_frame_size(VP9D_COMP *pbi) {
cm->MBs = cm->mb_rows * cm->mb_cols;
cm->mode_info_stride = cm->mb_cols + 1;
memset(cm->mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1) * sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_border(cm, cm->prev_mip);

View File

@ -906,7 +906,7 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
static int alloc_partition_data(VP9_COMP *cpi) {
vpx_free(cpi->mb.pip);
cpi->mb.pip = vpx_calloc((cpi->common.mb_cols + 1) *
cpi->mb.pip = vpx_calloc((cpi->common.mode_info_stride) *
(cpi->common.mb_rows + 1),
sizeof(PARTITION_INFO));
if (!cpi->mb.pip)
@ -991,7 +991,7 @@ static void update_frame_size(VP9_COMP *cpi) {
cm->MBs = cm->mb_rows * cm->mb_cols;
cm->mode_info_stride = cm->mb_cols + 1;
memset(cm->mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1) * sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
cm->mi = cm->mip + cm->mode_info_stride + 1;
@ -3668,10 +3668,10 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
if (cm->show_frame) {
vpx_memcpy(cm->prev_mip, cm->mip,
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1) * sizeof(MODE_INFO));
} else {
vpx_memset(cm->prev_mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
cm->mode_info_stride * (cm->mb_rows + 1) * sizeof(MODE_INFO));
}
}