Unify single and compound ref mv process
Unify the operation flow for both single and compound modes
reference motion vector search process. Drop unneeded function
parameters from the interface.
Change-Id: Ia7e96f620fb0b3f2ae5b337d9e84053d9d24d44f
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index fe757cc..c80e6d1 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -540,7 +540,7 @@
#if USE_CUR_GM_REFMV
int_mv *gm_mv_candidates,
#endif // USE_CUR_GM_REFMV
- int mi_row, int mi_col, int16_t *mode_context, int compound_search) {
+ int mi_row, int mi_col, int16_t *mode_context) {
const int bs = AOMMAX(xd->n8_w, xd->n8_h);
const int has_tr = has_top_right(cm, xd, mi_row, mi_col, bs);
MV_REFERENCE_FRAME rf[2];
@@ -554,13 +554,7 @@
av1_set_ref_frame(rf, ref_frame);
mode_context[ref_frame] = 0;
- if (!compound_search) {
- refmv_count[ref_frame] = 0;
- } else {
- refmv_count[ref_frame] = 0;
- // refmv_count[rf[0]] = 0;
- // refmv_count[rf[1]] = 0;
- }
+ refmv_count[ref_frame] = 0;
// Find valid maximum row/col offset.
if (xd->up_available) {
@@ -992,10 +986,8 @@
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE],
- int16_t *compound_mode_context,
int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES], int mi_row,
- int mi_col, find_mv_refs_sync sync, void *const data,
- int16_t *mode_context, int compound_search) {
+ int mi_col, int16_t *mode_context) {
int_mv zeromv[2];
BLOCK_SIZE bsize = mi->mbmi.sb_type;
MV_REFERENCE_FRAME rf[2];
@@ -1025,28 +1017,11 @@
zeromv[0].as_int = zeromv[1].as_int = 0;
}
- if (compound_search) {
- int_mv zeromv1[2];
- zeromv1[0].as_int = zeromv[0].as_int;
- zeromv1[1].as_int = zeromv[1].as_int;
- setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack,
- mv_ref_list,
+ setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list,
#if USE_CUR_GM_REFMV
- zeromv1,
+ zeromv,
#endif // USE_CUR_GM_REFMV
- mi_row, mi_col, mode_context, compound_search);
- } else {
- setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack,
- mv_ref_list,
-#if USE_CUR_GM_REFMV
- zeromv,
-#endif // USE_CUR_GM_REFMV
- mi_row, mi_col, mode_context, compound_search);
- }
-
- (void)compound_mode_context;
- (void)data;
- (void)sync;
+ mi_row, mi_col, mode_context);
}
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index ebdcfda..6877268 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -378,15 +378,12 @@
void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row,
int mi_col, int x_mis, int y_mis);
-typedef void (*find_mv_refs_sync)(void *const data, int mi_row);
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE],
- int16_t *compound_mode_context,
int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES], int mi_row,
- int mi_col, find_mv_refs_sync sync, void *const data,
- int16_t *mode_context, int compound_search);
+ int mi_col, int16_t *mode_context);
// check a list of motion vectors by sad score using a number rows of pixels
// above and a number cols of pixels in the left to select the one with best
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 40de396..b2ccb2e 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -734,8 +734,7 @@
int_mv ref_mvs[INTRA_FRAME + 1][MAX_MV_REF_CANDIDATES];
av1_find_mv_refs(cm, xd, mi, INTRA_FRAME, xd->ref_mv_count,
- xd->ref_mv_stack, NULL, ref_mvs, mi_row, mi_col, NULL,
- NULL, inter_mode_ctx, 0);
+ xd->ref_mv_stack, ref_mvs, mi_row, mi_col, inter_mode_ctx);
int_mv nearestmv, nearmv;
@@ -1395,7 +1394,6 @@
int_mv nearestmv[2], nearmv[2];
int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES] = { { { 0 } } };
int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES];
- int16_t compound_inter_mode_ctx[MODE_CTX_REF_FRAMES];
int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE];
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
@@ -1408,21 +1406,11 @@
read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
const int is_compound = has_second_ref(mbmi);
- if (is_compound) {
- MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame);
- av1_find_mv_refs(cm, xd, mi, ref_frame, xd->ref_mv_count, xd->ref_mv_stack,
- compound_inter_mode_ctx, ref_mvs, mi_row, mi_col, fpm_sync,
- (void *)pbi, inter_mode_ctx, 1);
- } else {
- MV_REFERENCE_FRAME frame = mbmi->ref_frame[0];
- av1_find_mv_refs(cm, xd, mi, frame, xd->ref_mv_count, xd->ref_mv_stack,
- compound_inter_mode_ctx, ref_mvs, mi_row, mi_col, fpm_sync,
- (void *)pbi, inter_mode_ctx, 0);
- }
+ MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame);
+ av1_find_mv_refs(cm, xd, mi, ref_frame, xd->ref_mv_count, xd->ref_mv_stack,
+ ref_mvs, mi_row, mi_col, inter_mode_ctx);
- int mode_ctx = 0;
-
- mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame);
+ int mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame);
mbmi->ref_mv_idx = 0;
if (mbmi->skip_mode) {
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 330811c..29a715e 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5576,9 +5576,8 @@
// Gets an initial list of candidate vectors from neighbours and orders them
av1_find_mv_refs(cm, xd, mi, ref_frame, mbmi_ext->ref_mv_count,
- mbmi_ext->ref_mv_stack, mbmi_ext->compound_mode_context,
- mbmi_ext->ref_mvs, mi_row, mi_col, NULL, NULL,
- mbmi_ext->mode_context, 0);
+ mbmi_ext->ref_mv_stack, mbmi_ext->ref_mvs, mi_row, mi_col,
+ mbmi_ext->mode_context);
// Candidate refinement carried out at encoder and decoder
#if CONFIG_AMVR
@@ -7851,9 +7850,8 @@
MV_REFERENCE_FRAME ref_frame = INTRA_FRAME;
int_mv *const candidates = x->mbmi_ext->ref_mvs[ref_frame];
av1_find_mv_refs(cm, xd, mi, ref_frame, mbmi_ext->ref_mv_count,
- mbmi_ext->ref_mv_stack, mbmi_ext->compound_mode_context,
- mbmi_ext->ref_mvs, mi_row, mi_col, NULL, NULL,
- mbmi_ext->mode_context, 0);
+ mbmi_ext->ref_mv_stack, mbmi_ext->ref_mvs, mi_row, mi_col,
+ mbmi_ext->mode_context);
int_mv nearestmv, nearmv;
#if CONFIG_AMVR
@@ -8520,9 +8518,8 @@
MODE_INFO *const mi = xd->mi[0];
x->mbmi_ext->mode_context[ref_frame] = 0;
av1_find_mv_refs(cm, xd, mi, ref_frame, mbmi_ext->ref_mv_count,
- mbmi_ext->ref_mv_stack, mbmi_ext->compound_mode_context,
- mbmi_ext->ref_mvs, mi_row, mi_col, NULL, NULL,
- mbmi_ext->mode_context, 0);
+ mbmi_ext->ref_mv_stack, mbmi_ext->ref_mvs, mi_row, mi_col,
+ mbmi_ext->mode_context);
}
av1_count_overlappable_neighbors(cm, xd, mi_row, mi_col);