Enhance error_resilience_test to set nomfmv frames

Allows the test to set frames that do not use mfmv,
i.e. allow_ref_frame_mvs is set as 0.

This will be used subsequently to add new tests to check
for parseability of error-resilient frames and subsequent
frames.

Change-Id: I44b42964b84d38bd53a9d6d440cccabb90a05b75
diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc
index cea4d13..1f061fd 100644
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -20,6 +20,7 @@
 const int kMaxErrorFrames = 12;
 const int kMaxDroppableFrames = 12;
 const int kMaxErrorResilientFrames = 12;
+const int kMaxNoMFMVFrames = 12;
 const int kCpuUsed = 1;
 
 class ErrorResilienceTestLarge
@@ -38,6 +39,7 @@
     error_nframes_ = 0;
     droppable_nframes_ = 0;
     error_resilient_nframes_ = 0;
+    nomfmv_nframes_ = 0;
     pattern_switch_ = 0;
   }
 
@@ -86,6 +88,18 @@
         }
       }
     }
+    encoder->Control(AV1E_SET_ALLOW_REF_FRAME_MVS, 1);
+    if (nomfmv_nframes_ > 0 &&
+        (cfg_.g_pass == AOM_RC_LAST_PASS || cfg_.g_pass == AOM_RC_ONE_PASS)) {
+      for (unsigned int i = 0; i < nomfmv_nframes_; ++i) {
+        if (nomfmv_frames_[i] == video->frame()) {
+          std::cout << "             Encoding no mfmv frame: "
+                    << nomfmv_frames_[i] << "\n";
+          encoder->Control(AV1E_SET_ALLOW_REF_FRAME_MVS, 0);
+          break;
+        }
+      }
+    }
   }
 
   double GetAveragePsnr() const {
@@ -157,6 +171,16 @@
       error_resilient_frames_[i] = list[i];
   }
 
+  void SetNoMFMVFrames(int num, unsigned int *list) {
+    if (num > kMaxNoMFMVFrames)
+      num = kMaxNoMFMVFrames;
+    else if (num < 0)
+      num = 0;
+    nomfmv_nframes_ = num;
+    for (unsigned int i = 0; i < nomfmv_nframes_; ++i)
+      nomfmv_frames_[i] = list[i];
+  }
+
   unsigned int GetMismatchFrames() { return mismatch_nframes_; }
   unsigned int GetEncodedFrames() { return nframes_; }
   unsigned int GetDecodedFrames() { return decoded_nframes_; }
@@ -170,12 +194,14 @@
   unsigned int error_nframes_;
   unsigned int droppable_nframes_;
   unsigned int error_resilient_nframes_;
+  unsigned int nomfmv_nframes_;
   unsigned int pattern_switch_;
   double mismatch_psnr_;
   unsigned int mismatch_nframes_;
   unsigned int error_frames_[kMaxErrorFrames];
   unsigned int droppable_frames_[kMaxDroppableFrames];
   unsigned int error_resilient_frames_[kMaxErrorResilientFrames];
+  unsigned int nomfmv_frames_[kMaxNoMFMVFrames];
   libaom_test::TestMode encoding_mode_;
 };