diff options
Diffstat (limited to 'vp9/decoder/vp9_decodframe.c')
-rw-r--r-- | vp9/decoder/vp9_decodframe.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 935a3d28d..1be38095f 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -202,11 +202,15 @@ static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) { VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi; - const int ref = mbmi->ref_frame[i] - 1; - + const int ref = mbmi->ref_frame[i] - LAST_FRAME; const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]]; - xd->scale_factor[i] = cm->active_ref_scale[ref]; - setup_pre_planes(xd, i, cfg, mi_row, mi_col, &xd->scale_factor[i]); + const struct scale_factors *sf = &cm->active_ref_scale[ref]; + if (!vp9_is_valid_scale(sf)) + vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, + "Invalid scale factors"); + + xd->scale_factor[i] = *sf; + setup_pre_planes(xd, i, cfg, mi_row, mi_col, sf); xd->corrupted |= cfg->corrupted; } @@ -264,7 +268,7 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col, vp9_reader* r, BLOCK_SIZE_TYPE bsize) { VP9_COMMON *const pc = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; - int bs = (1 << mi_width_log2(bsize)) / 2, n; + const int bs = (1 << mi_width_log2(bsize)) / 2; PARTITION_TYPE partition = PARTITION_NONE; BLOCK_SIZE_TYPE subsize; @@ -276,7 +280,8 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col, return; } else { int pl; - const int idx = check_bsize_coverage(pc, mi_row, mi_col, bsize); + const int idx = check_bsize_coverage(bs, pc->mi_rows, pc->mi_cols, + mi_row, mi_col); set_partition_seg_context(pc, xd, mi_row, mi_col); pl = partition_plane_context(xd, bsize); @@ -311,13 +316,14 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col, if (mi_col + bs < pc->mi_cols) decode_modes_b(pbi, mi_row, mi_col + bs, r, subsize); break; - case PARTITION_SPLIT: + case PARTITION_SPLIT: { + int n; for (n = 0; n < 4; n++) { - int j = n >> 1, i = n & 0x01; + const int j = n >> 1, i = n & 1; *(get_sb_index(xd, subsize)) = n; decode_modes_sb(pbi, mi_row + j * bs, mi_col + i * bs, r, subsize); } - break; + } break; default: assert(!"Invalid partition type"); } @@ -543,8 +549,8 @@ static void setup_frame_size(VP9D_COMP *pbi, struct vp9_read_bit_buffer *rb) { int width, height; read_frame_size(rb, &width, &height); - setup_display_size(&pbi->common, rb); apply_frame_size(pbi, width, height); + setup_display_size(&pbi->common, rb); } static void setup_frame_size_with_refs(VP9D_COMP *pbi, @@ -570,8 +576,8 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi, vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Referenced frame with invalid size"); - setup_display_size(cm, rb); apply_frame_size(pbi, width, height); + setup_display_size(cm, rb); } static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) { @@ -977,10 +983,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { vp9_zero(pc->counts); - // Initialize xd pointers. Any reference should do for xd->pre, so use 0. - setup_pre_planes(xd, 0, &pc->yv12_fb[pc->active_ref_idx[0]], 0, 0, NULL); - setup_dst_planes(xd, new_fb, 0, 0); - new_fb->corrupted |= read_compressed_header(pbi, data, first_partition_size); setup_block_dptrs(xd, pc->subsampling_x, pc->subsampling_y); |