History

astyle all

huili2 committed 12 years ago

Commit dc3fae41 parent 101265385 files · +4906 −4701Browse files

Showing the changes to test/api/decode_encode_test.cpp (1 of 85 files). Show all

Unified · Split

test/api/decode_encode_test.cpp+25−25
@@ -6,21 +6,21 @@ · 5 unmodified lines
66 #include "BaseDecoderTest.h"
77 #include "BaseEncoderTest.h"
88
9−static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) {
9+static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) {
1010 for (int i = 0; i < info.iLayerNum; ++i) {
1111 const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
1212 int layerSize = 0;
1313 for (int j = 0; j < layerInfo.iNalCount; ++j) {
1414 layerSize += layerInfo.pNalLengthInByte[j];
1515 }
16− SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
16+ SHA1Input (ctx, layerInfo.pBsBuf, layerSize);
1717 }
1818 }
1919
20−static void WritePlaneBuffer(BufferedData* buf, const uint8_t* plane,
21− int width, int height, int stride) {
20+static void WritePlaneBuffer (BufferedData* buf, const uint8_t* plane,
21+ int width, int height, int stride) {
2222 for (int i = 0; i < height; i++) {
23− if (!buf->PushBack(plane, width)) {
23+ if (!buf->PushBack (plane, width)) {
2424 FAIL() << "unable to allocate memory";
2525 }
2626 plane += stride;
@@ -36,9 +36,9 @@ struct DecodeEncodeFileParam { · 9 unmodified lines
3636 };
3737
3838 class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
39− public BaseDecoderTest, public BaseDecoderTest::Callback,
40− public BaseEncoderTest , public BaseEncoderTest::Callback,
41− public InputStream {
39+ public BaseDecoderTest, public BaseDecoderTest::Callback,
40+ public BaseEncoderTest , public BaseEncoderTest::Callback,
41+ public InputStream {
4242 public:
4343 virtual void SetUp() {
4444 BaseDecoderTest::SetUp();
@@ -49,7 +49,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 4 unmodified lines
4949 if (HasFatalFailure()) {
5050 return;
5151 }
52− SHA1Reset(&ctx_);
52+ SHA1Reset (&ctx_);
5353 }
5454
5555 virtual void TearDown() {
@@ -57,22 +57,22 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 1 unmodified line
5757 BaseEncoderTest::TearDown();
5858 }
5959
60− virtual void onDecodeFrame(const Frame& frame) {
60+ virtual void onDecodeFrame (const Frame& frame) {
6161 const Plane& y = frame.y;
6262 const Plane& u = frame.u;
6363 const Plane& v = frame.v;
64− WritePlaneBuffer(&buf_, y.data, y.width, y.height, y.stride);
65− WritePlaneBuffer(&buf_, u.data, u.width, u.height, u.stride);
66− WritePlaneBuffer(&buf_, v.data, v.width, v.height, v.stride);
64+ WritePlaneBuffer (&buf_, y.data, y.width, y.height, y.stride);
65+ WritePlaneBuffer (&buf_, u.data, u.width, u.height, u.stride);
66+ WritePlaneBuffer (&buf_, v.data, v.width, v.height, v.stride);
6767 }
6868
69− virtual void onEncodeFrame(const SFrameBSInfo& frameInfo) {
70− UpdateHashFromFrame(frameInfo, &ctx_);
69+ virtual void onEncodeFrame (const SFrameBSInfo& frameInfo) {
70+ UpdateHashFromFrame (frameInfo, &ctx_);
7171 }
7272
73− virtual int read(void* ptr, size_t len) {
73+ virtual int read (void* ptr, size_t len) {
7474 while (buf_.Length() < len) {
75− bool hasNext = DecodeNextFrame(this);
75+ bool hasNext = DecodeNextFrame (this);
7676 if (HasFatalFailure()) {
7777 return -1;
7878 }
@@ -83,7 +83,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 4 unmodified lines
8383 break;
8484 }
8585 }
86− return buf_.PopFront(static_cast<uint8_t*>(ptr), len);
86+ return buf_.PopFront (static_cast<uint8_t*> (ptr), len);
8787 }
8888
8989 protected:
@@ -91,15 +91,15 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 1 unmodified line
9191 BufferedData buf_;
9292 };
9393
94−TEST_P(DecodeEncodeTest, CompareOutput) {
94+TEST_P (DecodeEncodeTest, CompareOutput) {
9595 DecodeEncodeFileParam p = GetParam();
9696
97− ASSERT_TRUE(Open(p.fileName));
98− EncodeStream(this, CAMERA_VIDEO_REAL_TIME,p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
97+ ASSERT_TRUE (Open (p.fileName));
98+ EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
9999 unsigned char digest[SHA_DIGEST_LENGTH];
100− SHA1Result(&ctx_, digest);
100+ SHA1Result (&ctx_, digest);
101101 if (!HasFatalFailure()) {
102− CompareHash(digest, p.hashStr);
102+ CompareHash (digest, p.hashStr);
103103 }
104104 }
105105
@@ -108,5 +108,5 @@ static const DecodeEncodeFileParam kFileParamArray[] = { · 2 unmodified lines
108108 {"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f},
109109 };
110110
111−INSTANTIATE_TEST_CASE_P(DecodeEncodeFile, DecodeEncodeTest,
112− ::testing::ValuesIn(kFileParamArray));
111+INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest,
112+ ::testing::ValuesIn (kFileParamArray));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t