From 7cd16b03b2cdd6ee55a5b9d4ceec679997402245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 28 May 2015 14:44:28 +0200 Subject: [PATCH] video_processing_unittest: Only create files for visual inspection if the boolean flag 'gen_files' is set. BUG=4648 R=henrik.lundin@webrtc.org, kjellander@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/56399004 Cr-Commit-Position: refs/heads/master@{#9313} --- .../test/unit_test/video_processing_unittest.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc index 6557d0f385..ea71890b34 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc @@ -12,12 +12,20 @@ #include +#include #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" #include "webrtc/system_wrappers/interface/tick_util.h" #include "webrtc/test/testsupport/fileutils.h" namespace webrtc { +namespace { + +// Define command line flag 'gen_files' (default value: false). +DEFINE_bool(gen_files, false, "Output files for visual inspection."); + +} // namespace + static void PreprocessFrameAndVerify(const I420VideoFrame& source, int target_width, int target_height, @@ -41,8 +49,8 @@ static void TestSize(const I420VideoFrame& source_frame, int target_height, double expected_psnr, VideoProcessingModule* vpm); -bool CompareFrames(const webrtc::I420VideoFrame& frame1, - const webrtc::I420VideoFrame& frame2); +static bool CompareFrames(const webrtc::I420VideoFrame& frame1, + const webrtc::I420VideoFrame& frame2); static void WriteProcessedFrameForVisualInspection( const I420VideoFrame& source, const I420VideoFrame& processed); @@ -362,6 +370,9 @@ bool CompareFrames(const webrtc::I420VideoFrame& frame1, void WriteProcessedFrameForVisualInspection(const I420VideoFrame& source, const I420VideoFrame& processed) { + // Skip if writing to files is not enabled. + if (!FLAGS_gen_files) + return; // Write the processed frame to file for visual inspection. std::ostringstream filename; filename << webrtc::test::OutputPath() << "Resampler_from_" << source.width()