Added handler for PSNR packets to EncoderTest class
authorAdrian Grange <agrange@google.com>
Tue, 2 Oct 2012 18:27:29 +0000 (11:27 -0700)
committerAdrian Grange <agrange@google.com>
Wed, 3 Oct 2012 21:23:47 +0000 (14:23 -0700)
Added a virtual function to handle PSNR packets.

Change-Id: Id2a6372c691a14f19bbeed217a93a9df03e81e75

test/encode_test_driver.cc
test/encode_test_driver.h

index 182d1ea..8dbc88b 100644 (file)
@@ -159,16 +159,25 @@ void EncoderTest::RunLoop(VideoSource *video) {
       while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
         again = true;
 
-        if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
-          continue;
+        switch (pkt->kind) {
+          case VPX_CODEC_CX_FRAME_PKT:
 #if CONFIG_VP8_DECODER
-        has_cxdata = true;
-        decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf,
-                            pkt->data.frame.sz);
+            has_cxdata = true;
+            decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf,
+                                pkt->data.frame.sz);
 #endif
-        ASSERT_GE(pkt->data.frame.pts, last_pts_);
-        last_pts_ = pkt->data.frame.pts;
-        FramePktHook(pkt);
+            ASSERT_GE(pkt->data.frame.pts, last_pts_);
+            last_pts_ = pkt->data.frame.pts;
+            FramePktHook(pkt);
+            break;
+
+          case VPX_CODEC_PSNR_PKT:
+            PSNRPktHook(pkt);
+            break;
+
+          default:
+            break;
+        }
       }
 
 #if CONFIG_VP8_DECODER
index 7b95a8d..0141fa9 100644 (file)
@@ -176,6 +176,9 @@ class EncoderTest {
   // Hook to be called on every compressed data packet.
   virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {}
 
+  // Hook to be called on every PSNR packet.
+  virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {}
+
   // Hook to determine whether the encode loop should continue.
   virtual bool Continue() const { return !abort_; }