| @@ -4,18 +4,18 @@ · 3 unmodified lines |
| 4 | #include "vp9/simple_encode.h" | 4 | #include "vp9/simple_encode.h" |
| 5 | | 5 | |
| 6 | namespace { | 6 | namespace { |
| | 7 | const int w = 352; |
| | 8 | const int h = 288; |
| | 9 | const int frame_rate_num = 30; |
| | 10 | const int frame_rate_den = 1; |
| | 11 | const int target_bitrate = 1000; |
| | 12 | const int num_frames = 17; |
| | 13 | // TODO(angiebird): Figure out how to upload test video to our codebase |
| | 14 | const char infile_path[] = "bus_352x288_420_f20_b8.yuv"; |
| 7 | | 15 | |
| 8 | TEST(SimpleEncode, ComputeFirstPassStats) { | 16 | TEST(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, | 17 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, |
| 18 | target_bitrate, num_frames, file); | 18 | target_bitrate, num_frames, infile_path); |
| 19 | simple_encode.ComputeFirstPassStats(); | 19 | simple_encode.ComputeFirstPassStats(); |
| 20 | std::vector<std::vector<double>> frame_stats = | 20 | std::vector<std::vector<double>> frame_stats = |
| 21 | simple_encode.ObserveFirstPassStats(); | 21 | simple_encode.ObserveFirstPassStats(); |
| @@ -34,32 +34,16 @@ TEST(SimpleEncode, ComputeFirstPassStats) { · 12 unmodified lines |
| 34 | } | 34 | } |
| 35 | | 35 | |
| 36 | TEST(SimpleEncode, GetCodingFrameNum) { | 36 | TEST(SimpleEncode, GetCodingFrameNum) { |
| 37 | int w = 352; | | |
| 38 | int h = 288; | | |
| 39 | int frame_rate_num = 30; | | |
| 40 | int frame_rate_den = 1; | | |
| 41 | int target_bitrate = 200; | | |
| 42 | int num_frames = 17; | | |
| 43 | // TODO(angiebird): Figure out how to upload test video to our codebase | | |
| 44 | FILE *file = fopen("bus_352x288_420_f20_b8.yuv", "r"); | | |
| 45 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, | 37 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, |
| 46 | target_bitrate, num_frames, file); | 38 | target_bitrate, num_frames, infile_path); |
| 47 | simple_encode.ComputeFirstPassStats(); | 39 | simple_encode.ComputeFirstPassStats(); |
| 48 | int num_coding_frames = simple_encode.GetCodingFrameNum(); | 40 | int num_coding_frames = simple_encode.GetCodingFrameNum(); |
| 49 | EXPECT_EQ(num_coding_frames, 19); | 41 | EXPECT_EQ(num_coding_frames, 19); |
| 50 | } | 42 | } |
| 51 | | 43 | |
| 52 | TEST(SimpleEncode, EncodeFrame) { | 44 | TEST(SimpleEncode, EncodeFrame) { |
| 53 | int w = 352; | | |
| 54 | int h = 288; | | |
| 55 | int frame_rate_num = 30; | | |
| 56 | int frame_rate_den = 1; | | |
| 57 | int target_bitrate = 1000; | | |
| 58 | int num_frames = 17; | | |
| 59 | // TODO(angiebird): Figure out how to upload test video to our codebase | | |
| 60 | FILE *file = fopen("bus_352x288_420_f20_b8.yuv", "r"); | | |
| 61 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, | 45 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, |
| 62 | target_bitrate, num_frames, file); | 46 | target_bitrate, num_frames, infile_path); |
| 63 | simple_encode.ComputeFirstPassStats(); | 47 | simple_encode.ComputeFirstPassStats(); |
| 64 | int num_coding_frames = simple_encode.GetCodingFrameNum(); | 48 | int num_coding_frames = simple_encode.GetCodingFrameNum(); |
| 65 | EXPECT_GE(num_coding_frames, num_frames); | 49 | EXPECT_GE(num_coding_frames, num_frames); |
| @@ -94,16 +78,8 @@ TEST(SimpleEncode, EncodeFrame) { · 28 unmodified lines |
| 94 | } | 78 | } |
| 95 | | 79 | |
| 96 | TEST(SimpleEncode, EncodeFrameWithQuantizeIndex) { | 80 | TEST(SimpleEncode, EncodeFrameWithQuantizeIndex) { |
| 97 | int w = 352; | | |
| 98 | int h = 288; | | |
| 99 | int frame_rate_num = 30; | | |
| 100 | int frame_rate_den = 1; | | |
| 101 | int target_bitrate = 1000; | | |
| 102 | int num_frames = 17; | | |
| 103 | // TODO(angiebird): Figure out how to upload test video to our codebase | | |
| 104 | FILE *file = fopen("bus_352x288_420_f20_b8.yuv", "r"); | | |
| 105 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, | 81 | SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den, |
| 106 | target_bitrate, num_frames, file); | 82 | target_bitrate, num_frames, infile_path); |
| 107 | simple_encode.ComputeFirstPassStats(); | 83 | simple_encode.ComputeFirstPassStats(); |
| 108 | int num_coding_frames = simple_encode.GetCodingFrameNum(); | 84 | int num_coding_frames = simple_encode.GetCodingFrameNum(); |
| 109 | simple_encode.StartEncode(); | 85 | simple_encode.StartEncode(); |