video_coding tests: removing unused functionality from test_util
Review URL: http://webrtc-codereview.appspot.com/137009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@468 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a057a9561c
commit
2c3b1fb4f3
@ -95,11 +95,11 @@ VCMEncodeCompleteCallback::SendData(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
VCMEncodeCompleteCallback::EncodedBytes()
|
VCMEncodeCompleteCallback::EncodedBytes()
|
||||||
{
|
{
|
||||||
return _encodedBytes;
|
return _encodedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VCMEncodeCompleteCallback::EncodeComplete()
|
VCMEncodeCompleteCallback::EncodeComplete()
|
||||||
@ -156,13 +156,13 @@ VCMRTPEncodeCompleteCallback::SendData(
|
|||||||
videoTypeHdr);
|
videoTypeHdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
VCMRTPEncodeCompleteCallback::EncodedBytes()
|
VCMRTPEncodeCompleteCallback::EncodedBytes()
|
||||||
{
|
{
|
||||||
// only good for one call - after which will reset value;
|
// only good for one call - after which will reset value;
|
||||||
float tmp = _encodedBytes;
|
float tmp = _encodedBytes;
|
||||||
_encodedBytes = 0;
|
_encodedBytes = 0;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -178,55 +178,14 @@ VCMRTPEncodeCompleteCallback::EncodeComplete()
|
|||||||
|
|
||||||
// Decoded Frame Callback Implementation
|
// Decoded Frame Callback Implementation
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VCMDecodeCompleteCallback::FrameToRender(VideoFrame& videoFrame)
|
VCMDecodeCompleteCallback::FrameToRender(VideoFrame& videoFrame)
|
||||||
{
|
{
|
||||||
fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _decodedFile);
|
fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _decodedFile);
|
||||||
_decodedBytes+= videoFrame.Length();
|
_decodedBytes+= videoFrame.Length();
|
||||||
// keeping last decoded frame
|
|
||||||
_lastDecodedFrame.VerifyAndAllocate(videoFrame.Size());
|
|
||||||
_lastDecodedFrame.CopyFrame(videoFrame.Size(), videoFrame.Buffer());
|
|
||||||
_lastDecodedFrame.SetHeight(videoFrame.Height());
|
|
||||||
_lastDecodedFrame.SetWidth(videoFrame.Width());
|
|
||||||
_lastDecodedFrame.SetTimeStamp(videoFrame.TimeStamp());
|
|
||||||
|
|
||||||
return VCM_OK;
|
return VCM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
VCMDecodeCompleteCallback::PSNRLastFrame(const VideoFrame& sourceFrame,
|
|
||||||
double *YPSNRptr)
|
|
||||||
{
|
|
||||||
double mse = 0.0;
|
|
||||||
double mseLogSum = 0.0;
|
|
||||||
|
|
||||||
// Y only
|
|
||||||
WebRtc_Word32 frameBytes = sourceFrame.Height() * sourceFrame.Width();
|
|
||||||
WebRtc_UWord8 *ref = sourceFrame.Buffer();
|
|
||||||
if (_lastDecodedFrame.Height() == 0)
|
|
||||||
{
|
|
||||||
*YPSNRptr = 0;
|
|
||||||
return 0; // no new decoded frames
|
|
||||||
}
|
|
||||||
WebRtc_UWord8 *test = _lastDecodedFrame.Buffer();
|
|
||||||
for( int k = 0; k < frameBytes; k++ )
|
|
||||||
{
|
|
||||||
mse += (test[k] - ref[k]) * (test[k] - ref[k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// divide by number of pixels
|
|
||||||
mse /= (double) (frameBytes);
|
|
||||||
|
|
||||||
// accumulate for total average
|
|
||||||
mseLogSum += std::log10( mse );
|
|
||||||
|
|
||||||
*YPSNRptr = 20.0 * std::log10(255.0) - 10.0 * mseLogSum; // for only 1 frame
|
|
||||||
|
|
||||||
_lastDecodedFrame.Free();
|
|
||||||
_lastDecodedFrame.SetHeight(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VCMDecodeCompleteCallback::DecodedBytes()
|
VCMDecodeCompleteCallback::DecodedBytes()
|
||||||
{
|
{
|
||||||
@ -251,6 +210,7 @@ RTPSendCompleteCallback::RTPSendCompleteCallback(RtpRtcp* rtp,
|
|||||||
_rtpDump->Start(filename);
|
_rtpDump->Start(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPSendCompleteCallback::~RTPSendCompleteCallback()
|
RTPSendCompleteCallback::~RTPSendCompleteCallback()
|
||||||
{
|
{
|
||||||
if (_rtpDump != NULL)
|
if (_rtpDump != NULL)
|
||||||
@ -266,6 +226,7 @@ RTPSendCompleteCallback::~RTPSendCompleteCallback()
|
|||||||
_rtpPackets.PopFront();
|
_rtpPackets.PopFront();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||||
{
|
{
|
||||||
|
@ -176,11 +176,9 @@ public:
|
|||||||
// will write decoded frame into file
|
// will write decoded frame into file
|
||||||
WebRtc_Word32 FrameToRender(webrtc::VideoFrame& videoFrame);
|
WebRtc_Word32 FrameToRender(webrtc::VideoFrame& videoFrame);
|
||||||
WebRtc_Word32 DecodedBytes();
|
WebRtc_Word32 DecodedBytes();
|
||||||
int PSNRLastFrame(const webrtc::VideoFrame& sourceFrame, double *YPSNRptr);
|
|
||||||
private:
|
private:
|
||||||
FILE* _decodedFile;
|
FILE* _decodedFile;
|
||||||
WebRtc_UWord32 _decodedBytes;
|
WebRtc_UWord32 _decodedBytes;
|
||||||
webrtc::VideoFrame _lastDecodedFrame;
|
|
||||||
}; // end of VCMDecodeCompleCallback class
|
}; // end of VCMDecodeCompleCallback class
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user