summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2013-04-19 14:09:44 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-04-19 14:09:44 -0700
commitfb754fd37ea0fe7d3a0ed3bf8469744125a1ca2e (patch)
tree93c84c72483b9201ad8c5cde1873dfb11d0afd73
parentec2599cc916f53b61a668c0f2e29977c6e8af908 (diff)
parentde80da39dc9b7b56c180bf27ee6e47779280fa4d (diff)
downloadlibvpx-fb754fd37ea0fe7d3a0ed3bf8469744125a1ca2e.tar
libvpx-fb754fd37ea0fe7d3a0ed3bf8469744125a1ca2e.tar.gz
libvpx-fb754fd37ea0fe7d3a0ed3bf8469744125a1ca2e.tar.bz2
libvpx-fb754fd37ea0fe7d3a0ed3bf8469744125a1ca2e.zip
Merge "Mv ref candidates cut to 2." into experimental
-rw-r--r--vp9/common/vp9_blockd.h2
-rw-r--r--vp9/common/vp9_findnearmv.c2
-rw-r--r--vp9/common/vp9_findnearmv.h2
-rw-r--r--vp9/common/vp9_mvref_common.c52
-rw-r--r--vp9/decoder/vp9_decodemv.c15
-rw-r--r--vp9/encoder/vp9_rdopt.c10
6 files changed, 17 insertions, 66 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 265c1f21a..d30cd4960 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -41,7 +41,7 @@
#define SEGMENT_DELTADATA 0
#define SEGMENT_ABSDATA 1
#define MAX_MV_REFS 9
-#define MAX_MV_REF_CANDIDATES 4
+#define MAX_MV_REF_CANDIDATES 2
typedef enum {
PLANE_TYPE_Y_WITH_DC,
diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c
index 832e8ddf1..b5a32d9b3 100644
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -39,8 +39,6 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob p[4], int context) {
}
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near) {
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index c360c20eb..085454512 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -24,8 +24,6 @@
// above and a number cols of pixels in the left to select the one with best
// score to use as ref motion vector
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near);
diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c
index d8ac68829..fa4158f84 100644
--- a/vp9/common/vp9_mvref_common.c
+++ b/vp9/common/vp9_mvref_common.c
@@ -17,28 +17,16 @@ static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{-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
@@ -164,7 +152,6 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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;
@@ -173,23 +160,17 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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
@@ -205,8 +186,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
(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);
}
@@ -224,8 +205,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
(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);
}
}
}
@@ -234,8 +215,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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);
}
}
@@ -259,14 +240,14 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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);
}
}
}
@@ -280,20 +261,20 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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;
@@ -311,11 +292,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
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));
}
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 2a8521a14..0c2bebfbc 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -678,11 +678,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
*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];
@@ -711,9 +706,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
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);
@@ -751,10 +743,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
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];
@@ -768,9 +756,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
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);
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index cf37626f9..2306871e4 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2690,7 +2690,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]];
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
- int use_prev_in_find_mv_refs, use_prev_in_find_best_ref;
+ int use_prev_in_find_mv_refs;
// set up scaling factors
scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1];
@@ -2715,15 +2715,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
cpi->common.ref_frame_sign_bias);
// Candidate refinement carried out at encoder and decoder
- use_prev_in_find_best_ref =
- scale[frame_type].x_num == scale[frame_type].x_den &&
- scale[frame_type].y_num == scale[frame_type].y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ?
- yv12_mb[frame_type].y_buffer : NULL,
- yv12->y_stride,
mbmi->ref_mvs[frame_type],
&frame_nearest_mv[frame_type],
&frame_near_mv[frame_type]);