Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 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_CODING_HISTOGRAM_H_ | |
| 12 #define WEBRTC_MODULES_VIDEO_CODING_HISTOGRAM_H_ | |
| 13 | |
| 14 #include <vector> | |
| 15 | |
| 16 namespace webrtc { | |
| 17 namespace video_coding { | |
| 18 class Histogram { | |
|
stefan-webrtc
2016/03/01 12:16:34
Please add unittests for this class.
philipel
2016/03/01 13:31:08
Done.
| |
| 19 public: | |
| 20 Histogram(int num_buckets, int max_num_values); | |
| 21 | |
| 22 // Add a value to the histogram. If there already is max_num_values in the | |
| 23 // histogram then the oldest value will be replaced with the new value. | |
| 24 void Add(int value); | |
| 25 | |
| 26 // Calculates how many buckets have to be summed in order to accumulate at | |
| 27 // least the given probability. | |
| 28 size_t InverseCDF(float probability) const; | |
|
stefan-webrtc
2016/03/01 12:16:34
InverseCdf
philipel
2016/03/01 13:31:08
Done.
| |
| 29 | |
| 30 // How many values that make up this histogram. | |
| 31 size_t NumValues() const; | |
| 32 | |
| 33 private: | |
| 34 // A circular buffer that holds the values that make up the histogram. | |
| 35 std::vector<int> values_; | |
| 36 std::vector<int> buckets_; | |
| 37 size_t index_; | |
| 38 }; | |
| 39 | |
| 40 } // namespace video_coding | |
| 41 } // namespace webrtc | |
| 42 | |
| 43 #endif // WEBRTC_MODULES_VIDEO_CODING_HISTOGRAM_H_ | |
| OLD | NEW |