Make video denoiser tests standalone, not using the VideoProcessingTest fixture.

BUG=None

Review-Url: https://codereview.webrtc.org/2464073002
Cr-Commit-Position: refs/heads/master@{#14890}
This commit is contained in:
nisse 2016-11-02 07:11:03 -07:00 committed by Commit bot
parent cb18ee6127
commit 0dbcfa51a2

View File

@ -12,15 +12,15 @@
#include <memory>
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_processing/include/video_processing.h"
#include "webrtc/modules/video_processing/test/video_processing_unittest.h"
#include "webrtc/common_video/include/video_frame_buffer.h"
#include "webrtc/modules/video_processing/video_denoiser.h"
#include "webrtc/test/gtest.h"
#include "webrtc/test/frame_utils.h"
#include "webrtc/test/testsupport/fileutils.h"
namespace webrtc {
TEST_F(VideoProcessingTest, CopyMem) {
TEST(VideoDenoiserTest, CopyMem) {
std::unique_ptr<DenoiserFilter> df_c(DenoiserFilter::Create(false, nullptr));
std::unique_ptr<DenoiserFilter> df_sse_neon(
DenoiserFilter::Create(true, nullptr));
@ -40,7 +40,7 @@ TEST_F(VideoProcessingTest, CopyMem) {
EXPECT_EQ(0, memcmp(src, dst, 16 * 16));
}
TEST_F(VideoProcessingTest, Variance) {
TEST(VideoDenoiserTest, Variance) {
std::unique_ptr<DenoiserFilter> df_c(DenoiserFilter::Create(false, nullptr));
std::unique_ptr<DenoiserFilter> df_sse_neon(
DenoiserFilter::Create(true, nullptr));
@ -64,7 +64,7 @@ TEST_F(VideoProcessingTest, Variance) {
EXPECT_EQ(var, df_sse_neon->Variance16x8(src, 16, dst, 16, &sse));
}
TEST_F(VideoProcessingTest, MbDenoise) {
TEST(VideoDenoiserTest, MbDenoise) {
std::unique_ptr<DenoiserFilter> df_c(DenoiserFilter::Create(false, nullptr));
std::unique_ptr<DenoiserFilter> df_sse_neon(
DenoiserFilter::Create(true, nullptr));
@ -125,9 +125,16 @@ TEST_F(VideoProcessingTest, MbDenoise) {
EXPECT_EQ(COPY_BLOCK, decision);
}
// TODO(nisse): Refactor to not use test fixture. Can use some static
// helper method to open the input file.
TEST_F(VideoProcessingTest, Denoiser) {
TEST(VideoDenoiserTest, Denoiser) {
const int kWidth = 352;
const int kHeight = 288;
const std::string video_file =
webrtc::test::ResourcePath("foreman_cif", "yuv");
FILE* source_file = fopen(video_file.c_str(), "rb");
ASSERT_TRUE(source_file != nullptr)
<< "Cannot open source file: " << video_file;
// Used in swap buffer.
int denoised_frame_toggle = 0;
// Create pure C denoiser.
@ -141,7 +148,7 @@ TEST_F(VideoProcessingTest, Denoiser) {
for (;;) {
rtc::scoped_refptr<VideoFrameBuffer> video_frame_buffer(
test::ReadI420Buffer(width_, height_, source_file_));
test::ReadI420Buffer(kWidth, kHeight, source_file));
if (!video_frame_buffer)
break;
@ -169,7 +176,7 @@ TEST_F(VideoProcessingTest, Denoiser) {
// Denoising results should be the same for C and SSE/NEON denoiser.
ASSERT_TRUE(test::FrameBufsEqual(*p_denoised_c, *p_denoised_sse_neon));
}
ASSERT_NE(0, feof(source_file_)) << "Error reading source file";
ASSERT_NE(0, feof(source_file)) << "Error reading source file";
}
} // namespace webrtc