webrtc_m130/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc
kjellander@webrtc.org f880f863dd Convert printing in video quality tests to Chromium's perf format.
Add support for --label flag to the frame_analyzer, that
decides what label shall be used for the perf output.

BUG=none
TEST=
Make sure to have zxing and ffmpeg in the PATH.
Create a captured video (from running vie_auto_test custom call)
webrtc/tools/compare_videos.py --ref_video=reference_video.yuv --test_video=captured_output.yuv --frame_analyzer=out/Release/frame_analyzer --label=TEST_VGA
And then inspecting the output that is prefixed with RESULT.

R=phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2190005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4714 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-09-10 12:10:01 +00:00

74 lines
2.5 KiB
C++

/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// This test doesn't actually verify the output since it's just printed
// to stdout by void functions, but it's still useful as it executes the code.
#include <fstream>
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/tools/frame_analyzer/video_quality_analysis.h"
namespace webrtc {
namespace test {
TEST(VideoQualityAnalysisTest, PrintAnalysisResultsEmpty) {
ResultsContainer result;
PrintAnalysisResults("Empty", &result);
}
TEST(VideoQualityAnalysisTest, PrintAnalysisResultsOneFrame) {
ResultsContainer result;
result.frames.push_back(AnalysisResult(0, 35.0, 0.9));
PrintAnalysisResults("OneFrame", &result);
}
TEST(VideoQualityAnalysisTest, PrintAnalysisResultsThreeFrames) {
ResultsContainer result;
result.frames.push_back(AnalysisResult(0, 35.0, 0.9));
result.frames.push_back(AnalysisResult(1, 34.0, 0.8));
result.frames.push_back(AnalysisResult(2, 33.0, 0.7));
PrintAnalysisResults("ThreeFrames", &result);
}
TEST(VideoQualityAnalysisTest, PrintMaxRepeatedAndSkippedFramesInvalidFile) {
std::string stats_filename = OutputPath() + "non-existing-stats-file.txt";
remove(stats_filename.c_str());
PrintMaxRepeatedAndSkippedFrames("NonExistingStatsFile", stats_filename);
}
TEST(VideoQualityAnalysisTest, PrintMaxRepeatedAndSkippedFramesEmptyStatsFile) {
std::string stats_filename = OutputPath() + "empty-stats.txt";
std::ofstream stats_file;
stats_file.open(stats_filename.c_str());
stats_file.close();
PrintMaxRepeatedAndSkippedFrames("EmptyStatsFile", stats_filename);
}
TEST(VideoQualityAnalysisTest, PrintMaxRepeatedAndSkippedFramesNormalFile) {
std::string stats_filename = OutputPath() + "stats.txt";
std::ofstream stats_file;
stats_file.open(stats_filename.c_str());
stats_file << "frame_0001 0100\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0101\n";
stats_file << "frame_0004 0106\n";
stats_file.close();
PrintMaxRepeatedAndSkippedFrames("NormalStatsFile", stats_filename);
}
} // namespace test
} // namespace webrtc