From 055663be0a4bab6552285b2ebd9df70b268887c4 Mon Sep 17 00:00:00 2001 From: "mikhal@webrtc.org" Date: Wed, 7 Nov 2012 21:36:15 +0000 Subject: [PATCH] Updating vp8 tests Review URL: https://webrtc-codereview.appspot.com/936017 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3058 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../test_framework/normal_async_test.cc | 20 ++++++++-------- .../codecs/test_framework/normal_test.cc | 23 ++----------------- .../codecs/test_framework/normal_test.h | 6 ----- .../codecs/test_framework/test.cc | 12 ++++++++-- .../video_coding/codecs/test_framework/test.h | 7 +++++- 5 files changed, 28 insertions(+), 40 deletions(-) diff --git a/webrtc/modules/video_coding/codecs/test_framework/normal_async_test.cc b/webrtc/modules/video_coding/codecs/test_framework/normal_async_test.cc index 67cd02c458..8f3a89f1e0 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/normal_async_test.cc +++ b/webrtc/modules/video_coding/codecs/test_framework/normal_async_test.cc @@ -236,7 +236,6 @@ VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage, { _test.Encoded(encodedImage); VideoFrame *newBuffer = new VideoFrame(); - //newBuffer->VerifyAndAllocate(encodedImage._length); newBuffer->VerifyAndAllocate(encodedImage._size); _encodedBytes += encodedImage._length; // If _frameQueue would have been a fixed sized buffer we could have asked @@ -405,18 +404,18 @@ bool NormalAsyncTest::Encode() { _lengthEncFrame = 0; - EXPECT_GT(fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile), 0u); - _inputVideoBuffer.CreateFrame(_sizeY, _sourceBuffer, - _sizeUv, _sourceBuffer + _sizeY, - _sizeUv, _sourceBuffer + _sizeY + _sizeUv, - _width, _height, - _width, _halfWidth, _halfWidth); - _inputVideoBuffer.set_timestamp((unsigned int) - (_encFrameCnt * 9e4 / _inst.maxFramerate)); if (feof(_sourceFile) != 0) { return true; } + EXPECT_GT(fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile), 0u); + EXPECT_EQ(0, _inputVideoBuffer.CreateFrame(_sizeY, _sourceBuffer, + _sizeUv, _sourceBuffer + _sizeY, + _sizeUv, _sourceBuffer + _sizeY + _sizeUv, + _width, _height, + _width, _halfWidth, _halfWidth)); + _inputVideoBuffer.set_timestamp((unsigned int) + (_encFrameCnt * 9e4 / _inst.maxFramerate)); _encodeCompleteTime = 0; _encodeTimes[_inputVideoBuffer.timestamp()] = tGetTime(); std::vector frame_types(1, kDeltaFrame); @@ -493,7 +492,8 @@ NormalAsyncTest::Decode(int lossValue) _decodeCompleteTime = 0; _decodeTimes[encodedImage._timeStamp] = tGetTime(); int ret = WEBRTC_VIDEO_CODEC_OK; - if (!_waitForKey || encodedImage._frameType == kKeyFrame) + // TODO(mikhal): Update frame type. + //if (!_waitForKey || encodedImage._frameType == kKeyFrame) { _waitForKey = false; ret = _decoder->Decode(encodedImage, _missingFrames, NULL, diff --git a/webrtc/modules/video_coding/codecs/test_framework/normal_test.cc b/webrtc/modules/video_coding/codecs/test_framework/normal_test.cc index b341f356f5..231cac0f75 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/normal_test.cc +++ b/webrtc/modules/video_coding/codecs/test_framework/normal_test.cc @@ -23,13 +23,7 @@ NormalTest::NormalTest() CodecTest("Normal Test 1", "A test of normal execution of the codec"), _testNo(1), _lengthEncFrame(0), -_appendNext(false), -_width(0), -_halfWidth(0), -_height(0), -_halfHeight(0), -_sizeY(0), -_sizeUv(0) +_appendNext(false) { } @@ -40,13 +34,7 @@ CodecTest(name, description), _requestKeyFrame(false), _testNo(testNo), _lengthEncFrame(0), -_appendNext(false), -_width(0), -_halfWidth(0), -_height(0), -_halfHeight(0), -_sizeY(0), -_sizeUv(0) +_appendNext(false) { } @@ -131,8 +119,6 @@ NormalTest::Perform() CodecSettings(_width, _height, 30, _bitRate); Setup(); - _inputVideoBuffer.CreateEmptyFrame(_width, _height, - _width, _halfWidth, _halfWidth); _inputVideoBuffer.CreateEmptyFrame(_width, _height, _width, _halfWidth, _halfWidth); _decodedVideoBuffer.CreateEmptyFrame(_width, _height, @@ -230,9 +216,6 @@ NormalTest::Encode() _inputVideoBuffer.set_width(_inst.width); _inputVideoBuffer.set_height(_inst.height); - //_lengthEncFrame = _encoder->Encode(_inputVideoBuffer, _encodedVideoBuffer, _frameInfo, - // _inst.frameRate, _requestKeyFrame && !(_framecnt%50)); - endtime = clock()/(double)CLOCKS_PER_SEC; _encodedVideoBuffer.SetHeight(_inst.height); @@ -272,8 +255,6 @@ NormalTest::Decode(int lossValue) _encodedVideoBuffer.SetWidth(_inst.width); _encodedVideoBuffer.SetHeight(_inst.height); int lengthDecFrame = 0; - //int lengthDecFrame = _decoder->Decode(_encodedVideoBuffer, _decodedVideoBuffer); - //_totalDecodeTime += (double)((clock()/(double)CLOCKS_PER_SEC) - starttime); if (lengthDecFrame < 0) { return lengthDecFrame; diff --git a/webrtc/modules/video_coding/codecs/test_framework/normal_test.h b/webrtc/modules/video_coding/codecs/test_framework/normal_test.h index ca3aba3018..061fb6d968 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/normal_test.h +++ b/webrtc/modules/video_coding/codecs/test_framework/normal_test.h @@ -40,12 +40,6 @@ protected: unsigned int _testNo; int _lengthEncFrame; bool _appendNext; - int _width; - int _halfWidth; - int _height; - int _halfHeight; - int _sizeY; - int _sizeUv; }; #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_NORMAL_TEST_H_ diff --git a/webrtc/modules/video_coding/codecs/test_framework/test.cc b/webrtc/modules/video_coding/codecs/test_framework/test.cc index 71d8ff04ae..743afe81b9 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/test.cc +++ b/webrtc/modules/video_coding/codecs/test_framework/test.cc @@ -14,6 +14,7 @@ #include #include "testsupport/metrics/video_metrics.h" +#include "common_video/libyuv/include/webrtc_libyuv.h" using namespace webrtc; @@ -73,8 +74,15 @@ CodecTest::Print() void CodecTest::Setup() { - int widhei = _inst.width*_inst.height; - _lengthSourceFrame = 3*widhei/2; + _width = _inst.width; + _halfWidth = (_width + 1) / 2; + _height = _inst.height; + _halfHeight = (_height + 1) / 2;; + _sizeY = _width * _height; + _sizeUv = _halfWidth * _halfHeight; + _lengthSourceFrame = webrtc::CalcBufferSize(webrtc::kI420, + _inst.width, + _inst.height); _sourceBuffer = new unsigned char[_lengthSourceFrame]; } diff --git a/webrtc/modules/video_coding/codecs/test_framework/test.h b/webrtc/modules/video_coding/codecs/test_framework/test.h index b0a6393881..3681b977ad 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/test.h +++ b/webrtc/modules/video_coding/codecs/test_framework/test.h @@ -60,7 +60,12 @@ protected: std::string _outname; std::string _encodedName; int _sumEncBytes; - + int _width; + int _halfWidth; + int _height; + int _halfHeight; + int _sizeY; + int _sizeUv; private: std::string _name; std::string _description;