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

Unified Diff: webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc

Issue 2529923002: Bug in ExtractFrame API (extracts frames incorrectly) (Closed)
Patch Set: Add missing fclose. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/tools/frame_analyzer/video_quality_analysis.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc
diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc b/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc
index f8a4b6979f16a0a4916578345e544b7440c9c838..85c418185f56a89dfd78aa4d675a44d774e6cdcd 100644
--- a/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc
+++ b/webrtc/tools/frame_analyzer/video_quality_analysis_unittest.cc
@@ -11,6 +11,7 @@
// 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 <stdio.h>
#include <fstream>
#include <string>
@@ -38,6 +39,31 @@ class VideoQualityAnalysisTest : public ::testing::Test {
};
FILE* VideoQualityAnalysisTest::logfile_ = NULL;
+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);
+ delete[] result_frame;
+ delete[] expected_frame;
+}
+
TEST_F(VideoQualityAnalysisTest, PrintAnalysisResultsEmpty) {
ResultsContainer result;
PrintAnalysisResults(logfile_, "Empty", &result);
« no previous file with comments | « webrtc/tools/frame_analyzer/video_quality_analysis.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698