Add Y4mFileReader

Encapsulate logic for reading .y4m video files in a single class. We
currently have spread out logic for opening .y4m files with partial
parsing. This CL consolidates this logic into a single class with a well
defined interface.

Change-Id: Id61673b3c95a0053b30e95b4cf382e1c6b05fc30
Bug: webrtc:9642
Reviewed-on: https://webrtc-review.googlesource.com/94772
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24398}
This commit is contained in:
Magnus Jedvert
2018-08-22 19:23:34 +02:00
committed by Commit Bot
parent 63af828a1b
commit 404be7f302
13 changed files with 543 additions and 382 deletions

View File

@ -41,31 +41,6 @@ class VideoQualityAnalysisTest : public ::testing::Test {
std::string stats_filename_;
};
TEST_F(VideoQualityAnalysisTest, MatchExtractedY4mFrame) {
std::string video_file =
webrtc::test::ResourcePath("reference_less_video_test_file", "y4m");
std::string extracted_frame_from_video_file =
webrtc::test::ResourcePath("video_quality_analysis_frame", "txt");
int frame_height = 720, frame_width = 1280;
int frame_number = 2;
int size = GetI420FrameSize(frame_width, frame_height);
uint8_t* result_frame = new uint8_t[size];
uint8_t* expected_frame = new uint8_t[size];
FILE* input_file = fopen(extracted_frame_from_video_file.c_str(), "rb");
fread(expected_frame, 1, size, input_file);
ExtractFrameFromY4mFile(video_file.c_str(), frame_width, frame_height,
frame_number, result_frame);
EXPECT_EQ(*expected_frame, *result_frame);
fclose(input_file);
delete[] result_frame;
delete[] expected_frame;
}
TEST_F(VideoQualityAnalysisTest, PrintAnalysisResultsEmpty) {
ResultsContainer result;
PrintAnalysisResults(logfile_, "Empty", &result);