Revert "Update video_quality_analysis to align videos instead of using barcodes"

This reverts commit d65e143801a7aaa9affdb939ea836aec1955cdcc.

Reason for revert: Breaks perf bots. frame_analyzer is a prebuilt binary, so it won't automatically pick up changes in the .cc file.

Original change's description:
> Update video_quality_analysis to align videos instead of using barcodes
> 
> This CL is a follow-up to the previous CL
> https://webrtc-review.googlesource.com/c/src/+/94773 that added generic
> logic for aligning videos. This will allow us to easily extend
> video_quality_analysis with new sophisticated video quality metrics.
> Also, we can use any kind of video that does not necessarily need to
> contain bar codes. Removing the need to decode barcodes also leads to a
> big speedup for the tests.
> 
> Bug: webrtc:9642
> Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50
> Reviewed-on: https://webrtc-review.googlesource.com/94845
> Reviewed-by: Paulina Hensman <phensman@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#24423}

TBR=phoglund@webrtc.org,magjed@webrtc.org,phensman@webrtc.org

Change-Id: Ia590b465687b861fe37ed1b14756d4607ca90da1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9642
Reviewed-on: https://webrtc-review.googlesource.com/95946
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24428}
This commit is contained in:
Magnus Jedvert
2018-08-24 12:44:59 +00:00
committed by Commit Bot
parent a1cceca02c
commit 3e169ac18c
14 changed files with 1636 additions and 138 deletions

View File

