shithub: libvpx

Download patch

ref: a869e62a8fb4ab847e8826c0508d3bbe1fd13047
parent: a9a13ce9443c468eb223fc775d020f4baf86f35c
author: Alex Converse <aconverse@google.com>
date: Thu Jun 26 12:19:40 EDT 2014

Verify that the ouput of q0 is lossless in cpu speed test.

Change-Id: Ib94ee638eb486f1368f2e3098d25c1d3d28fc265

--- a/test/cpu_speed_test.cc
+++ b/test/cpu_speed_test.cc
@@ -17,6 +17,8 @@
 
 namespace {
 
+const int kMaxPSNR = 100;
+
 class CpuSpeedTest : public ::libvpx_test::EncoderTest,
     public ::libvpx_test::CodecTestWith2Params<
         libvpx_test::TestMode, int> {
@@ -24,7 +26,8 @@
   CpuSpeedTest()
       : EncoderTest(GET_PARAM(0)),
         encoding_mode_(GET_PARAM(1)),
-        set_cpu_used_(GET_PARAM(2)) {}
+        set_cpu_used_(GET_PARAM(2)),
+        min_psnr_(kMaxPSNR) {}
   virtual ~CpuSpeedTest() {}
 
   virtual void SetUp() {
@@ -39,6 +42,10 @@
     }
   }
 
+  virtual void BeginPassHook(unsigned int /*pass*/) {
+    min_psnr_ = kMaxPSNR;
+  }
+
   virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
                                   ::libvpx_test::Encoder *encoder) {
     if (video->frame() == 1) {
@@ -57,8 +64,14 @@
     }
   }
 
+  virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+    if (pkt->data.psnr.psnr[0] < min_psnr_)
+      min_psnr_ = pkt->data.psnr.psnr[0];
+  }
+
   ::libvpx_test::TestMode encoding_mode_;
   int set_cpu_used_;
+  double min_psnr_;
 };
 
 TEST_P(CpuSpeedTest, TestQ0) {
@@ -75,7 +88,10 @@
   ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
                                        20);
 
+  init_flags_ = VPX_CODEC_USE_PSNR;
+
   ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+  EXPECT_GE(min_psnr_, kMaxPSNR);
 }