History

astyle all

huili2 committed 12 years ago

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

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

Unified · Split

test/api/encoder_test.cpp+34−34
@@ -2,14 +2,14 @@ · 1 unmodified line
2#include "utils/HashFunctions.h"2#include "utils/HashFunctions.h"
3#include "BaseEncoderTest.h"3#include "BaseEncoderTest.h"
4 4
5static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) {5static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) {
6 for (int i = 0; i < info.iLayerNum; ++i) {6 for (int i = 0; i < info.iLayerNum; ++i) {
7 const SLayerBSInfo& layerInfo = info.sLayerInfo[i];7 const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
8 int layerSize = 0;8 int layerSize = 0;
9 for (int j = 0; j < layerInfo.iNalCount; ++j) {9 for (int j = 0; j < layerInfo.iNalCount; ++j) {
10 layerSize += layerInfo.pNalLengthInByte[j];10 layerSize += layerInfo.pNalLengthInByte[j];
11 }11 }
12 SHA1Input(ctx, layerInfo.pBsBuf, layerSize);12 SHA1Input (ctx, layerInfo.pBsBuf, layerSize);
13 }13 }
14}14}
15 15
@@ -23,7 +23,7 @@ class EncoderInitTest : public ::testing::Test, public BaseEncoderTest { · 7 unmodified lines
23 }23 }
24};24};
25 25
26TEST_F(EncoderInitTest, JustInit) {}26TEST_F (EncoderInitTest, JustInit) {}
27 27
28struct EncodeFileParam {28struct EncodeFileParam {
29 const char* fileName;29 const char* fileName;
@@ -38,80 +38,80 @@ struct EncodeFileParam { · 8 unmodified lines
38};38};
39 39
40class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,40class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
41 public EncoderInitTest , public BaseEncoderTest::Callback {41 public EncoderInitTest , public BaseEncoderTest::Callback {
42 public:42 public:
43 virtual void SetUp() {43 virtual void SetUp() {
44 EncoderInitTest::SetUp();44 EncoderInitTest::SetUp();
45 if (HasFatalFailure()) {45 if (HasFatalFailure()) {
46 return;46 return;
47 }47 }
48 SHA1Reset(&ctx_);48 SHA1Reset (&ctx_);
49 }49 }
50 virtual void onEncodeFrame(const SFrameBSInfo& frameInfo) {50 virtual void onEncodeFrame (const SFrameBSInfo& frameInfo) {
51 UpdateHashFromFrame(frameInfo, &ctx_);51 UpdateHashFromFrame (frameInfo, &ctx_);
52 }52 }
53 protected:53 protected:
54 SHA1Context ctx_;54 SHA1Context ctx_;
55};55};
56 56
57 57
58TEST_P(EncoderOutputTest, CompareOutput) {58TEST_P (EncoderOutputTest, CompareOutput) {
59 EncodeFileParam p = GetParam();59 EncodeFileParam p = GetParam();
60 EncodeFile(p.fileName, p.usageType ,p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);60 EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);
61 61
62 //will remove this after screen content algorithms are ready,62 //will remove this after screen content algorithms are ready,
63 //because the bitstream output will vary when the different algorithms are added.63 //because the bitstream output will vary when the different algorithms are added.
64 if(p.usageType == SCREEN_CONTENT_REAL_TIME)64 if (p.usageType == SCREEN_CONTENT_REAL_TIME)
65 return;65 return;
66 unsigned char digest[SHA_DIGEST_LENGTH];66 unsigned char digest[SHA_DIGEST_LENGTH];
67 SHA1Result(&ctx_, digest);67 SHA1Result (&ctx_, digest);
68 if (!HasFatalFailure()) {68 if (!HasFatalFailure()) {
69 CompareHash(digest, p.hashStr);69 CompareHash (digest, p.hashStr);
70 }70 }
71}71}
72 72
73static const EncodeFileParam kFileParamArray[] = {73static const EncodeFileParam kFileParamArray[] = {
74 {74 {
75 "res/CiscoVT2people_320x192_12fps.yuv",75 "res/CiscoVT2people_320x192_12fps.yuv",
76 "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 176 "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
77 },77 },
78 {78 {
79 "res/CiscoVT2people_160x96_6fps.yuv",79 "res/CiscoVT2people_160x96_6fps.yuv",
80 "73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 180 "73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
81 },81 },
82 {82 {
83 "res/Static_152_100.yuv",83 "res/Static_152_100.yuv",
84 "83db4c0e3006bbe039bd327b6e78c57fbb05316f", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 184 "83db4c0e3006bbe039bd327b6e78c57fbb05316f", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
85 },85 },
86 {86 {
87 "res/CiscoVT2people_320x192_12fps.yuv",87 "res/CiscoVT2people_320x192_12fps.yuv",
88 "c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1 // One slice per MB row88 "c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1 // One slice per MB row
89 },89 },
90 {90 {
91 "res/CiscoVT2people_320x192_12fps.yuv",91 "res/CiscoVT2people_320x192_12fps.yuv",
92 "e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 192 "e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1
93 },93 },
94 {94 {
95 "res/CiscoVT2people_320x192_12fps.yuv",95 "res/CiscoVT2people_320x192_12fps.yuv",
96 "684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 296 "684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2
97 },97 },
98 {98 {
99 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",99 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
100 "6df1ece77c0de63cdf8ab52ccef3a7d139022717", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1100 "6df1ece77c0de63cdf8ab52ccef3a7d139022717", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1
101 },101 },
102 {102 {
103 "res/CiscoVT2people_320x192_12fps.yuv",103 "res/CiscoVT2people_320x192_12fps.yuv",
104 "", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1104 "", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
105 },105 },
106 {106 {
107 "res/CiscoVT2people_160x96_6fps.yuv",107 "res/CiscoVT2people_160x96_6fps.yuv",
108 "", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1108 "", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
109 },109 },
110 {110 {
111 "res/Static_152_100.yuv",111 "res/Static_152_100.yuv",
112 "", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1112 "", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
113 }113 }
114};114};
115 115
116INSTANTIATE_TEST_CASE_P(EncodeFile, EncoderOutputTest,116INSTANTIATE_TEST_CASE_P (EncodeFile, EncoderOutputTest,
117 ::testing::ValuesIn(kFileParamArray));117 ::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