OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/video_processing/frame_preprocessor.h" | 11 #include "webrtc/modules/video_processing/frame_preprocessor.h" |
12 | 12 |
13 #include "webrtc/modules/video_processing/video_denoiser.h" | 13 #include "webrtc/modules/video_processing/video_denoiser.h" |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 | 16 |
17 VPMFramePreprocessor::VPMFramePreprocessor() | 17 VPMFramePreprocessor::VPMFramePreprocessor() |
18 : content_metrics_(nullptr), | 18 : content_metrics_(nullptr), |
19 resampled_frame_(), | 19 resampled_frame_(), |
20 enable_ca_(false), | 20 enable_ca_(false), |
21 frame_cnt_(0) { | 21 frame_cnt_(0) { |
22 spatial_resampler_ = new VPMSimpleSpatialResampler(); | 22 spatial_resampler_ = new VPMSimpleSpatialResampler(); |
23 ca_ = new VPMContentAnalysis(true); | 23 ca_ = new VPMContentAnalysis(true); |
24 vd_ = new VPMVideoDecimator(); | 24 vd_ = new VPMVideoDecimator(); |
25 EnableDenosing(false); | 25 EnableDenoising(false); |
26 denoised_frame_toggle_ = 0; | 26 denoised_frame_toggle_ = 0; |
27 } | 27 } |
28 | 28 |
29 VPMFramePreprocessor::~VPMFramePreprocessor() { | 29 VPMFramePreprocessor::~VPMFramePreprocessor() { |
30 Reset(); | 30 Reset(); |
31 delete ca_; | 31 delete ca_; |
32 delete vd_; | 32 delete vd_; |
33 delete spatial_resampler_; | 33 delete spatial_resampler_; |
34 } | 34 } |
35 | 35 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 uint32_t VPMFramePreprocessor::GetDecimatedWidth() const { | 91 uint32_t VPMFramePreprocessor::GetDecimatedWidth() const { |
92 return spatial_resampler_->TargetWidth(); | 92 return spatial_resampler_->TargetWidth(); |
93 } | 93 } |
94 | 94 |
95 uint32_t VPMFramePreprocessor::GetDecimatedHeight() const { | 95 uint32_t VPMFramePreprocessor::GetDecimatedHeight() const { |
96 return spatial_resampler_->TargetHeight(); | 96 return spatial_resampler_->TargetHeight(); |
97 } | 97 } |
98 | 98 |
99 void VPMFramePreprocessor::EnableDenosing(bool enable) { | 99 void VPMFramePreprocessor::EnableDenoising(bool enable) { |
100 if (enable) { | 100 if (enable) { |
101 denoiser_.reset(new VideoDenoiser(true)); | 101 denoiser_.reset(new VideoDenoiser(true)); |
102 } else { | 102 } else { |
103 denoiser_.reset(); | 103 denoiser_.reset(); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 const VideoFrame* VPMFramePreprocessor::PreprocessFrame( | 107 const VideoFrame* VPMFramePreprocessor::PreprocessFrame( |
108 const VideoFrame& frame) { | 108 const VideoFrame& frame) { |
109 if (frame.IsZeroSize()) { | 109 if (frame.IsZeroSize()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 ++frame_cnt_; | 149 ++frame_cnt_; |
150 return current_frame; | 150 return current_frame; |
151 } | 151 } |
152 | 152 |
153 VideoContentMetrics* VPMFramePreprocessor::GetContentMetrics() const { | 153 VideoContentMetrics* VPMFramePreprocessor::GetContentMetrics() const { |
154 return content_metrics_; | 154 return content_metrics_; |
155 } | 155 } |
156 | 156 |
157 } // namespace webrtc | 157 } // namespace webrtc |
OLD | NEW |