]> granicus.if.org Git - libvpx/commitdiff
temporal filter test: adjust inputs and runtime
authorJohann <johannkoenig@google.com>
Tue, 28 Mar 2017 22:19:55 +0000 (15:19 -0700)
committerJohann Koenig <johannkoenig@google.com>
Mon, 14 Aug 2017 17:24:11 +0000 (17:24 +0000)
Use input with a narrow range because the filter only applies when the
frames are similar.

Run CompareReferenceRandom more times. Especially before narrowing the
input range, the filter frequently did not apply.

Change-Id: Ie249bedf6d0d33dfa5884611cb1835788e418b38

test/temporal_filter_test.cc

index 0395eb82e41a76c1ef8e7c6c430db4c4f4fee955..655a36be9a4c8986826bad19323e3bd62d8cd1c3 100644 (file)
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <limits>
+
 #include "third_party/googletest/src/include/gtest/gtest.h"
 
 #include "./vp9_rtcd.h"
@@ -139,8 +141,10 @@ TEST_P(TemporalFilterTest, SizeCombinations) {
       Buffer<uint16_t> count_chk = Buffer<uint16_t>(width, height, 0);
       ASSERT_TRUE(count_chk.Init());
 
-      a.Set(&rnd_, &ACMRandom::Rand8);
-      b.Set(&rnd_, &ACMRandom::Rand8);
+      // The difference between the buffers must be small to pass the threshold
+      // to apply the filter.
+      a.Set(&rnd_, 0, 7);
+      b.Set(&rnd_, 0, 7);
 
       accum_ref.Set(rnd_.Rand8());
       accum_chk.CopyFrom(accum_ref);
@@ -183,9 +187,17 @@ TEST_P(TemporalFilterTest, CompareReferenceRandom) {
 
       for (int filter_strength = 0; filter_strength <= 6; ++filter_strength) {
         for (int filter_weight = 0; filter_weight <= 2; ++filter_weight) {
-          for (int repeat = 0; repeat < 10; ++repeat) {
-            a.Set(&rnd_, &ACMRandom::Rand8);
-            b.Set(&rnd_, &ACMRandom::Rand8);
+          for (int repeat = 0; repeat < 100; ++repeat) {
+            if (repeat < 50) {
+              a.Set(&rnd_, 0, 7);
+              b.Set(&rnd_, 0, 7);
+            } else {
+              // Check large (but close) values as well.
+              a.Set(&rnd_, std::numeric_limits<uint8_t>::max() - 7,
+                    std::numeric_limits<uint8_t>::max());
+              b.Set(&rnd_, std::numeric_limits<uint8_t>::max() - 7,
+                    std::numeric_limits<uint8_t>::max());
+            }
 
             accum_ref.Set(rnd_.Rand8());
             accum_chk.CopyFrom(accum_ref);
@@ -234,8 +246,8 @@ TEST_P(TemporalFilterTest, DISABLED_Speed) {
       Buffer<uint16_t> count_chk = Buffer<uint16_t>(width, height, 0);
       ASSERT_TRUE(count_chk.Init());
 
-      a.Set(&rnd_, &ACMRandom::Rand8);
-      b.Set(&rnd_, &ACMRandom::Rand8);
+      a.Set(&rnd_, 0, 7);
+      b.Set(&rnd_, 0, 7);
 
       accum_chk.Set(0);
       count_chk.Set(0);