diff options
author | jackychen <jackychen@google.com> | 2016-01-13 05:36:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-13 13:36:40 +0000 |
commit | a276e731683c673388cf3aeaa1888a5bcc3e1dc0 (patch) | |
tree | 0869826ec471ee4dc475e57075f3b7155c979387 /webrtc/modules | |
parent | 2f7dea164dc49ae8a0322e3c9edb1dd23266c664 (diff) | |
download | webrtc-a276e731683c673388cf3aeaa1888a5bcc3e1dc0.tar.gz |
Clean the code for external denoiser.
BUG=webrtc:5255
Review URL: https://codereview.webrtc.org/1578373003
Cr-Commit-Position: refs/heads/master@{#11235}
Diffstat (limited to 'webrtc/modules')
-rw-r--r-- | webrtc/modules/video_processing/util/denoiser_filter.cc | 19 | ||||
-rw-r--r-- | webrtc/modules/video_processing/util/denoiser_filter.h | 3 |
2 files changed, 13 insertions, 9 deletions
diff --git a/webrtc/modules/video_processing/util/denoiser_filter.cc b/webrtc/modules/video_processing/util/denoiser_filter.cc index 8fead6dd31..fbc2435cb5 100644 --- a/webrtc/modules/video_processing/util/denoiser_filter.cc +++ b/webrtc/modules/video_processing/util/denoiser_filter.cc @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "webrtc/base/checks.h" #include "webrtc/modules/video_processing/util/denoiser_filter.h" #include "webrtc/modules/video_processing/util/denoiser_filter_c.h" #include "webrtc/modules/video_processing/util/denoiser_filter_neon.h" @@ -20,31 +21,33 @@ const int kMotionMagnitudeThreshold = 8 * 3; const int kSumDiffThreshold = 16 * 16 * 2; const int kSumDiffThresholdHigh = 600; -DenoiserFilter* DenoiserFilter::Create(bool runtime_cpu_detection) { - DenoiserFilter* filter = NULL; +rtc::scoped_ptr<DenoiserFilter> DenoiserFilter::Create( + bool runtime_cpu_detection) { + rtc::scoped_ptr<DenoiserFilter> filter; if (runtime_cpu_detection) { // If we know the minimum architecture at compile time, avoid CPU detection. #if defined(WEBRTC_ARCH_X86_FAMILY) // x86 CPU detection required. if (WebRtc_GetCPUInfo(kSSE2)) { - filter = new DenoiserFilterSSE2(); + filter.reset(new DenoiserFilterSSE2()); } else { - filter = new DenoiserFilterC(); + filter.reset(new DenoiserFilterC()); } #elif defined(WEBRTC_DETECT_NEON) if (WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) { - filter = new DenoiserFilterNEON(); + filter.reset(new DenoiserFilterNEON()); } else { - filter = new DenoiserFilterC(); + filter.reset(new DenoiserFilterC()); } #else - filter = new DenoiserFilterC(); + filter.reset(new DenoiserFilterC()); #endif } else { - filter = new DenoiserFilterC(); + filter.reset(new DenoiserFilterC()); } + RTC_DCHECK(filter.get() != nullptr); return filter; } diff --git a/webrtc/modules/video_processing/util/denoiser_filter.h b/webrtc/modules/video_processing/util/denoiser_filter.h index e9bd375a22..5d5a61c59c 100644 --- a/webrtc/modules/video_processing/util/denoiser_filter.h +++ b/webrtc/modules/video_processing/util/denoiser_filter.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_DENOISER_FILTER_H_ #define WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_DENOISER_FILTER_H_ +#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/video_processing/include/video_processing_defines.h" @@ -30,7 +31,7 @@ struct DenoiseMetrics { class DenoiserFilter { public: - static DenoiserFilter* Create(bool runtime_cpu_detection); + static rtc::scoped_ptr<DenoiserFilter> Create(bool runtime_cpu_detection); virtual ~DenoiserFilter() {} |