diff options
author | Cheng Chen <chengchen@google.com> | 2020-07-29 12:49:51 -0700 |
---|---|---|
committer | Cheng Chen <chengchen@google.com> | 2020-08-03 22:46:38 -0700 |
commit | f9ab864199a7a4d94df8c3ba3492d4feb3cfa90d (patch) | |
tree | f116f17515e496d76940bba5c9ce3ce819a778aa /test | |
parent | 8a8e780b584cef07e3615ff41707145afd429b8a (diff) | |
download | libvpx-f9ab864199a7a4d94df8c3ba3492d4feb3cfa90d.tar libvpx-f9ab864199a7a4d94df8c3ba3492d4feb3cfa90d.tar.gz libvpx-f9ab864199a7a4d94df8c3ba3492d4feb3cfa90d.tar.bz2 libvpx-f9ab864199a7a4d94df8c3ba3492d4feb3cfa90d.zip |
L2E: Add ObserveFirstPassMotionVector
Store motion vectors for each 16x16 block found in the first pass
motion search.
Provide an api "ObserveFirstPassMotionVector()" in SimpleEncode
class, similar to "ObserveFirstPassStats()".
Change-Id: Ia86386b7e4aa549f7000e7965c287380bf52e62c
Diffstat (limited to 'test')
-rw-r--r-- | test/simple_encode_test.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/simple_encode_test.cc b/test/simple_encode_test.cc index 684835168..9a938a8d1 100644 --- a/test/simple_encode_test.cc +++ b/test/simple_encode_test.cc @@ -60,6 +60,27 @@ TEST_F(SimpleEncodeTest, ComputeFirstPassStats) { } } +TEST_F(SimpleEncodeTest, ObserveFirstPassMotionVectors) { + SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_, + target_bitrate_, num_frames_, + in_file_path_str_.c_str()); + simple_encode.ComputeFirstPassStats(); + std::vector<std::vector<MotionVectorInfo>> fps_motion_vectors = + simple_encode.ObserveFirstPassMotionVectors(); + EXPECT_EQ(fps_motion_vectors.size(), static_cast<size_t>(num_frames_)); + const size_t num_blocks = ((width_ + 15) >> 4) * ((height_ + 15) >> 4); + EXPECT_EQ(num_blocks, fps_motion_vectors[0].size()); + for (size_t i = 0; i < fps_motion_vectors.size(); ++i) { + EXPECT_EQ(num_blocks, fps_motion_vectors[i].size()); + for (size_t j = 0; j < num_blocks; ++j) { + const int mv_count = fps_motion_vectors[i][j].mv_count; + const int ref_count = (fps_motion_vectors[i][j].ref_frame[0] > 0) + + (fps_motion_vectors[i][j].ref_frame[1] > 0); + EXPECT_EQ(mv_count, ref_count); + } + } +} + TEST_F(SimpleEncodeTest, GetCodingFrameNum) { SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_, target_bitrate_, num_frames_, |