aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/video_processing/main/test
diff options
context:
space:
mode:
authorMiguel Casas-Sanchez <mcasas@webrtc.org>2015-05-29 17:21:40 -0700
committerMiguel Casas-Sanchez <mcasas@webrtc.org>2015-05-30 00:21:56 +0000
commit4765070b8d6f024509c717c04d9b708750666927 (patch)
tree64548980e1c649e9ab2653c3388a29d33cd041ed /webrtc/modules/video_processing/main/test
parentc2cb266c93d5918f7a54fd62c07c387dde9186a2 (diff)
downloadwebrtc-4765070b8d6f024509c717c04d9b708750666927.tar.gz
Rename I420VideoFrame to VideoFrame.
This is a mechanical change since it affects so many files. I420VideoFrame -> VideoFrame and reformatted. Rationale: in the next CL I420VideoFrame will get an indication of Pixel Format (I420 for starters) and of storage type: usually UNOWNED, could be SHMEM, and in the near future will be possibly TEXTURE. See https://codereview.chromium.org/1154153003 for the change that happened in Cr. BUG=4730, chromium:440843 R=jiayl@webrtc.org, niklas.enbom@webrtc.org, pthatcher@webrtc.org Review URL: https://webrtc-codereview.appspot.com/52629004 Cr-Commit-Position: refs/heads/master@{#9339}
Diffstat (limited to 'webrtc/modules/video_processing/main/test')
-rw-r--r--webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc2
-rw-r--r--webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc51
-rw-r--r--webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.h2
3 files changed, 27 insertions, 28 deletions
diff --git a/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc b/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc
index cba1dfc4f8..2a260d2c5c 100644
--- a/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc
+++ b/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc
@@ -70,7 +70,7 @@ TEST_F(VideoProcessingModuleTest, Deflickering)
if (run_idx == 0)
{
- if (PrintI420VideoFrame(video_frame_, deflickerFile) < 0) {
+ if (PrintVideoFrame(video_frame_, deflickerFile) < 0) {
return;
}
}
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 ea71890b34..e17223fd8e 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
@@ -26,11 +26,11 @@ DEFINE_bool(gen_files, false, "Output files for visual inspection.");
} // namespace
-static void PreprocessFrameAndVerify(const I420VideoFrame& source,
+static void PreprocessFrameAndVerify(const VideoFrame& source,
int target_width,
int target_height,
VideoProcessingModule* vpm,
- I420VideoFrame** out_frame);
+ VideoFrame** out_frame);
static void CropFrame(const uint8_t* source_data,
int source_width,
int source_height,
@@ -38,22 +38,21 @@ static void CropFrame(const uint8_t* source_data,
int offset_y,
int cropped_width,
int cropped_height,
- I420VideoFrame* cropped_frame);
+ VideoFrame* cropped_frame);
// The |source_data| is cropped and scaled to |target_width| x |target_height|,
// and then scaled back to the expected cropped size. |expected_psnr| is used to
// verify basic quality, and is set to be ~0.1/0.05dB lower than actual PSNR
// verified under the same conditions.
-static void TestSize(const I420VideoFrame& source_frame,
- const I420VideoFrame& cropped_source_frame,
+static void TestSize(const VideoFrame& source_frame,
+ const VideoFrame& cropped_source_frame,
int target_width,
int target_height,
double expected_psnr,
VideoProcessingModule* vpm);
-static bool CompareFrames(const webrtc::I420VideoFrame& frame1,
- const webrtc::I420VideoFrame& frame2);
-static void WriteProcessedFrameForVisualInspection(
- const I420VideoFrame& source,
- const I420VideoFrame& processed);
+static bool CompareFrames(const webrtc::VideoFrame& frame1,
+ const webrtc::VideoFrame& frame2);
+static void WriteProcessedFrameForVisualInspection(const VideoFrame& source,
+ const VideoFrame& processed);
VideoProcessingModuleTest::VideoProcessingModuleTest()
: vpm_(NULL),
@@ -98,7 +97,7 @@ TEST_F(VideoProcessingModuleTest, HandleNullBuffer) {
// TODO(mikhal/stefan): Do we need this one?
VideoProcessingModule::FrameStats stats;
// Video frame with unallocated buffer.
- I420VideoFrame videoFrame;
+ VideoFrame videoFrame;
EXPECT_EQ(-3, vpm_->GetFrameStats(&stats, videoFrame));
@@ -121,7 +120,7 @@ TEST_F(VideoProcessingModuleTest, HandleBadStats) {
}
TEST_F(VideoProcessingModuleTest, IdenticalResultsAfterReset) {
- I420VideoFrame video_frame2;
+ VideoFrame video_frame2;
VideoProcessingModule::FrameStats stats;
// Only testing non-static functions here.
rtc::scoped_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]);
@@ -184,7 +183,7 @@ TEST_F(VideoProcessingModuleTest, PreprocessorLogic) {
// Disable spatial sampling.
vpm_->SetInputFrameResampleMode(kNoRescaling);
EXPECT_EQ(VPM_OK, vpm_->SetTargetResolution(resolution, resolution, 30));
- I420VideoFrame* out_frame = NULL;
+ VideoFrame* out_frame = NULL;
// Set rescaling => output frame != NULL.
vpm_->SetInputFrameResampleMode(kFastRescaling);
PreprocessFrameAndVerify(video_frame_, resolution, resolution, vpm_,
@@ -218,7 +217,7 @@ TEST_F(VideoProcessingModuleTest, Resampler) {
EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_,
0, kVideoRotation_0, &video_frame_));
// Cropped source frame that will contain the expected visible region.
- I420VideoFrame cropped_source_frame;
+ VideoFrame cropped_source_frame;
cropped_source_frame.CopyFrame(video_frame_);
for (uint32_t run_idx = 0; run_idx < NumRuns; run_idx++) {
@@ -283,11 +282,11 @@ TEST_F(VideoProcessingModuleTest, Resampler) {
static_cast<int>(min_runtime));
}
-void PreprocessFrameAndVerify(const I420VideoFrame& source,
+void PreprocessFrameAndVerify(const VideoFrame& source,
int target_width,
int target_height,
VideoProcessingModule* vpm,
- I420VideoFrame** out_frame) {
+ VideoFrame** out_frame) {
ASSERT_EQ(VPM_OK, vpm->SetTargetResolution(target_width, target_height, 30));
ASSERT_EQ(VPM_OK, vpm->PreprocessFrame(source, out_frame));
@@ -312,7 +311,7 @@ void CropFrame(const uint8_t* source_data,
int offset_y,
int cropped_width,
int cropped_height,
- I420VideoFrame* cropped_frame) {
+ VideoFrame* cropped_frame) {
cropped_frame->CreateEmptyFrame(cropped_width, cropped_height, cropped_width,
(cropped_width + 1) / 2,
(cropped_width + 1) / 2);
@@ -321,14 +320,14 @@ void CropFrame(const uint8_t* source_data,
source_height, 0, kVideoRotation_0, cropped_frame));
}
-void TestSize(const I420VideoFrame& source_frame,
- const I420VideoFrame& cropped_source_frame,
+void TestSize(const VideoFrame& source_frame,
+ const VideoFrame& cropped_source_frame,
int target_width,
int target_height,
double expected_psnr,
VideoProcessingModule* vpm) {
// Resample source_frame to out_frame.
- I420VideoFrame* out_frame = NULL;
+ VideoFrame* out_frame = NULL;
vpm->SetInputFrameResampleMode(kBox);
PreprocessFrameAndVerify(source_frame, target_width, target_height, vpm,
&out_frame);
@@ -337,7 +336,7 @@ void TestSize(const I420VideoFrame& source_frame,
WriteProcessedFrameForVisualInspection(source_frame, *out_frame);
// Scale |resampled_source_frame| back to the source scale.
- I420VideoFrame resampled_source_frame;
+ VideoFrame resampled_source_frame;
resampled_source_frame.CopyFrame(*out_frame);
PreprocessFrameAndVerify(resampled_source_frame, cropped_source_frame.width(),
cropped_source_frame.height(), vpm, &out_frame);
@@ -352,8 +351,8 @@ void TestSize(const I420VideoFrame& source_frame,
target_width, target_height);
}
-bool CompareFrames(const webrtc::I420VideoFrame& frame1,
- const webrtc::I420VideoFrame& frame2) {
+bool CompareFrames(const webrtc::VideoFrame& frame1,
+ const webrtc::VideoFrame& frame2) {
for (int plane = 0; plane < webrtc::kNumOfPlanes; plane ++) {
webrtc::PlaneType plane_type = static_cast<webrtc::PlaneType>(plane);
int allocated_size1 = frame1.allocated_size(plane_type);
@@ -368,8 +367,8 @@ bool CompareFrames(const webrtc::I420VideoFrame& frame1,
return true;
}
-void WriteProcessedFrameForVisualInspection(const I420VideoFrame& source,
- const I420VideoFrame& processed) {
+void WriteProcessedFrameForVisualInspection(const VideoFrame& source,
+ const VideoFrame& processed) {
// Skip if writing to files is not enabled.
if (!FLAGS_gen_files)
return;
@@ -381,7 +380,7 @@ void WriteProcessedFrameForVisualInspection(const I420VideoFrame& source,
std::cout << "Watch " << filename.str() << " and verify that it is okay."
<< std::endl;
FILE* stand_alone_file = fopen(filename.str().c_str(), "wb");
- if (PrintI420VideoFrame(processed, stand_alone_file) < 0)
+ if (PrintVideoFrame(processed, stand_alone_file) < 0)
std::cerr << "Failed to write: " << filename.str() << std::endl;
if (stand_alone_file)
fclose(stand_alone_file);
diff --git a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.h b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.h
index 37e2c02b94..01a5161c33 100644
--- a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.h
+++ b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.h
@@ -33,7 +33,7 @@ class VideoProcessingModuleTest : public ::testing::Test {
}
VideoProcessingModule* vpm_;
FILE* source_file_;
- I420VideoFrame video_frame_;
+ VideoFrame video_frame_;
const int width_;
const int half_width_;
const int height_;