| Index: source/libvpx/vp9/decoder/vp9_decodemv.c
|
| diff --git a/source/libvpx/vp9/decoder/vp9_decodemv.c b/source/libvpx/vp9/decoder/vp9_decodemv.c
|
| index 7ce3389e88cb0d91819eeff40f7d769e1f4e2539..8a8d8ddd8e6b2d746c83233ea8ec44357fbbca2f 100644
|
| --- a/source/libvpx/vp9/decoder/vp9_decodemv.c
|
| +++ b/source/libvpx/vp9/decoder/vp9_decodemv.c
|
| @@ -177,7 +177,7 @@ static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
|
|
| static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
| int segment_id, vp9_reader *r) {
|
| - if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
|
| + if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
|
| return 1;
|
| } else {
|
| const int ctx = vp9_get_skip_context(xd);
|
| @@ -307,9 +307,9 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
| FRAME_CONTEXT *const fc = cm->fc;
|
| FRAME_COUNTS *counts = xd->counts;
|
|
|
| - if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
| - ref_frame[0] = (MV_REFERENCE_FRAME)vp9_get_segdata(&cm->seg, segment_id,
|
| - SEG_LVL_REF_FRAME);
|
| + if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
| + ref_frame[0] = (MV_REFERENCE_FRAME)get_segdata(&cm->seg, segment_id,
|
| + SEG_LVL_REF_FRAME);
|
| ref_frame[1] = NONE;
|
| } else {
|
| const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r);
|
| @@ -444,9 +444,8 @@ static INLINE int assign_mv(VP9_COMMON *cm, MACROBLOCKD *xd,
|
|
|
| static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
| int segment_id, vp9_reader *r) {
|
| - if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
| - return vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) !=
|
| - INTRA_FRAME;
|
| + if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
| + return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
|
| } else {
|
| const int ctx = vp9_get_intra_inter_context(xd);
|
| const int is_inter = vp9_read(r, cm->fc->intra_inter_prob[ctx]);
|
| @@ -473,7 +472,9 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
| const BLOCK_SIZE bsize = mbmi->sb_type;
|
| const int allow_hp = cm->allow_high_precision_mv;
|
| int_mv nearestmv[2], nearmv[2];
|
| - int inter_mode_ctx, ref, is_compound;
|
| + int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
|
| + int ref, is_compound;
|
| + uint8_t inter_mode_ctx[MAX_REF_FRAMES];
|
|
|
| read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
|
| is_compound = has_second_ref(mbmi);
|
| @@ -487,13 +488,11 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
| "Reference frame has invalid dimensions");
|
| 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, fpm_sync, (void *)pbi);
|
| + vp9_find_mv_refs(cm, xd, tile, mi, frame, ref_mvs[frame],
|
| + mi_row, mi_col, fpm_sync, (void *)pbi, inter_mode_ctx);
|
| }
|
|
|
| - inter_mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]];
|
| -
|
| - if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
|
| + if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
|
| mbmi->mode = ZEROMV;
|
| if (bsize < BLOCK_8X8) {
|
| vpx_internal_error(xd->error_info, VPX_CODEC_UNSUP_BITSTREAM,
|
| @@ -502,12 +501,13 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
| }
|
| } else {
|
| if (bsize >= BLOCK_8X8)
|
| - mbmi->mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
|
| + mbmi->mode = read_inter_mode(cm, xd, r,
|
| + inter_mode_ctx[mbmi->ref_frame[0]]);
|
| }
|
|
|
| if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
|
| for (ref = 0; ref < 1 + is_compound; ++ref) {
|
| - vp9_find_best_ref_mvs(xd, allow_hp, mbmi->ref_mvs[mbmi->ref_frame[ref]],
|
| + vp9_find_best_ref_mvs(xd, allow_hp, ref_mvs[mbmi->ref_frame[ref]],
|
| &nearestmv[ref], &nearmv[ref]);
|
| }
|
| }
|
| @@ -526,13 +526,16 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
| for (idx = 0; idx < 2; idx += num_4x4_w) {
|
| int_mv block[2];
|
| const int j = idy * 2 + idx;
|
| - b_mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
|
| + b_mode = read_inter_mode(cm, xd, r, inter_mode_ctx[mbmi->ref_frame[0]]);
|
|
|
| - if (b_mode == NEARESTMV || b_mode == NEARMV)
|
| + if (b_mode == NEARESTMV || b_mode == NEARMV) {
|
| + uint8_t dummy_mode_ctx[MAX_REF_FRAMES];
|
| for (ref = 0; ref < 1 + is_compound; ++ref)
|
| vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, j, ref, mi_row, mi_col,
|
| &nearest_sub8x8[ref],
|
| - &near_sub8x8[ref]);
|
| + &near_sub8x8[ref],
|
| + dummy_mode_ctx);
|
| + }
|
|
|
| if (!assign_mv(cm, xd, b_mode, block, nearestmv,
|
| nearest_sub8x8, near_sub8x8,
|
| @@ -596,19 +599,20 @@ void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
| MV_REF* frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
|
| int w, h;
|
|
|
| - if (frame_is_intra_only(cm))
|
| + if (frame_is_intra_only(cm)) {
|
| read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r);
|
| - else
|
| + } else {
|
| read_inter_frame_mode_info(pbi, xd, tile, mi_row, mi_col, r);
|
|
|
| - for (h = 0; h < y_mis; ++h) {
|
| - MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
| - for (w = 0; w < x_mis; ++w) {
|
| - MV_REF *const mv = frame_mv + w;
|
| - mv->ref_frame[0] = mi->mbmi.ref_frame[0];
|
| - mv->ref_frame[1] = mi->mbmi.ref_frame[1];
|
| - mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
|
| - mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
|
| + for (h = 0; h < y_mis; ++h) {
|
| + MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
| + for (w = 0; w < x_mis; ++w) {
|
| + MV_REF *const mv = frame_mv + w;
|
| + mv->ref_frame[0] = mi->mbmi.ref_frame[0];
|
| + mv->ref_frame[1] = mi->mbmi.ref_frame[1];
|
| + mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
|
| + mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
|
| + }
|
| }
|
| }
|
| }
|
|
|