blob: 1b871df8c380ae128cb9a7d91afa5416864e9530 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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 Kjellander0f59a882015-11-18 22:31:24 +010011#ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_
12#define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010014#include "webrtc/modules/include/module_common_types.h"
pbos@webrtc.org6f3d8fc2013-05-27 14:12:16 +000015#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
17namespace webrtc {
18
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000019class VPMVideoDecimator {
20 public:
21 VPMVideoDecimator();
22 ~VPMVideoDecimator();
niklase@google.com470e71d2011-07-07 08:21:25 +000023
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000024 void Reset();
niklase@google.com470e71d2011-07-07 08:21:25 +000025
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000026 void EnableTemporalDecimation(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +000027
jackychen6e2ce6e2015-07-13 16:26:33 -070028 void SetTargetFramerate(int frame_rate);
niklase@google.com470e71d2011-07-07 08:21:25 +000029
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000030 bool DropFrame();
niklase@google.com470e71d2011-07-07 08:21:25 +000031
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000032 void UpdateIncomingframe_rate();
niklase@google.com470e71d2011-07-07 08:21:25 +000033
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000034 // Get Decimated Frame Rate/Dimensions.
mflodmana8565422015-12-07 01:09:52 -080035 uint32_t GetDecimatedFrameRate();
niklase@google.com470e71d2011-07-07 08:21:25 +000036
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000037 // Get input frame rate.
38 uint32_t Inputframe_rate();
39
40 private:
41 void ProcessIncomingframe_rate(int64_t now);
42
mflodman99ab9442015-12-07 22:54:50 -080043 enum { kFrameCountHistory_size = 90 };
44 enum { kFrameHistoryWindowMs = 2000 };
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000045
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.orgb43d8072013-10-03 16:42:41 +000052 int64_t incoming_frame_times_[kFrameCountHistory_size];
53 bool enable_temporal_decimation_;
niklase@google.com470e71d2011-07-07 08:21:25 +000054};
55
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000056} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000057
Henrik Kjellander0f59a882015-11-18 22:31:24 +010058#endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_