diff options
Diffstat (limited to 'vp9/decoder')
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 38 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodemv.c | 51 |
2 files changed, 45 insertions, 44 deletions
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 57b29ce72..c1670041e 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -266,7 +266,7 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block, vp9_idct32x32_add(dqcoeff, dst, stride, eob); break; default: - assert(!"Invalid transform size"); + assert(0 && "Invalid transform size"); } if (eob == 1) { @@ -346,23 +346,27 @@ static void reconstruct_inter_block(int plane, int block, static void set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd, const TileInfo *const tile, BLOCK_SIZE bsize, int mi_row, int mi_col) { - const int bh = num_8x8_blocks_high_lookup[bsize]; const int bw = num_8x8_blocks_wide_lookup[bsize]; + const int bh = num_8x8_blocks_high_lookup[bsize]; + const int x_mis = MIN(bw, cm->mi_cols - mi_col); + const int y_mis = MIN(bh, cm->mi_rows - mi_row); const int offset = mi_row * cm->mode_info_stride + mi_col; const int tile_offset = tile->mi_row_start * cm->mode_info_stride + tile->mi_col_start; + int x, y; xd->mi_8x8 = cm->mi_grid_visible + offset; xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset; - - // we are using the mode info context stream here - xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset; - xd->mi_8x8[0]->mbmi.sb_type = bsize; - // Special case: if prev_mi is NULL, the previous mode info context // cannot be used. xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL; + xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset; + xd->mi_8x8[0]->mbmi.sb_type = bsize; + for (y = 0; y < y_mis; ++y) + for (x = !y; x < x_mis; ++x) + xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0]; + set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col); // Distance of Mb to the various image edges. These are specified to 8th pel @@ -505,7 +509,7 @@ static void decode_modes_sb(VP9_COMMON *const cm, MACROBLOCKD *const xd, decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize); break; default: - assert(!"Invalid partition type"); + assert(0 && "Invalid partition type"); } } @@ -701,9 +705,21 @@ static void apply_frame_size(VP9D_COMP *pbi, int width, int height) { vp9_update_frame_size(cm); } - vp9_realloc_frame_buffer(get_frame_new_buffer(cm), cm->width, cm->height, - cm->subsampling_x, cm->subsampling_y, - VP9BORDERINPIXELS); + if (cm->fb_list != NULL) { + vpx_codec_frame_buffer_t *const ext_fb = &cm->fb_list[cm->new_fb_idx]; + if (vp9_realloc_frame_buffer(get_frame_new_buffer(cm), + cm->width, cm->height, + cm->subsampling_x, cm->subsampling_y, + VP9BORDERINPIXELS, ext_fb, + cm->realloc_fb_cb, cm->user_priv)) { + vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, + "Failed to allocate external frame buffer"); + } + } else { + vp9_realloc_frame_buffer(get_frame_new_buffer(cm), cm->width, cm->height, + cm->subsampling_x, cm->subsampling_y, + VP9BORDERINPIXELS, NULL, NULL, NULL); + } } static void setup_frame_size(VP9D_COMP *pbi, diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 164576d0c..4e2bc3560 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -162,12 +162,12 @@ static int read_skip_coeff(VP9_COMMON *cm, const MACROBLOCKD *xd, static void read_intra_frame_mode_info(VP9_COMMON *const cm, MACROBLOCKD *const xd, - MODE_INFO *const m, int mi_row, int mi_col, vp9_reader *r) { - MB_MODE_INFO *const mbmi = &m->mbmi; - const BLOCK_SIZE bsize = mbmi->sb_type; + MODE_INFO *const mi = xd->mi_8x8[0]; + MB_MODE_INFO *const mbmi = &mi->mbmi; const MODE_INFO *above_mi = xd->mi_8x8[-cm->mode_info_stride]; const MODE_INFO *left_mi = xd->left_available ? xd->mi_8x8[-1] : NULL; + const BLOCK_SIZE bsize = mbmi->sb_type; mbmi->segment_id = read_intra_segment_id(cm, xd, mi_row, mi_col, r); mbmi->skip_coeff = read_skip_coeff(cm, xd, mbmi->segment_id, r); @@ -176,8 +176,8 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm, mbmi->ref_frame[1] = NONE; if (bsize >= BLOCK_8X8) { - const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0); - const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, 0); + const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, 0); + const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, 0); mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]); } else { // Only 4x4, 4x8, 8x4 blocks @@ -188,19 +188,19 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm, for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { const int ib = idy * 2 + idx; - const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, ib); - const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, ib); + const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, ib); + const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, ib); const MB_PREDICTION_MODE b_mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]); - m->bmi[ib].as_mode = b_mode; + mi->bmi[ib].as_mode = b_mode; if (num_4x4_h == 2) - m->bmi[ib + 2].as_mode = b_mode; + mi->bmi[ib + 2].as_mode = b_mode; if (num_4x4_w == 2) - m->bmi[ib + 1].as_mode = b_mode; + mi->bmi[ib + 1].as_mode = b_mode; } } - mbmi->mode = m->bmi[3].as_mode; + mbmi->mode = mi->bmi[3].as_mode; } mbmi->uv_mode = read_intra_mode(r, vp9_kf_uv_mode_prob[mbmi->mode]); @@ -308,7 +308,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd, ref_frame[1] = NONE; } else { - assert(!"Invalid prediction mode."); + assert(0 && "Invalid prediction mode."); } } } @@ -475,8 +475,8 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm, if (b_mode == NEARESTMV || b_mode == NEARMV) for (ref = 0; ref < 1 + is_compound; ++ref) - vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, &nearest[ref], - &nearmv[ref], j, ref, mi_row, mi_col); + vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, j, ref, mi_row, mi_col, + &nearest[ref], &nearmv[ref]); if (!assign_mv(cm, b_mode, block, best, nearest, nearmv, is_compound, allow_hp, r)) { @@ -509,8 +509,8 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm, static void read_inter_frame_mode_info(VP9_COMMON *const cm, MACROBLOCKD *const xd, const TileInfo *const tile, - MODE_INFO *const mi, int mi_row, int mi_col, vp9_reader *r) { + MODE_INFO *const mi = xd->mi_8x8[0]; MB_MODE_INFO *const mbmi = &mi->mbmi; int inter_block; @@ -528,25 +528,10 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm, read_intra_block_mode_info(cm, mi, r); } -void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd, - const TileInfo *const tile, +void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd, const TileInfo *tile, int mi_row, int mi_col, vp9_reader *r) { - MODE_INFO *const mi = xd->mi_8x8[0]; - const BLOCK_SIZE bsize = mi->mbmi.sb_type; - const int bw = num_8x8_blocks_wide_lookup[bsize]; - const int bh = num_8x8_blocks_high_lookup[bsize]; - const int y_mis = MIN(bh, cm->mi_rows - mi_row); - const int x_mis = MIN(bw, cm->mi_cols - mi_col); - int x, y, z; - if (frame_is_intra_only(cm)) - read_intra_frame_mode_info(cm, xd, mi, mi_row, mi_col, r); + read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r); else - read_inter_frame_mode_info(cm, xd, tile, mi, mi_row, mi_col, r); - - for (y = 0, z = 0; y < y_mis; y++, z += cm->mode_info_stride) { - for (x = !y; x < x_mis; x++) { - xd->mi_8x8[z + x] = mi; - } - } + read_inter_frame_mode_info(cm, xd, tile, mi_row, mi_col, r); } |