diff options
Diffstat (limited to 'webrtc/modules/video_coding/utility/include')
6 files changed, 0 insertions, 384 deletions
diff --git a/webrtc/modules/video_coding/utility/include/frame_dropper.h b/webrtc/modules/video_coding/utility/include/frame_dropper.h deleted file mode 100644 index 2b78a7264f..0000000000 --- a/webrtc/modules/video_coding/utility/include/frame_dropper.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_FRAME_DROPPER_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_FRAME_DROPPER_H_ - -#include <cstddef> - -#include "webrtc/base/exp_filter.h" -#include "webrtc/typedefs.h" - -namespace webrtc -{ - -// The Frame Dropper implements a variant of the leaky bucket algorithm -// for keeping track of when to drop frames to avoid bit rate -// over use when the encoder can't keep its bit rate. -class FrameDropper -{ -public: - FrameDropper(); - explicit FrameDropper(float max_time_drops); - virtual ~FrameDropper() {} - - // Resets the FrameDropper to its initial state. - // This means that the frameRateWeight is set to its - // default value as well. - virtual void Reset(); - - virtual void Enable(bool enable); - // Answers the question if it's time to drop a frame - // if we want to reach a given frame rate. Must be - // called for every frame. - // - // Return value : True if we should drop the current frame - virtual bool DropFrame(); - // Updates the FrameDropper with the size of the latest encoded - // frame. The FrameDropper calculates a new drop ratio (can be - // seen as the probability to drop a frame) and updates its - // internal statistics. - // - // Input: - // - frameSizeBytes : The size of the latest frame - // returned from the encoder. - // - deltaFrame : True if the encoder returned - // a key frame. - virtual void Fill(size_t frameSizeBytes, bool deltaFrame); - - virtual void Leak(uint32_t inputFrameRate); - - void UpdateNack(uint32_t nackBytes); - - // Sets the target bit rate and the frame rate produced by - // the camera. - // - // Input: - // - bitRate : The target bit rate - virtual void SetRates(float bitRate, float incoming_frame_rate); - - // Return value : The current average frame rate produced - // if the DropFrame() function is used as - // instruction of when to drop frames. - virtual float ActualFrameRate(uint32_t inputFrameRate) const; - -private: - void FillBucket(float inKbits, float outKbits); - void UpdateRatio(); - void CapAccumulator(); - - rtc::ExpFilter _keyFrameSizeAvgKbits; - rtc::ExpFilter _keyFrameRatio; - float _keyFrameSpreadFrames; - int32_t _keyFrameCount; - float _accumulator; - float _accumulatorMax; - float _targetBitRate; - bool _dropNext; - rtc::ExpFilter _dropRatio; - int32_t _dropCount; - float _windowSize; - float _incoming_frame_rate; - bool _wasBelowMax; - bool _enabled; - bool _fastMode; - float _cap_buffer_size; - float _max_time_drops; -}; // end of VCMFrameDropper class - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_FRAME_DROPPER_H_ diff --git a/webrtc/modules/video_coding/utility/include/mock/mock_frame_dropper.h b/webrtc/modules/video_coding/utility/include/mock/mock_frame_dropper.h deleted file mode 100644 index 1e31e5442a..0000000000 --- a/webrtc/modules/video_coding/utility/include/mock/mock_frame_dropper.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_MOCK_MOCK_FRAME_DROPPER_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_MOCK_MOCK_FRAME_DROPPER_H_ - -#include <string> - -#include "testing/gmock/include/gmock/gmock.h" -#include "webrtc/modules/video_coding/utility/include/frame_dropper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class MockFrameDropper : public FrameDropper { - public: - MOCK_METHOD0(Reset, - void()); - MOCK_METHOD1(Enable, - void(bool enable)); - MOCK_METHOD0(DropFrame, - bool()); - MOCK_METHOD2(Fill, - void(size_t frameSizeBytes, bool deltaFrame)); - MOCK_METHOD1(Leak, - void(uint32_t inputFrameRate)); - MOCK_METHOD2(SetRates, - void(float bitRate, float incoming_frame_rate)); - MOCK_CONST_METHOD1(ActualFrameRate, - float(uint32_t inputFrameRate)); -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_INCLUDE_MOCK_MOCK_FRAME_DROPPER_H_ diff --git a/webrtc/modules/video_coding/utility/include/moving_average.h b/webrtc/modules/video_coding/utility/include/moving_average.h deleted file mode 100644 index 49c42c4ed4..0000000000 --- a/webrtc/modules/video_coding/utility/include/moving_average.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_MOVING_AVERAGE_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_MOVING_AVERAGE_H_ - -#include <list> - -#include "webrtc/typedefs.h" - -namespace webrtc { -template<class T> -class MovingAverage { - public: - MovingAverage(); - void AddSample(T sample); - bool GetAverage(size_t num_samples, T* average); - void Reset(); - int size(); - - private: - T sum_; - std::list<T> samples_; -}; - -template<class T> -MovingAverage<T>::MovingAverage() : sum_(static_cast<T>(0)) { -} - -template<class T> -void MovingAverage<T>::AddSample(T sample) { - samples_.push_back(sample); - sum_ += sample; -} - -template<class T> -bool MovingAverage<T>::GetAverage(size_t num_samples, T* avg) { - if (num_samples > samples_.size()) - return false; - - // Remove old samples. - while (num_samples < samples_.size()) { - sum_ -= samples_.front(); - samples_.pop_front(); - } - - *avg = sum_ / static_cast<T>(num_samples); - return true; -} - -template<class T> -void MovingAverage<T>::Reset() { - sum_ = static_cast<T>(0); - samples_.clear(); -} - -template<class T> -int MovingAverage<T>::size() { - return samples_.size(); -} - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_MOVING_AVERAGE_SCALER_H_ diff --git a/webrtc/modules/video_coding/utility/include/qp_parser.h b/webrtc/modules/video_coding/utility/include/qp_parser.h deleted file mode 100644 index 805b37b45c..0000000000 --- a/webrtc/modules/video_coding/utility/include/qp_parser.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_QP_PARSER_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_QP_PARSER_H_ - -#include "webrtc/modules/video_coding/main/source/encoded_frame.h" - -namespace webrtc { - -class QpParser { - public: - QpParser() {} - ~QpParser() {} - - // Parses an encoded |frame| and extracts the |qp|. - // Returns true on success, false otherwise. - bool GetQp(const VCMEncodedFrame& frame, int* qp); -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QP_PARSER_H_ diff --git a/webrtc/modules/video_coding/utility/include/quality_scaler.h b/webrtc/modules/video_coding/utility/include/quality_scaler.h deleted file mode 100644 index 29a1496c05..0000000000 --- a/webrtc/modules/video_coding/utility/include/quality_scaler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ - -#include "webrtc/common_video/libyuv/include/scaler.h" -#include "webrtc/modules/video_coding/utility/include/moving_average.h" - -namespace webrtc { -class QualityScaler { - public: - static const int kDefaultLowQpDenominator; - static const int kDefaultMinDownscaleDimension; - struct Resolution { - int width; - int height; - }; - - QualityScaler(); - void Init(int low_qp_threshold, - int high_qp_threshold, - bool use_framerate_reduction); - void SetMinResolution(int min_width, int min_height); - void ReportFramerate(int framerate); - void ReportQP(int qp); - void ReportDroppedFrame(); - void Reset(int framerate, int bitrate, int width, int height); - void OnEncodeFrame(const VideoFrame& frame); - Resolution GetScaledResolution() const; - const VideoFrame& GetScaledFrame(const VideoFrame& frame); - int GetTargetFramerate() const; - int downscale_shift() const { return downscale_shift_; } - - private: - void AdjustScale(bool up); - void ClearSamples(); - - Scaler scaler_; - VideoFrame scaled_frame_; - - size_t num_samples_; - int framerate_; - int target_framerate_; - int low_qp_threshold_; - int high_qp_threshold_; - MovingAverage<int> framedrop_percent_; - MovingAverage<int> average_qp_; - Resolution res_; - - int downscale_shift_; - int framerate_down_; - bool use_framerate_reduction_; - int min_width_; - int min_height_; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ diff --git a/webrtc/modules/video_coding/utility/include/vp8_header_parser.h b/webrtc/modules/video_coding/utility/include/vp8_header_parser.h deleted file mode 100644 index 88796ecd0e..0000000000 --- a/webrtc/modules/video_coding/utility/include/vp8_header_parser.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_PARSE_HEADER_H_ -#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_PARSE_HEADER_H_ - -namespace webrtc { - -namespace vp8 { - -enum { - MB_FEATURE_TREE_PROBS = 3, - NUM_MB_SEGMENTS = 4, - NUM_REF_LF_DELTAS = 4, - NUM_MODE_LF_DELTAS = 4, -}; - -typedef struct VP8BitReader VP8BitReader; -struct VP8BitReader { - // Boolean decoder. - uint32_t value_; // Current value. - uint32_t range_; // Current range minus 1. In [127, 254] interval. - int bits_; // Number of valid bits left. - // Read buffer. - const uint8_t* buf_; // Next byte to be read. - const uint8_t* buf_end_; // End of read buffer. - int eof_; // True if input is exhausted. -}; - -const uint8_t kVP8Log2Range[128] = { - 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0 -}; - -// range = ((range - 1) << kVP8Log2Range[range]) + 1 -const uint8_t kVP8NewRange[128] = { - 127, 127, 191, 127, 159, 191, 223, 127, - 143, 159, 175, 191, 207, 223, 239, 127, - 135, 143, 151, 159, 167, 175, 183, 191, - 199, 207, 215, 223, 231, 239, 247, 127, - 131, 135, 139, 143, 147, 151, 155, 159, - 163, 167, 171, 175, 179, 183, 187, 191, - 195, 199, 203, 207, 211, 215, 219, 223, - 227, 231, 235, 239, 243, 247, 251, 127, - 129, 131, 133, 135, 137, 139, 141, 143, - 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 171, 173, 175, - 177, 179, 181, 183, 185, 187, 189, 191, - 193, 195, 197, 199, 201, 203, 205, 207, - 209, 211, 213, 215, 217, 219, 221, 223, - 225, 227, 229, 231, 233, 235, 237, 239, - 241, 243, 245, 247, 249, 251, 253, 127 -}; - -// Gets the QP, QP range: [0, 127]. -// Returns true on success, false otherwise. -bool GetQp(const uint8_t* buf, size_t length, int* qp); - -} // namespace vp8 - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_PARSE_HEADER_H_ |