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 11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ 13 14 #include "webrtc/modules/include/module_common_types.h" 15 #include "webrtc/typedefs.h" 16 17 namespace webrtc { 18 19 class VPMVideoDecimator { 20 public: 21 VPMVideoDecimator(); 22 ~VPMVideoDecimator(); 23 24 void Reset(); 25 26 void EnableTemporalDecimation(bool enable); 27 28 void SetTargetFramerate(int frame_rate); 29 30 bool DropFrame(); 31 32 void UpdateIncomingframe_rate(); 33 34 // Get Decimated Frame Rate/Dimensions. 35 uint32_t GetDecimatedFrameRate(); 36 37 // Get input frame rate. 38 uint32_t Inputframe_rate(); 39 40 private: 41 void ProcessIncomingframe_rate(int64_t now); 42 43 enum { kFrameCountHistory_size = 90 }; 44 enum { kFrameHistoryWindowMs = 2000 }; 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_; 52 int64_t incoming_frame_times_[kFrameCountHistory_size]; 53 bool enable_temporal_decimation_; 54 }; 55 56 } // namespace webrtc 57 58 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DECIMATOR_H_ 59