Merge "Optimize the code to set the refernce frame right after reading the header."

This commit is contained in:
hkuang 2014-10-10 10:40:21 -07:00 коммит произвёл Gerrit Code Review
Родитель 0d94f725e6 3304d4e6ca
Коммит ab4c6efa48
2 изменённых файлов: 8 добавлений и 19 удалений

Просмотреть файл

@ -384,18 +384,6 @@ static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
return &xd->mi[0].mbmi;
}
static void set_ref(VP9_COMMON *const cm, MACROBLOCKD *const xd,
int idx, int mi_row, int mi_col) {
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
RefBuffer *ref_buffer = &cm->frame_refs[mbmi->ref_frame[idx] - LAST_FRAME];
xd->block_refs[idx] = ref_buffer;
if (ref_buffer->buf->corrupted)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Block reference is corrupt");
vp9_setup_pre_planes(xd, idx, ref_buffer->buf, mi_row, mi_col,
&ref_buffer->sf);
}
static void decode_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile,
int mi_row, int mi_col,
@ -420,11 +408,6 @@ static void decode_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
vp9_foreach_transformed_block(xd, bsize,
predict_and_reconstruct_intra_block, &arg);
} else {
// Setup
set_ref(cm, xd, 0, mi_row, mi_col);
if (has_second_ref(mbmi))
set_ref(cm, xd, 1, mi_row, mi_col);
// Prediction
vp9_dec_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);

Просмотреть файл

@ -435,10 +435,16 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
for (ref = 0; ref < 1 + is_compound; ++ref) {
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
const int ref_idx = frame - LAST_FRAME;
if ((!vp9_is_valid_scale(&cm->frame_refs[ref_idx].sf)))
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf;
if ((!vp9_is_valid_scale(&ref_buf->sf)))
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Reference frame has invalid dimensions");
if (ref_buf->buf->corrupted)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Block reference is corrupt");
vp9_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col,
&ref_buf->sf);
vp9_find_mv_refs(cm, xd, tile, mi, frame, mbmi->ref_mvs[frame],
mi_row, mi_col);
}