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
This commit is contained in:
mikhal@webrtc.org 2012-11-07 21:36:15 +00:00
parent c862f49b2d
commit 055663be0a
5 changed files with 28 additions and 40 deletions

View File

@ -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<VideoFrameType> 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,

View File

@ -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;

View File

@ -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_

View File

@ -14,6 +14,7 @@
#include <iostream>
#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];
}

View File

@ -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;