OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 #include <string.h> | |
11 #include <stdio.h> | |
12 #include <cstring> | |
13 #include <iostream> | |
14 #include <vector> | |
15 | |
16 #include "webrtc/test/gtest.h" | |
17 #include "webrtc/test/testsupport/fileutils.h" | |
18 #include "webrtc/tools/frame_analyzer/reference_less_video_analysis_lib.h" | |
19 | |
20 std::vector<double> psnr_per_frame; | |
21 std::vector<double> ssim_per_frame; | |
22 std::string video_file = | |
23 webrtc::test::ResourcePath("reference_less_video_test_file", "y4m"); | |
kjellander_webrtc
2016/11/28 15:02:08
Please add tests for an invalid test file as well,
| |
24 char video_file_name[200]; | |
25 | |
26 TEST(ReferenceLessVideoAnalysisTest, MatchComputedMetrics) { | |
27 strcpy(video_file_name, video_file.c_str()); | |
28 compute_metrics(video_file_name, &psnr_per_frame, &ssim_per_frame); | |
29 | |
30 EXPECT_EQ(74, (int)psnr_per_frame.size()); | |
31 | |
32 EXPECT_FLOAT_EQ(27.2268, psnr_per_frame[1]); | |
33 EXPECT_FLOAT_EQ(24.980579, psnr_per_frame[5]); | |
34 | |
35 EXPECT_FLOAT_EQ(0.983759, ssim_per_frame[1]); | |
36 EXPECT_FLOAT_EQ(0.979621, ssim_per_frame[5]); | |
37 } | |
38 | |
39 TEST(ReferenceLessVideoAnalysisTest, MatchHeightWidthFps) { | |
40 int height = 0, width = 0, fps = 0; | |
41 strcpy(video_file_name, video_file.c_str()); | |
42 get_height_width_fps(&height, &width, &fps, video_file_name); | |
43 EXPECT_EQ(height, 720); | |
44 EXPECT_EQ(width, 1280); | |
45 EXPECT_EQ(fps, 25); | |
46 } | |
47 | |
48 TEST(ReferenceLessVideoAnalysisTest, MatchIdenticalFrameClusters) { | |
49 std::vector<int> identical_frame_clusters = | |
50 find_frame_clusters(psnr_per_frame, ssim_per_frame); | |
51 EXPECT_EQ(5, (int)identical_frame_clusters.size()); | |
52 EXPECT_EQ(1, identical_frame_clusters[0]); | |
53 EXPECT_EQ(1, identical_frame_clusters[4]); | |
54 } | |
55 | |
56 | |
kjellander_webrtc
2016/11/28 15:02:08
Remove blank lines.
| |
57 | |
58 | |
59 | |
OLD | NEW |