shithub: libvpx

Download patch

ref: f950248b9b357b21e974e3ace94359d7ee8c7b29
parent: d998721f713024adad5f4c1b8e30737f2e06607c
author: Luc Trudeau <luc@trud.ca>
date: Wed Jun 13 09:36:17 EDT 2018

Add Speed Tests for the SADTest test suite.

Speed tests are added for the SADTest test suite. These test use the
AbstractBench and print the median run time of SAD operations. Speed
tests are disabled by default.

Change-Id: I5d0957248f9b5b307ae2d757d5f8d4761a1dd712

--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -17,6 +17,7 @@
 #include "./vpx_config.h"
 #include "./vpx_dsp_rtcd.h"
 #include "test/acm_random.h"
+#include "test/bench.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
 #include "test/util.h"
@@ -265,7 +266,7 @@
   }
 };
 
-class SADTest : public SADTestBase<SadMxNParam> {
+class SADTest : public AbstractBench, public SADTestBase<SadMxNParam> {
  public:
   SADTest() : SADTestBase(GetParam()) {}
 
@@ -285,6 +286,11 @@
 
     ASSERT_EQ(reference_sad, exp_sad);
   }
+
+  void Run() {
+    params_.func(source_data_, source_stride_, reference_data_,
+                 reference_stride_);
+  }
 };
 
 class SADavgTest : public SADTestBase<SadMxNAvgParam> {
@@ -349,6 +355,17 @@
   FillRandom(reference_data_, reference_stride_);
   CheckSAD();
   source_stride_ = tmp_stride;
+}
+
+TEST_P(SADTest, DISABLED_Speed) {
+  const int kCountSpeedTestBlock = 50000000 / (params_.width * params_.height);
+  FillRandom(source_data_, source_stride_);
+
+  RunNTimes(kCountSpeedTestBlock);
+
+  char title[16];
+  snprintf(title, sizeof(title), "%dx%d", params_.width, params_.height);
+  PrintMedian(title);
 }
 
 TEST_P(SADavgTest, MaxRef) {