History

Add ComputeFirstPassStats()

angiebird committed 7 years ago

Commit 7ee697a1 parent 9f33d7510 files · +241 −23Browse files

Showing the changes to test/simple_encode_test.cc (1 of 10 files). Show all

Unified · Split

test/simple_encode_test.cc+36−0
@@ -0,0 +1,36 @@
1#include <memory>
2#include <vector>
3#include "third_party/googletest/src/include/gtest/gtest.h"
4#include "vp9/simple_encode.h"
5
6namespace {
7
8TEST(SimpleEncode, ComputeFirstPassStats) {
9 int w = 352;
10 int h = 288;
11 int frame_rate_num = 30;
12 int frame_rate_den = 1;
13 int target_bitrate = 200;
14 int num_frames = 17;
15 // TODO(angiebird): Figure out how to upload test video to our codebase
16 FILE *file = fopen("bus_352x288_420_f20_b8.yuv", "r");
17 SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
18 target_bitrate, num_frames, file);
19 simple_encode.ComputeFirstPassStats();
20 std::vector<std::vector<double>> frame_stats =
21 simple_encode.ObserveFirstPassStats();
22 EXPECT_EQ(frame_stats.size(), static_cast<size_t>(num_frames));
23 size_t data_num = frame_stats[0].size();
24 // Read ObserveFirstPassStats before changing FIRSTPASS_STATS.
25 EXPECT_EQ(data_num, static_cast<size_t>(25));
26 for (size_t i = 0; i < frame_stats.size(); ++i) {
27 EXPECT_EQ(frame_stats[i].size(), data_num);
28 // FIRSTPASS_STATS's first element is frame
29 EXPECT_EQ(frame_stats[i][0], i);
30 // FIRSTPASS_STATS's last element is count, and the count is 1 for single
31 // frame stats
32 EXPECT_EQ(frame_stats[i][data_num - 1], 1);
33 }
34}
35
36} // namespace

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