Showing the changes to test/api/decode_encode_test.cpp (1 of 85 files). Show all
Unified · Split
| @@ -6,21 +6,21 @@ · 5 unmodified lines | ||
| 6 | 6 | #include "BaseDecoderTest.h" |
| 7 | 7 | #include "BaseEncoderTest.h" |
| 8 | 8 | |
| 9 | −static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) { | |
| 9 | +static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) { | |
| 10 | 10 | for (int i = 0; i < info.iLayerNum; ++i) { |
| 11 | 11 | const SLayerBSInfo& layerInfo = info.sLayerInfo[i]; |
| 12 | 12 | int layerSize = 0; |
| 13 | 13 | for (int j = 0; j < layerInfo.iNalCount; ++j) { |
| 14 | 14 | layerSize += layerInfo.pNalLengthInByte[j]; |
| 15 | 15 | } |
| 16 | − SHA1Input(ctx, layerInfo.pBsBuf, layerSize); | |
| 16 | + SHA1Input (ctx, layerInfo.pBsBuf, layerSize); | |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 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) { | |
| 22 | 22 | for (int i = 0; i < height; i++) { |
| 23 | − if (!buf->PushBack(plane, width)) { | |
| 23 | + if (!buf->PushBack (plane, width)) { | |
| 24 | 24 | FAIL() << "unable to allocate memory"; |
| 25 | 25 | } |
| 26 | 26 | plane += stride; |
| @@ -36,9 +36,9 @@ struct DecodeEncodeFileParam { · 9 unmodified lines | ||
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | 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 { | |
| 42 | 42 | public: |
| 43 | 43 | virtual void SetUp() { |
| 44 | 44 | BaseDecoderTest::SetUp(); |
| @@ -49,7 +49,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 4 unmodified lines | ||
| 49 | 49 | if (HasFatalFailure()) { |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | − SHA1Reset(&ctx_); | |
| 52 | + SHA1Reset (&ctx_); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | virtual void TearDown() { |
| @@ -57,22 +57,22 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 1 unmodified line | ||
| 57 | 57 | BaseEncoderTest::TearDown(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | − virtual void onDecodeFrame(const Frame& frame) { | |
| 60 | + virtual void onDecodeFrame (const Frame& frame) { | |
| 61 | 61 | const Plane& y = frame.y; |
| 62 | 62 | const Plane& u = frame.u; |
| 63 | 63 | 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); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | − virtual void onEncodeFrame(const SFrameBSInfo& frameInfo) { | |
| 70 | − UpdateHashFromFrame(frameInfo, &ctx_); | |
| 69 | + virtual void onEncodeFrame (const SFrameBSInfo& frameInfo) { | |
| 70 | + UpdateHashFromFrame (frameInfo, &ctx_); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | − virtual int read(void* ptr, size_t len) { | |
| 73 | + virtual int read (void* ptr, size_t len) { | |
| 74 | 74 | while (buf_.Length() < len) { |
| 75 | − bool hasNext = DecodeNextFrame(this); | |
| 75 | + bool hasNext = DecodeNextFrame (this); | |
| 76 | 76 | if (HasFatalFailure()) { |
| 77 | 77 | return -1; |
| 78 | 78 | } |
| @@ -83,7 +83,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 4 unmodified lines | ||
| 83 | 83 | break; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | − return buf_.PopFront(static_cast<uint8_t*>(ptr), len); | |
| 86 | + return buf_.PopFront (static_cast<uint8_t*> (ptr), len); | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | protected: |
| @@ -91,15 +91,15 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 1 unmodified line | ||
| 91 | 91 | BufferedData buf_; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | −TEST_P(DecodeEncodeTest, CompareOutput) { | |
| 94 | +TEST_P (DecodeEncodeTest, CompareOutput) { | |
| 95 | 95 | DecodeEncodeFileParam p = GetParam(); |
| 96 | 96 | |
| 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); | |
| 99 | 99 | unsigned char digest[SHA_DIGEST_LENGTH]; |
| 100 | − SHA1Result(&ctx_, digest); | |
| 100 | + SHA1Result (&ctx_, digest); | |
| 101 | 101 | if (!HasFatalFailure()) { |
| 102 | − CompareHash(digest, p.hashStr); | |
| 102 | + CompareHash (digest, p.hashStr); | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| @@ -108,5 +108,5 @@ static const DecodeEncodeFileParam kFileParamArray[] = { · 2 unmodified lines | ||
| 108 | 108 | {"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f}, |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | −INSTANTIATE_TEST_CASE_P(DecodeEncodeFile, DecodeEncodeTest, | |
| 112 | − ::testing::ValuesIn(kFileParamArray)); | |
| 111 | +INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest, | |
| 112 | + ::testing::ValuesIn (kFileParamArray)); | |