OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | |
12 #define WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "webrtc/modules/video_processing/include/video_processing.h" | |
17 #include "webrtc/modules/video_processing/spatial_resampler.h" | |
18 #include "webrtc/modules/video_processing/video_decimator.h" | |
19 #include "webrtc/typedefs.h" | |
20 #include "webrtc/video_frame.h" | |
21 | |
22 namespace webrtc { | |
23 | |
24 class VideoDenoiser; | |
25 | |
26 // All pointers/members in this class are assumed to be protected by the class | |
27 // owner. | |
28 class VPMFramePreprocessor { | |
29 public: | |
30 VPMFramePreprocessor(); | |
31 ~VPMFramePreprocessor(); | |
32 | |
33 void Reset(); | |
34 | |
35 // Enable temporal decimation. | |
36 void EnableTemporalDecimation(bool enable); | |
37 | |
38 void SetInputFrameResampleMode(VideoFrameResampling resampling_mode); | |
39 | |
40 // Set target resolution: frame rate and dimension. | |
41 int32_t SetTargetResolution(uint32_t width, | |
42 uint32_t height, | |
43 uint32_t frame_rate); | |
44 | |
45 // Update incoming frame rate/dimension. | |
46 void UpdateIncomingframe_rate(); | |
47 | |
48 int32_t updateIncomingFrameSize(uint32_t width, uint32_t height); | |
49 | |
50 // Set decimated values: frame rate/dimension. | |
51 uint32_t GetDecimatedFrameRate(); | |
52 uint32_t GetDecimatedWidth() const; | |
53 uint32_t GetDecimatedHeight() const; | |
54 | |
55 // Preprocess output: | |
56 void EnableDenoising(bool enable); | |
57 const VideoFrame* PreprocessFrame(const VideoFrame& frame); | |
58 | |
59 private: | |
60 // The content does not change so much every frame, so to reduce complexity | |
61 // we can compute new content metrics every |kSkipFrameCA| frames. | |
62 enum { kSkipFrameCA = 2 }; | |
63 | |
64 VideoFrame denoised_frame_; | |
65 VideoFrame resampled_frame_; | |
66 VPMSpatialResampler* spatial_resampler_; | |
67 VPMVideoDecimator* vd_; | |
68 std::unique_ptr<VideoDenoiser> denoiser_; | |
69 uint32_t frame_cnt_; | |
70 }; | |
71 | |
72 } // namespace webrtc | |
73 | |
74 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_ | |
OLD | NEW |