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

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

Issue 2540893003: Proof of concept using libvpx's y4minput.c (Closed)
Patch Set: Using y4minput.c 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 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 compute_metrics(video_file, &psnr_per_frame, &ssim_per_frame);
26 }
27 std::string video_file;
28 std::vector<double> psnr_per_frame;
29 std::vector<double> ssim_per_frame;
30 };
31
32 TEST_F(ReferenceLessVideoAnalysisTest, MatchComputedMetrics) {
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 std::vector<int> identical_frame_clusters =
52 find_frame_clusters(psnr_per_frame, ssim_per_frame);
53 EXPECT_EQ(5, (int)identical_frame_clusters.size());
54 EXPECT_EQ(1, identical_frame_clusters[0]);
55 EXPECT_EQ(1, identical_frame_clusters[4]);
56 }
57
58 TEST_F(ReferenceLessVideoAnalysisTest, CheckFileExtension) {
59 EXPECT_TRUE(check_file_extension(video_file));
60 }
61
62
63
64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698