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}
This commit is contained in:
@@ -12,12 +12,20 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||||
#include "webrtc/test/testsupport/fileutils.h"
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
|
|
||||||
namespace webrtc {
|
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,
|
static void PreprocessFrameAndVerify(const I420VideoFrame& source,
|
||||||
int target_width,
|
int target_width,
|
||||||
int target_height,
|
int target_height,
|
||||||
@@ -41,8 +49,8 @@ static void TestSize(const I420VideoFrame& source_frame,
|
|||||||
int target_height,
|
int target_height,
|
||||||
double expected_psnr,
|
double expected_psnr,
|
||||||
VideoProcessingModule* vpm);
|
VideoProcessingModule* vpm);
|
||||||
bool CompareFrames(const webrtc::I420VideoFrame& frame1,
|
static bool CompareFrames(const webrtc::I420VideoFrame& frame1,
|
||||||
const webrtc::I420VideoFrame& frame2);
|
const webrtc::I420VideoFrame& frame2);
|
||||||
static void WriteProcessedFrameForVisualInspection(
|
static void WriteProcessedFrameForVisualInspection(
|
||||||
const I420VideoFrame& source,
|
const I420VideoFrame& source,
|
||||||
const I420VideoFrame& processed);
|
const I420VideoFrame& processed);
|
||||||
@@ -362,6 +370,9 @@ bool CompareFrames(const webrtc::I420VideoFrame& frame1,
|
|||||||
|
|
||||||
void WriteProcessedFrameForVisualInspection(const I420VideoFrame& source,
|
void WriteProcessedFrameForVisualInspection(const I420VideoFrame& source,
|
||||||
const I420VideoFrame& processed) {
|
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.
|
// Write the processed frame to file for visual inspection.
|
||||||
std::ostringstream filename;
|
std::ostringstream filename;
|
||||||
filename << webrtc::test::OutputPath() << "Resampler_from_" << source.width()
|
filename << webrtc::test::OutputPath() << "Resampler_from_" << source.width()
|
||||||
|
Reference in New Issue
Block a user