Index: webrtc/modules/video_processing/frame_preprocessor.cc |
diff --git a/webrtc/modules/video_processing/frame_preprocessor.cc b/webrtc/modules/video_processing/frame_preprocessor.cc |
index a3ec3c8c1c617d57c41d5ff3a40952857e4445a4..a26845e6b8503b5ed06565df87e44c2ff7b3fbf3 100644 |
--- a/webrtc/modules/video_processing/frame_preprocessor.cc |
+++ b/webrtc/modules/video_processing/frame_preprocessor.cc |
@@ -9,6 +9,7 @@ |
*/ |
#include "webrtc/modules/video_processing/frame_preprocessor.h" |
+#include "webrtc/modules/video_processing/video_denoiser.h" |
namespace webrtc { |
@@ -16,17 +17,20 @@ VPMFramePreprocessor::VPMFramePreprocessor() |
: content_metrics_(NULL), |
resampled_frame_(), |
enable_ca_(false), |
+ enable_denoising_(false), |
frame_cnt_(0) { |
spatial_resampler_ = new VPMSimpleSpatialResampler(); |
ca_ = new VPMContentAnalysis(true); |
vd_ = new VPMVideoDecimator(); |
+ video_denoiser_ = new VideoDenoiser(); |
} |
VPMFramePreprocessor::~VPMFramePreprocessor() { |
Reset(); |
- delete spatial_resampler_; |
delete ca_; |
delete vd_; |
+ delete video_denoiser_; |
+ delete spatial_resampler_; |
} |
void VPMFramePreprocessor::Reset() { |
@@ -107,8 +111,18 @@ int32_t VPMFramePreprocessor::PreprocessFrame(const VideoFrame& frame, |
// Resizing incoming frame if needed. Otherwise, remains NULL. |
// We are not allowed to resample the input frame (must make a copy of it). |
*processed_frame = NULL; |
+ if (enable_denoising_) { |
+ video_denoiser_->DenoiseFrame(frame, &denoised_frame_); |
+ *processed_frame = &denoised_frame_; |
+ } |
+ |
if (spatial_resampler_->ApplyResample(frame.width(), frame.height())) { |
- int32_t ret = spatial_resampler_->ResampleFrame(frame, &resampled_frame_); |
+ int32_t ret; |
+ if (enable_denoising_) |
stefan-webrtc
2015/11/24 08:56:18
{}
jackychen
2015/11/24 22:33:05
Done.
|
+ ret = spatial_resampler_->ResampleFrame(denoised_frame_, |
+ &resampled_frame_); |
+ else |
stefan-webrtc
2015/11/24 08:56:18
{}
jackychen
2015/11/24 22:33:05
Done.
|
+ ret = spatial_resampler_->ResampleFrame(frame, &resampled_frame_); |
if (ret != VPM_OK) return ret; |
*processed_frame = &resampled_frame_; |
} |
@@ -124,8 +138,8 @@ int32_t VPMFramePreprocessor::PreprocessFrame(const VideoFrame& frame, |
content_metrics_ = ca_->ComputeContentMetrics(resampled_frame_); |
} |
} |
- ++frame_cnt_; |
} |
+ ++frame_cnt_; |
return VPM_OK; |
} |