Allow av1_find_mv_refs to take a null global_mvs.
The decoder does not need the global_mvs output from av1_find_mv_refs().
Change av1_find_mv_refs() to allow a null global_mvs parameter and
change the decoder to pass NULL as the global_mvs argument to
av1_find_mv_refs().
Change-Id: Ic192cb33b682129b89c3351604c3be50b690963b
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 3bdffe4..1c63319 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -821,7 +821,7 @@
MV_REFERENCE_FRAME rf[2];
av1_set_ref_frame(rf, ref_frame);
- if (ref_frame < REF_FRAMES) {
+ if (global_mvs != NULL && ref_frame < REF_FRAMES) {
if (ref_frame != INTRA_FRAME) {
global_mvs[ref_frame] = gm_get_motion_vector(
&cm->global_motion[ref_frame], cm->allow_high_precision_mv, bsize,
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index 1ece84a..8db4095 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -243,6 +243,9 @@
const MB_MODE_INFO *const mi, int mi_row, int mi_col,
int x_mis, int y_mis);
+// The global_mvs output parameter points to an array of REF_FRAMES elements.
+// The caller may pass a null global_mvs if it does not need the global_mvs
+// output.
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index b8fcb5d..2791f3a 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -678,11 +678,10 @@
int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES];
int_mv ref_mvs[INTRA_FRAME + 1][MAX_MV_REF_CANDIDATES];
- int_mv global_mvs[REF_FRAMES];
av1_find_mv_refs(cm, xd, mbmi, INTRA_FRAME, xd->ref_mv_count,
- xd->ref_mv_stack, ref_mvs, global_mvs, mi_row, mi_col,
- inter_mode_ctx);
+ xd->ref_mv_stack, ref_mvs, /*global_mvs=*/NULL, mi_row,
+ mi_col, inter_mode_ctx);
int_mv nearestmv, nearmv;
@@ -1271,9 +1270,9 @@
const int is_compound = has_second_ref(mbmi);
MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame);
- int_mv global_mvs[REF_FRAMES];
av1_find_mv_refs(cm, xd, mbmi, ref_frame, xd->ref_mv_count, xd->ref_mv_stack,
- ref_mvs, global_mvs, mi_row, mi_col, inter_mode_ctx);
+ ref_mvs, /*global_mvs=*/NULL, mi_row, mi_col,
+ inter_mode_ctx);
int mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame);
mbmi->ref_mv_idx = 0;