astyle all
This commit is contained in:
@@ -6,21 +6,21 @@
|
||||
#include "BaseDecoderTest.h"
|
||||
#include "BaseEncoderTest.h"
|
||||
|
||||
static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) {
|
||||
static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) {
|
||||
for (int i = 0; i < info.iLayerNum; ++i) {
|
||||
const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
|
||||
int layerSize = 0;
|
||||
for (int j = 0; j < layerInfo.iNalCount; ++j) {
|
||||
layerSize += layerInfo.pNalLengthInByte[j];
|
||||
}
|
||||
SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
|
||||
SHA1Input (ctx, layerInfo.pBsBuf, layerSize);
|
||||
}
|
||||
}
|
||||
|
||||
static void WritePlaneBuffer(BufferedData* buf, const uint8_t* plane,
|
||||
int width, int height, int stride) {
|
||||
static void WritePlaneBuffer (BufferedData* buf, const uint8_t* plane,
|
||||
int width, int height, int stride) {
|
||||
for (int i = 0; i < height; i++) {
|
||||
if (!buf->PushBack(plane, width)) {
|
||||
if (!buf->PushBack (plane, width)) {
|
||||
FAIL() << "unable to allocate memory";
|
||||
}
|
||||
plane += stride;
|
||||
@@ -36,9 +36,9 @@ struct DecodeEncodeFileParam {
|
||||
};
|
||||
|
||||
class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
|
||||
public BaseDecoderTest, public BaseDecoderTest::Callback,
|
||||
public BaseEncoderTest , public BaseEncoderTest::Callback,
|
||||
public InputStream {
|
||||
public BaseDecoderTest, public BaseDecoderTest::Callback,
|
||||
public BaseEncoderTest , public BaseEncoderTest::Callback,
|
||||
public InputStream {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
BaseDecoderTest::SetUp();
|
||||
@@ -49,7 +49,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
|
||||
if (HasFatalFailure()) {
|
||||
return;
|
||||
}
|
||||
SHA1Reset(&ctx_);
|
||||
SHA1Reset (&ctx_);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
@@ -57,22 +57,22 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
|
||||
BaseEncoderTest::TearDown();
|
||||
}
|
||||
|
||||
virtual void onDecodeFrame(const Frame& frame) {
|
||||
virtual void onDecodeFrame (const Frame& frame) {
|
||||
const Plane& y = frame.y;
|
||||
const Plane& u = frame.u;
|
||||
const Plane& v = frame.v;
|
||||
WritePlaneBuffer(&buf_, y.data, y.width, y.height, y.stride);
|
||||
WritePlaneBuffer(&buf_, u.data, u.width, u.height, u.stride);
|
||||
WritePlaneBuffer(&buf_, v.data, v.width, v.height, v.stride);
|
||||
WritePlaneBuffer (&buf_, y.data, y.width, y.height, y.stride);
|
||||
WritePlaneBuffer (&buf_, u.data, u.width, u.height, u.stride);
|
||||
WritePlaneBuffer (&buf_, v.data, v.width, v.height, v.stride);
|
||||
}
|
||||
|
||||
virtual void onEncodeFrame(const SFrameBSInfo& frameInfo) {
|
||||
UpdateHashFromFrame(frameInfo, &ctx_);
|
||||
virtual void onEncodeFrame (const SFrameBSInfo& frameInfo) {
|
||||
UpdateHashFromFrame (frameInfo, &ctx_);
|
||||
}
|
||||
|
||||
virtual int read(void* ptr, size_t len) {
|
||||
virtual int read (void* ptr, size_t len) {
|
||||
while (buf_.Length() < len) {
|
||||
bool hasNext = DecodeNextFrame(this);
|
||||
bool hasNext = DecodeNextFrame (this);
|
||||
if (HasFatalFailure()) {
|
||||
return -1;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
|
||||
break;
|
||||
}
|
||||
}
|
||||
return buf_.PopFront(static_cast<uint8_t*>(ptr), len);
|
||||
return buf_.PopFront (static_cast<uint8_t*> (ptr), len);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -91,15 +91,15 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
|
||||
BufferedData buf_;
|
||||
};
|
||||
|
||||
TEST_P(DecodeEncodeTest, CompareOutput) {
|
||||
TEST_P (DecodeEncodeTest, CompareOutput) {
|
||||
DecodeEncodeFileParam p = GetParam();
|
||||
|
||||
ASSERT_TRUE(Open(p.fileName));
|
||||
EncodeStream(this, CAMERA_VIDEO_REAL_TIME,p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
|
||||
ASSERT_TRUE (Open (p.fileName));
|
||||
EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
|
||||
unsigned char digest[SHA_DIGEST_LENGTH];
|
||||
SHA1Result(&ctx_, digest);
|
||||
SHA1Result (&ctx_, digest);
|
||||
if (!HasFatalFailure()) {
|
||||
CompareHash(digest, p.hashStr);
|
||||
CompareHash (digest, p.hashStr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,5 +108,5 @@ static const DecodeEncodeFileParam kFileParamArray[] = {
|
||||
{"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DecodeEncodeFile, DecodeEncodeTest,
|
||||
::testing::ValuesIn(kFileParamArray));
|
||||
INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest,
|
||||
::testing::ValuesIn (kFileParamArray));
|
||||
|
||||
Reference in New Issue
Block a user