OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ |
12 #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ | 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/modules/video_processing/util/denoiser_filter.h" | 16 #include "webrtc/modules/video_processing/util/denoiser_filter.h" |
17 #include "webrtc/modules/video_processing/util/noise_estimation.h" | 17 #include "webrtc/modules/video_processing/util/noise_estimation.h" |
18 #include "webrtc/modules/video_processing/util/skin_detection.h" | 18 #include "webrtc/modules/video_processing/util/skin_detection.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 class VideoDenoiser { | 22 class VideoDenoiser { |
23 public: | 23 public: |
24 explicit VideoDenoiser(bool runtime_cpu_detection); | 24 explicit VideoDenoiser(bool runtime_cpu_detection); |
25 | 25 |
26 void DenoiseFrame(const VideoFrame& frame, | 26 // TODO(nisse): Let the denoised_frame and denoised_frame_prev be |
27 VideoFrame* denoised_frame, | 27 // member variables referencing two I420Buffer, and return a refptr |
28 VideoFrame* denoised_frame_prev, | 28 // to the current one. When we also move the double-buffering logic |
29 // from the caller. | |
nisse-webrtc
2016/06/17 07:34:47
BTW, what do you think about this idea? It would s
jackychen
2016/06/17 23:56:50
SG for me. You can surely make this change.
| |
30 void DenoiseFrame(const rtc::scoped_refptr<VideoFrameBuffer>& frame, | |
31 // Buffers are allocated/replaced when dimensions | |
32 // change. | |
33 rtc::scoped_refptr<I420Buffer>* denoised_frame, | |
34 rtc::scoped_refptr<I420Buffer>* denoised_frame_prev, | |
29 bool noise_estimation_enabled); | 35 bool noise_estimation_enabled); |
30 | 36 |
31 private: | 37 private: |
32 void DenoiserReset(const VideoFrame& frame, | 38 void DenoiserReset(const rtc::scoped_refptr<VideoFrameBuffer>& frame, |
33 VideoFrame* denoised_frame, | 39 rtc::scoped_refptr<I420Buffer>* denoised_frame, |
34 VideoFrame* denoised_frame_prev); | 40 rtc::scoped_refptr<I420Buffer>* denoised_frame_prev); |
35 | 41 |
36 // Check the mb position, return 1: close to the frame center (between 1/8 | 42 // Check the mb position, return 1: close to the frame center (between 1/8 |
37 // and 7/8 of width/height), 3: close to the border (out of 1/16 and 15/16 | 43 // and 7/8 of width/height), 3: close to the border (out of 1/16 and 15/16 |
38 // of width/height), 2: in between. | 44 // of width/height), 2: in between. |
39 int PositionCheck(int mb_row, int mb_col, int noise_level); | 45 int PositionCheck(int mb_row, int mb_col, int noise_level); |
40 | 46 |
41 // To reduce false detection in moving object detection (MOD). | 47 // To reduce false detection in moving object detection (MOD). |
42 void ReduceFalseDetection(const std::unique_ptr<uint8_t[]>& d_status, | 48 void ReduceFalseDetection(const std::unique_ptr<uint8_t[]>& d_status, |
43 std::unique_ptr<uint8_t[]>* d_status_red, | 49 std::unique_ptr<uint8_t[]>* d_status_red, |
44 int noise_level); | 50 int noise_level); |
(...skipping 27 matching lines...) Expand all Loading... | |
72 // x_density_ and y_density_ are used in MOD process. | 78 // x_density_ and y_density_ are used in MOD process. |
73 std::unique_ptr<uint8_t[]> x_density_; | 79 std::unique_ptr<uint8_t[]> x_density_; |
74 std::unique_ptr<uint8_t[]> y_density_; | 80 std::unique_ptr<uint8_t[]> y_density_; |
75 // Save the return values by MbDenoise for each block. | 81 // Save the return values by MbDenoise for each block. |
76 std::unique_ptr<DenoiserDecision[]> mb_filter_decision_; | 82 std::unique_ptr<DenoiserDecision[]> mb_filter_decision_; |
77 }; | 83 }; |
78 | 84 |
79 } // namespace webrtc | 85 } // namespace webrtc |
80 | 86 |
81 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ | 87 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ |
OLD | NEW |