niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 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 | |
Henrik Kjellander | 0f59a88 | 2015-11-18 22:31:24 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ |
| 12 | #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 14 | #include "webrtc/modules/include/module_common_types.h" |
pbos@webrtc.org | 6f3d8fc | 2013-05-27 14:12:16 +0000 | [diff] [blame] | 15 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 19 | class VPMVideoDecimator { |
| 20 | public: |
| 21 | VPMVideoDecimator(); |
| 22 | ~VPMVideoDecimator(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 24 | void Reset(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 26 | void EnableTemporalDecimation(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
jackychen | 6e2ce6e | 2015-07-13 16:26:33 -0700 | [diff] [blame] | 28 | void SetTargetFramerate(int frame_rate); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 30 | bool DropFrame(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 32 | void UpdateIncomingframe_rate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 34 | // Get Decimated Frame Rate/Dimensions. |
mflodman | a856542 | 2015-12-07 01:09:52 -0800 | [diff] [blame] | 35 | uint32_t GetDecimatedFrameRate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 37 | // Get input frame rate. |
| 38 | uint32_t Inputframe_rate(); |
| 39 | |
| 40 | private: |
| 41 | void ProcessIncomingframe_rate(int64_t now); |
| 42 | |
mflodman | 99ab944 | 2015-12-07 22:54:50 -0800 | [diff] [blame] | 43 | enum { kFrameCountHistory_size = 90 }; |
| 44 | enum { kFrameHistoryWindowMs = 2000 }; |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 45 | |
| 46 | // Temporal decimation. |
| 47 | int32_t overshoot_modifier_; |
| 48 | uint32_t drop_count_; |
| 49 | uint32_t keep_count_; |
| 50 | uint32_t target_frame_rate_; |
| 51 | float incoming_frame_rate_; |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 52 | int64_t incoming_frame_times_[kFrameCountHistory_size]; |
| 53 | bool enable_temporal_decimation_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 56 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 57 | |
Henrik Kjellander | 0f59a88 | 2015-11-18 22:31:24 +0100 | [diff] [blame] | 58 | #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ |