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 /* | |
12 * frame_preprocessor.h | |
13 */ | |
14 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ |
15 #define WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ |
16 | 13 |
| 14 #include "webrtc/base/scoped_ptr.h" |
17 #include "webrtc/modules/video_processing/include/video_processing.h" | 15 #include "webrtc/modules/video_processing/include/video_processing.h" |
18 #include "webrtc/modules/video_processing/content_analysis.h" | 16 #include "webrtc/modules/video_processing/content_analysis.h" |
19 #include "webrtc/modules/video_processing/spatial_resampler.h" | 17 #include "webrtc/modules/video_processing/spatial_resampler.h" |
20 #include "webrtc/modules/video_processing/video_decimator.h" | 18 #include "webrtc/modules/video_processing/video_decimator.h" |
21 #include "webrtc/modules/video_processing/video_denoiser.h" | |
22 #include "webrtc/typedefs.h" | 19 #include "webrtc/typedefs.h" |
23 #include "webrtc/video_frame.h" | 20 #include "webrtc/video_frame.h" |
24 | 21 |
25 namespace webrtc { | 22 namespace webrtc { |
26 | 23 |
| 24 class VideoDenoiser; |
| 25 |
| 26 // All pointers/members in this class are assumed to be protected by the class |
| 27 // owner. |
27 class VPMFramePreprocessor { | 28 class VPMFramePreprocessor { |
28 public: | 29 public: |
29 VPMFramePreprocessor(); | 30 VPMFramePreprocessor(); |
30 ~VPMFramePreprocessor(); | 31 ~VPMFramePreprocessor(); |
31 | 32 |
32 void Reset(); | 33 void Reset(); |
33 | 34 |
34 // Enable temporal decimation. | 35 // Enable temporal decimation. |
35 void EnableTemporalDecimation(bool enable); | 36 void EnableTemporalDecimation(bool enable); |
36 | 37 |
37 void SetInputFrameResampleMode(VideoFrameResampling resampling_mode); | 38 void SetInputFrameResampleMode(VideoFrameResampling resampling_mode); |
38 | 39 |
39 // Enable content analysis. | 40 // Enable content analysis. |
40 void EnableContentAnalysis(bool enable); | 41 void EnableContentAnalysis(bool enable); |
41 | 42 |
42 // Set target resolution: frame rate and dimension. | 43 // Set target resolution: frame rate and dimension. |
43 int32_t SetTargetResolution(uint32_t width, uint32_t height, | 44 int32_t SetTargetResolution(uint32_t width, uint32_t height, |
44 uint32_t frame_rate); | 45 uint32_t frame_rate); |
45 | 46 |
46 // Set target frame rate. | 47 // Set target frame rate. |
47 void SetTargetFramerate(int frame_rate); | 48 void SetTargetFramerate(int frame_rate); |
48 | 49 |
49 // Update incoming frame rate/dimension. | 50 // Update incoming frame rate/dimension. |
50 void UpdateIncomingframe_rate(); | 51 void UpdateIncomingframe_rate(); |
51 | 52 |
52 int32_t updateIncomingFrameSize(uint32_t width, uint32_t height); | 53 int32_t updateIncomingFrameSize(uint32_t width, uint32_t height); |
53 | 54 |
54 // Set decimated values: frame rate/dimension. | 55 // Set decimated values: frame rate/dimension. |
55 uint32_t Decimatedframe_rate(); | 56 uint32_t GetDecimatedFrameRate(); |
56 uint32_t DecimatedWidth() const; | 57 uint32_t GetDecimatedWidth() const; |
57 uint32_t DecimatedHeight() const; | 58 uint32_t GetDecimatedHeight() const; |
58 | 59 |
59 // Preprocess output: | 60 // Preprocess output: |
60 int32_t PreprocessFrame(const VideoFrame& frame, | 61 void EnableDenosing(bool enable); |
61 VideoFrame** processed_frame); | 62 const VideoFrame* PreprocessFrame(const VideoFrame& frame); |
62 VideoContentMetrics* ContentMetrics() const; | 63 VideoContentMetrics* GetContentMetrics() const; |
63 | 64 |
64 private: | 65 private: |
65 // The content does not change so much every frame, so to reduce complexity | 66 // The content does not change so much every frame, so to reduce complexity |
66 // we can compute new content metrics every |kSkipFrameCA| frames. | 67 // we can compute new content metrics every |kSkipFrameCA| frames. |
67 enum { kSkipFrameCA = 2 }; | 68 enum { kSkipFrameCA = 2 }; |
68 | 69 |
69 VideoContentMetrics* content_metrics_; | 70 VideoContentMetrics* content_metrics_; |
70 VideoFrame denoised_frame_; | 71 VideoFrame denoised_frame_; |
71 VideoFrame resampled_frame_; | 72 VideoFrame resampled_frame_; |
72 VPMSpatialResampler* spatial_resampler_; | 73 VPMSpatialResampler* spatial_resampler_; |
73 VPMContentAnalysis* ca_; | 74 VPMContentAnalysis* ca_; |
74 VPMVideoDecimator* vd_; | 75 VPMVideoDecimator* vd_; |
75 VideoDenoiser* denoiser_; | 76 rtc::scoped_ptr<VideoDenoiser> denoiser_; |
76 bool enable_ca_; | 77 bool enable_ca_; |
77 bool enable_denoising_; | 78 uint32_t frame_cnt_; |
78 int frame_cnt_; | |
79 | |
80 }; | 79 }; |
81 | 80 |
82 } // namespace webrtc | 81 } // namespace webrtc |
83 | 82 |
84 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | 83 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ |
OLD | NEW |