@ -31,9 +31,14 @@ class VideoQualityAnalysisTest : public ::testing::Test {
"VideoQualityAnalysisTest.log");
logfile_ = fopen(log_filename.c_str(), "w");
ASSERT_TRUE(logfile_ != NULL);
stats_filename_ref_ = TempFilename(OutputPath(), "stats-1.txt");
stats_filename_ = TempFilename(OutputPath(), "stats-2.txt");
}
void TearDown() { ASSERT_EQ(0, fclose(logfile_)); }
FILE* logfile_;
std::string stats_filename_ref_;
std::string stats_filename_;
};
TEST_F(VideoQualityAnalysisTest, PrintAnalysisResultsEmpty) {
@ -55,6 +60,46 @@ TEST_F(VideoQualityAnalysisTest, PrintAnalysisResultsThreeFrames) {
PrintAnalysisResults(logfile_, "ThreeFrames", &result);
}
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedAndSkippedFramesInvalidFile) {
ResultsContainer result;
remove(stats_filename_.c_str());
GetMaxRepeatedAndSkippedFrames(stats_filename_ref_, stats_filename_, &result);
}
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedAndSkippedFramesEmptyStatsFile) {
ResultsContainer result;
std::ofstream stats_file;
stats_file.open(stats_filename_ref_.c_str());
stats_file.close();
stats_file.open(stats_filename_.c_str());
stats_file.close();
GetMaxRepeatedAndSkippedFrames(stats_filename_ref_, stats_filename_, &result);
}
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedAndSkippedFramesNormalFile) {
ResultsContainer result;
std::ofstream stats_file;
stats_file.open(stats_filename_ref_.c_str());
stats_file << "frame_0001 0100\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0102\n";
stats_file << "frame_0004 0103\n";
stats_file << "frame_0005 0106\n";
stats_file << "frame_0006 0107\n";
stats_file << "frame_0007 0108\n";
stats_file.close();
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();
GetMaxRepeatedAndSkippedFrames(stats_filename_ref_, stats_filename_, &result);
}
namespace {
void VerifyLogOutput(const std::string& log_filename,
const std::vector<std::string>& expected_out) {
@ -72,18 +117,35 @@ void VerifyLogOutput(const std::string& log_filename,
TEST_F(VideoQualityAnalysisTest,
PrintMaxRepeatedAndSkippedFramesSkippedFrames) {
ResultsContainer result;
std::ofstream stats_file;
std::string log_filename =
TempFilename(webrtc::test::OutputPath(), "log.log");
FILE* logfile = fopen(log_filename.c_str(), "w");
ASSERT_TRUE(logfile != NULL);
stats_file.open(stats_filename_ref_.c_str());
stats_file << "frame_0001 0100\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0103\n";
stats_file << "frame_0004 0103\n";
stats_file << "frame_0005 0106\n";
stats_file << "frame_0006 0106\n";
stats_file << "frame_0007 0108\n";
stats_file << "frame_0008 0110\n";
stats_file << "frame_0009 0112\n";
stats_file.close();
result.max_repeated_frames = 2;
result.max_skipped_frames = 2;
result.total_skipped_frames = 3;
result.decode_errors_ref = 0;
result.decode_errors_test = 0;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0101\n";
stats_file << "frame_0004 0108\n";
stats_file << "frame_0005 0108\n";
stats_file << "frame_0006 0112\n";
stats_file.close();
GetMaxRepeatedAndSkippedFrames(stats_filename_ref_, stats_filename_, &result);
PrintAnalysisResults(logfile, "NormalStatsFile", &result);
ASSERT_EQ(0, fclose(logfile));
@ -99,17 +161,35 @@ TEST_F(VideoQualityAnalysisTest,
TEST_F(VideoQualityAnalysisTest,
PrintMaxRepeatedAndSkippedFramesDecodeErrorInTest) {
ResultsContainer result;
std::ofstream stats_file;
std::string log_filename =
TempFilename(webrtc::test::OutputPath(), "log.log");
FILE* logfile = fopen(log_filename.c_str(), "w");
ASSERT_TRUE(logfile != NULL);
stats_file.open(stats_filename_ref_.c_str());
stats_file << "frame_0001 0100\n";
stats_file << "frame_0002 0100\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0103\n";
stats_file << "frame_0004 0103\n";
stats_file << "frame_0005 0106\n";
stats_file << "frame_0006 0107\n";
stats_file << "frame_0007 0107\n";
stats_file << "frame_0008 0110\n";
stats_file << "frame_0009 0112\n";
stats_file.close();
result.max_repeated_frames = 1;
result.max_skipped_frames = 0;
result.total_skipped_frames = 0;
result.decode_errors_ref = 0;
result.decode_errors_test = 3;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file << "frame_0002 Barcode error\n";
stats_file << "frame_0003 Barcode error\n";
stats_file << "frame_0004 Barcode error\n";
stats_file << "frame_0005 0107\n";
stats_file << "frame_0006 0110\n";
stats_file.close();
GetMaxRepeatedAndSkippedFrames(stats_filename_ref_, stats_filename_, &result);
PrintAnalysisResults(logfile, "NormalStatsFile", &result);
ASSERT_EQ(0, fclose(logfile));
@ -122,42 +202,114 @@ TEST_F(VideoQualityAnalysisTest,
VerifyLogOutput(log_filename, expected_out);
}
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedFramesOneValue) {
EXPECT_EQ(1, GetMaxRepeatedFrames(CalculateFrameClusters({1})));
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersOneValue) {
std::ofstream stats_file;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file.close();
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected = {std::make_pair(101, 1)};
ASSERT_EQ(expected, clusters);
}
TEST_F(VideoQualityAnalysisTest, GetMaxSkippedFramesOneValue) {
EXPECT_EQ(0, GetMaxSkippedFrames(CalculateFrameClusters({1})));
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersOneOneTwo) {
std::ofstream stats_file;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 0102\n";
stats_file.close();
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected = {std::make_pair(101, 2),
std::make_pair(102, 1)};
ASSERT_EQ(expected, clusters);
}
TEST_F(VideoQualityAnalysisTest, GetTotalNumberOfSkippedFramesOneValue) {
EXPECT_EQ(0, GetTotalNumberOfSkippedFrames(CalculateFrameClusters({1})));
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersOneOneErrErrThree) {
std::ofstream stats_file;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 Barcode error\n";
stats_file << "frame_0004 Barcode error\n";
stats_file << "frame_0005 0103\n";
stats_file.close();
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected = {std::make_pair(101, 2),
std::make_pair(DECODE_ERROR, 2),
std::make_pair(103, 1)};
ASSERT_EQ(expected, clusters);
}
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedFramesOneOneTwo) {
EXPECT_EQ(2, GetMaxRepeatedFrames(CalculateFrameClusters({1, 1, 2})));
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersErrErr) {
std::ofstream stats_file;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 Barcode error\n";
stats_file << "frame_0002 Barcode error\n";
stats_file.close();
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected = {std::make_pair(DECODE_ERROR, 2)};
ASSERT_EQ(expected, clusters);
}
TEST_F(VideoQualityAnalysisTest, GetMaxSkippedFramesOneOneTwo) {
EXPECT_EQ(0, GetMaxSkippedFrames(CalculateFrameClusters({1, 1, 2})));
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersOneOneErrErrOneOne) {
std::ofstream stats_file;
stats_file.open(stats_filename_.c_str());
stats_file << "frame_0001 0101\n";
stats_file << "frame_0002 0101\n";
stats_file << "frame_0003 Barcode error\n";
stats_file << "frame_0004 Barcode error\n";
stats_file << "frame_0005 0101\n";
stats_file << "frame_0006 0101\n";
stats_file.close();
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected = {std::make_pair(101, 6)};
ASSERT_EQ(expected, clusters);
}
TEST_F(VideoQualityAnalysisTest, GetTotalNumberOfSkippedFramesOneOneTwo) {
EXPECT_EQ(0,
GetTotalNumberOfSkippedFrames(CalculateFrameClusters({1, 1, 2})));
}
TEST_F(VideoQualityAnalysisTest, CalculateFrameClustersEmpty) {
std::ofstream stats_file;
TEST_F(VideoQualityAnalysisTest, GetMaxRepeatedFramesEmpty) {
EXPECT_EQ(0, GetMaxRepeatedFrames({}));
}
stats_file.open(stats_filename_.c_str());
stats_file.close();
TEST_F(VideoQualityAnalysisTest, GetMaxSkippedFramesEmpty) {
EXPECT_EQ(0, GetMaxSkippedFrames({}));
}
FILE* stats_filef = fopen(stats_filename_.c_str(), "r");
ASSERT_TRUE(stats_filef != NULL);
TEST_F(VideoQualityAnalysisTest, GetTotalNumberOfSkippedFramesEmpty) {
EXPECT_EQ(0, GetTotalNumberOfSkippedFrames({}));
auto clusters = CalculateFrameClusters(stats_filef, nullptr);
ASSERT_EQ(0, fclose(stats_filef));
decltype(clusters) expected;
ASSERT_EQ(expected, clusters);
}
} // namespace test
} // namespace webrtc