Fix a bug related to motion field setup

We have 2 flags related to ref_frame_mvs:
  int enable_ref_frame_mvs;          // sequence level flag
  int allow_ref_frame_mvs;           // frame level flag

allow_ref_frame_mvs can be either 0 or 1 for each frame. In current
av1_setup_motion_field(), we also calculate cm->ref_frame_side, which
will affect how mvs are copied in av1_copy_frame_mvs(), and thus
affect following frames. So, we should always calculate it no matter
what allow_ref_frame_mvs is.

In this fix, take the calculation of cm->ref_frame_side out of
av1_setup_motion_field(). Then, motion field estimation can be done
only when allow_ref_frame_mvs = 1. In this way, it is consistent with
AV1 spec definition as shown below.

if ( use_ref_frame_mvs == 1 )
    motion_field_estimation( )

This also fixed the test vector failure, where ref_frame_mvs is
enabled at the sequence level, but allow_ref_frame_mvs value
changes from frame to frame.

BUG=aomedia:3116

Change-Id: Ic0c77368dbda029eeb9505ef6a4a0a00e771b9f6
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0ea2873..51c95e2 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -5155,7 +5155,8 @@
 
   cm->mi_params.setup_mi(&cm->mi_params);
 
-  av1_setup_motion_field(cm);
+  av1_calculate_ref_frame_side(cm);
+  if (cm->features.allow_ref_frame_mvs) av1_setup_motion_field(cm);
 
   av1_setup_block_planes(xd, cm->seq_params->subsampling_x,
                          cm->seq_params->subsampling_y, num_planes);