{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
};
-static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 1, 1, 1, 1, 1 };
-
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
};
-static int sb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 2, 2, 1, 1, 1 };
-
-
-
static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
{2, -1}, {-1, 2}, {3, -1}, {-1,-1}
};
-static int sb64_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 1, 1, 1, 1, 1, 1, 1, 1 };
-
-
// clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
int i;
MODE_INFO *candidate_mi;
MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
- int_mv candidate_mvs[MAX_MV_REF_CANDIDATES];
int_mv c_refmv;
int_mv c2_refmv;
MV_REFERENCE_FRAME c_ref_frame;
int refmv_count = 0;
int split_count = 0;
int (*mv_ref_search)[2];
- int *ref_distance_weight;
const int mb_col = (-xd->mb_to_left_edge) >> 7;
-
// Blank the reference vector lists and other local structures.
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
- vpx_memset(candidate_mvs, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
vpx_memset(candidate_scores, 0, sizeof(candidate_scores));
if (mbmi->sb_type == BLOCK_SIZE_SB64X64) {
mv_ref_search = sb64_mv_ref_search;
- ref_distance_weight = sb64_ref_distance_weight;
} else if (mbmi->sb_type >= BLOCK_SIZE_SB32X32) {
mv_ref_search = sb_mv_ref_search;
- ref_distance_weight = sb_ref_distance_weight;
} else {
mv_ref_search = mb_mv_ref_search;
- ref_distance_weight = mb_ref_distance_weight;
}
// We first scan for candidate vectors that match the current reference frame
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i] + 16);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
split_count += (candidate_mi->mbmi.mode == SPLITMV);
}
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i] + 16);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
}
}
if (lf_here && (refmv_count < MAX_MV_REF_CANDIDATES)) {
candidate_mi = lf_here;
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, 17);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
}
if (c_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i]);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 1);
}
if (c2_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c2_refmv, ref_distance_weight[i]);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c2_refmv, 1);
}
}
}
if (c_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
+ add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c_refmv, 1);
}
if (c2_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
+ add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c2_refmv, 1);
}
}
// Define inter mode coding context.
// 0,0 was best
- if (candidate_mvs[0].as_int == 0) {
+ if (mv_ref_list[0].as_int == 0) {
// 0,0 is only candidate
if (refmv_count <= 1) {
mbmi->mb_mode_context[ref_frame] = 0;
mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 5 : 6;
}
- // Scan for 0,0 case and clamp non zero choices
+ // Clamp vectors
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- clamp_mv_ref(xd, &candidate_mvs[i]);
+ clamp_mv_ref(xd, &mv_ref_list[i]);
}
-
- // Copy over the candidate list.
- vpx_memcpy(mv_ref_list, candidate_mvs, sizeof(candidate_mvs));
}
*sf0 = cm->active_ref_scale[mbmi->ref_frame - 1];
{
- const int use_prev_in_find_best_ref = sf0->x_num == sf0->x_den &&
- sf0->y_num == sf0->y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
-
// Select the appropriate reference frame for this MB
const int ref_fb_idx = cm->active_ref_idx[ref_frame - 1];
if (mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ? xd->pre.y_buffer
- : NULL,
- xd->pre.y_stride,
mbmi->ref_mvs[ref_frame],
&nearest, &nearby);
const MV_REFERENCE_FRAME second_ref_frame = mbmi->second_ref_frame;
struct scale_factors *sf1 = &xd->scale_factor[1];
struct scale_factors *sf_uv1 = &xd->scale_factor_uv[1];
- const int use_prev_in_find_best_ref = sf1->x_num == sf1->x_den &&
- sf1->y_num == sf1->y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
const int second_ref_fb_idx = cm->active_ref_idx[second_ref_frame - 1];
*sf1 = cm->active_ref_scale[second_ref_frame - 1];
if (mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ?
- xd->second_pre.y_buffer : NULL,
- xd->second_pre.y_stride,
mbmi->ref_mvs[second_ref_frame],
&nearest_second,
&nearby_second);