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

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

Issue 2965593002: Move webrtc/{tools => rtc_tools} (Closed)
Patch Set: Adding back root changes Created 3 years, 5 months 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 class ReferenceLessVideoAnalysisTest : public ::testing::Test {
21 public:
22 void SetUp() override {
23 video_file =
24 webrtc::test::ResourcePath("reference_less_video_test_file", "y4m");
25 }
26 std::string video_file;
27 std::vector<double> psnr_per_frame;
28 std::vector<double> ssim_per_frame;
29 };
30
31 TEST_F(ReferenceLessVideoAnalysisTest, MatchComputedMetrics) {
32 compute_metrics(video_file, &psnr_per_frame, &ssim_per_frame);
33 EXPECT_EQ(74, (int)psnr_per_frame.size());
34
35 ASSERT_NEAR(27.2f, psnr_per_frame[1], 0.1f);
36 ASSERT_NEAR(24.9f, psnr_per_frame[5], 0.1f);
37
38 ASSERT_NEAR(0.9f, ssim_per_frame[1], 0.1f);
39 ASSERT_NEAR(0.9f, ssim_per_frame[5], 0.1f);
40 }
41
42 TEST_F(ReferenceLessVideoAnalysisTest, MatchHeightWidthFps) {
43 int height = 0, width = 0, fps = 0;
44 get_height_width_fps(&height, &width, &fps, video_file.c_str());
45 EXPECT_EQ(height, 720);
46 EXPECT_EQ(width, 1280);
47 EXPECT_EQ(fps, 25);
48 }
49
50 TEST_F(ReferenceLessVideoAnalysisTest, MatchIdenticalFrameClusters) {
51 compute_metrics(video_file, &psnr_per_frame, &ssim_per_frame);
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 TEST_F(ReferenceLessVideoAnalysisTest, CheckFileExtension) {
60 EXPECT_TRUE(check_file_extension(video_file));
61 std::string txt_file =
62 webrtc::test::ResourcePath("video_quality_analysis_frame", "txt");
63 EXPECT_FALSE(check_file_extension(txt_file));
64 }
65
66
67
68
OLDNEW
« no previous file with comments | « webrtc/tools/frame_analyzer/reference_less_video_analysis_lib.cc ('k') | webrtc/tools/frame_analyzer/video_quality_analysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698