Added handler for PSNR packets to EncoderTest class

Added a virtual function to handle PSNR packets.

Change-Id: Id2a6372c691a14f19bbeed217a93a9df03e81e75
This commit is contained in:
Adrian Grange 2012-10-02 11:27:29 -07:00
parent 4206c6dd01
commit e6109dbd41
2 changed files with 20 additions and 8 deletions

View File

@ -159,8 +159,8 @@ void EncoderTest::RunLoop(VideoSource *video) {
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) { while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
again = true; again = true;
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) switch (pkt->kind) {
continue; case VPX_CODEC_CX_FRAME_PKT:
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
has_cxdata = true; has_cxdata = true;
decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf, decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf,
@ -169,6 +169,15 @@ void EncoderTest::RunLoop(VideoSource *video) {
ASSERT_GE(pkt->data.frame.pts, last_pts_); ASSERT_GE(pkt->data.frame.pts, last_pts_);
last_pts_ = pkt->data.frame.pts; last_pts_ = pkt->data.frame.pts;
FramePktHook(pkt); FramePktHook(pkt);
break;
case VPX_CODEC_PSNR_PKT:
PSNRPktHook(pkt);
break;
default:
break;
}
} }
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER

View File

@ -176,6 +176,9 @@ class EncoderTest {
// Hook to be called on every compressed data packet. // Hook to be called on every compressed data packet.
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {} 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. // Hook to determine whether the encode loop should continue.
virtual bool Continue() const { return !abort_; } virtual bool Continue() const { return !abort_; }