Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: webrtc/tools/frame_analyzer/reference_less_video_analysis_unittest.cc

Issue 2515253004: Added tool for reference less video analysis (Closed)
Patch Set: Incorporated Review comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
23 TEST(ReferenceLessVideoAnalysisTest, MatchComputedMetrics) {
24 std::string video_file =
kjellander_webrtc 2016/11/28 15:04:13 Use a ReferenceLessVideoAnalysisTest test fixture
25 webrtc::test::ResourcePath("reference_less_video_test_file", "y4m");
26 char video_file_name[200];
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 std::string video_file =
42 webrtc::test::ResourcePath("reference_less_video_test_file", "y4m");
43 char video_file_name[200];
44 strcpy(video_file_name, video_file.c_str());
45 get_height_width_fps(&height, &width, &fps, video_file_name);
46 EXPECT_EQ(height, 720);
47 EXPECT_EQ(width, 1280);
48 EXPECT_EQ(fps, 25);
49 }
50
51 TEST(ReferenceLessVideoAnalysisTest, MatchIdenticalFrameClusters) {
52 std::vector<int> identical_frame_clusters =
53 find_frame_clusters(psnr_per_frame, ssim_per_frame);
54 EXPECT_EQ(5, (int)identical_frame_clusters.size());
55 EXPECT_EQ(1, identical_frame_clusters[0]);
56 EXPECT_EQ(1, identical_frame_clusters[4]);
57 }
58
59
60
61
62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698