OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 int width; | 23 int width; |
24 int height; | 24 int height; |
25 }; | 25 }; |
26 | 26 |
27 QualityScaler(); | 27 QualityScaler(); |
28 void Init(int low_qp_threshold, | 28 void Init(int low_qp_threshold, |
29 int high_qp_threshold, | 29 int high_qp_threshold, |
30 bool use_framerate_reduction, | 30 bool use_framerate_reduction, |
31 int initial_bitrate_kbps, | 31 int initial_bitrate_kbps, |
32 int width, | 32 int width, |
33 int height); | 33 int height, |
| 34 int fps); |
34 void SetMinResolution(int min_width, int min_height); | 35 void SetMinResolution(int min_width, int min_height); |
35 void ReportFramerate(int framerate); | 36 void ReportFramerate(int framerate); |
36 void ReportQP(int qp); | 37 void ReportQP(int qp); |
37 void ReportDroppedFrame(); | 38 void ReportDroppedFrame(); |
38 void Reset(int framerate, int bitrate, int width, int height); | 39 void Reset(int framerate, int bitrate, int width, int height); |
39 void OnEncodeFrame(const VideoFrame& frame); | 40 void OnEncodeFrame(const VideoFrame& frame); |
40 Resolution GetScaledResolution() const; | 41 Resolution GetScaledResolution() const; |
41 const VideoFrame& GetScaledFrame(const VideoFrame& frame); | 42 const VideoFrame& GetScaledFrame(const VideoFrame& frame); |
42 int GetTargetFramerate() const; | 43 int GetTargetFramerate() const; |
43 int downscale_shift() const { return downscale_shift_; } | 44 int downscale_shift() const { return downscale_shift_; } |
44 | 45 |
45 private: | 46 private: |
46 void AdjustScale(bool up); | 47 void AdjustScale(bool up); |
47 void UpdateTargetResolution(int frame_width, int frame_height); | 48 void UpdateTargetResolution(int frame_width, int frame_height); |
48 void ClearSamples(); | 49 void ClearSamples(); |
| 50 void UpdateSampleCounts(); |
49 | 51 |
50 Scaler scaler_; | 52 Scaler scaler_; |
51 VideoFrame scaled_frame_; | 53 VideoFrame scaled_frame_; |
52 | 54 |
53 size_t num_samples_; | 55 size_t num_samples_downscale_; |
| 56 size_t num_samples_upscale_; |
| 57 int measure_seconds_upscale_; |
| 58 MovingAverage<int> average_qp_upscale_; |
| 59 MovingAverage<int> average_qp_downscale_; |
| 60 |
54 int framerate_; | 61 int framerate_; |
55 int target_framerate_; | 62 int target_framerate_; |
56 int low_qp_threshold_; | 63 int low_qp_threshold_; |
57 int high_qp_threshold_; | 64 int high_qp_threshold_; |
58 MovingAverage<int> framedrop_percent_; | 65 MovingAverage<int> framedrop_percent_; |
59 MovingAverage<int> average_qp_; | |
60 Resolution res_; | 66 Resolution res_; |
61 | 67 |
62 int downscale_shift_; | 68 int downscale_shift_; |
63 int framerate_down_; | 69 int framerate_down_; |
64 bool use_framerate_reduction_; | 70 bool use_framerate_reduction_; |
65 int min_width_; | 71 int min_width_; |
66 int min_height_; | 72 int min_height_; |
67 }; | 73 }; |
68 | 74 |
69 } // namespace webrtc | 75 } // namespace webrtc |
70 | 76 |
71 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ | 77 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ |
OLD | NEW |