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); | |
35 void SetMinResolution(int min_width, int min_height); | 34 void SetMinResolution(int min_width, int min_height); |
36 void ReportFramerate(int framerate); | 35 void ReportFramerate(int framerate); |
37 void ReportQP(int qp); | 36 void ReportQP(int qp); |
38 void ReportDroppedFrame(); | 37 void ReportDroppedFrame(); |
39 void Reset(int framerate, int bitrate, int width, int height); | 38 void Reset(int framerate, int bitrate, int width, int height); |
40 void OnEncodeFrame(const VideoFrame& frame); | 39 void OnEncodeFrame(const VideoFrame& frame); |
41 Resolution GetScaledResolution() const; | 40 Resolution GetScaledResolution() const; |
42 const VideoFrame& GetScaledFrame(const VideoFrame& frame); | 41 const VideoFrame& GetScaledFrame(const VideoFrame& frame); |
43 int GetTargetFramerate() const; | 42 int GetTargetFramerate() const; |
44 int downscale_shift() const { return downscale_shift_; } | 43 int downscale_shift() const { return downscale_shift_; } |
45 | 44 |
46 private: | 45 private: |
47 void AdjustScale(bool up); | 46 void AdjustScale(bool up); |
48 void UpdateTargetResolution(int frame_width, int frame_height); | 47 void UpdateTargetResolution(int frame_width, int frame_height); |
49 void ClearSamples(); | 48 void ClearSamples(); |
50 void UpdateSampleCounts(); | |
51 | 49 |
52 Scaler scaler_; | 50 Scaler scaler_; |
53 VideoFrame scaled_frame_; | 51 VideoFrame scaled_frame_; |
54 | 52 |
55 size_t num_samples_downscale_; | 53 size_t num_samples_; |
56 size_t num_samples_upscale_; | |
57 int measure_seconds_upscale_; | |
58 MovingAverage<int> average_qp_upscale_; | |
59 MovingAverage<int> average_qp_downscale_; | |
60 | |
61 int framerate_; | 54 int framerate_; |
62 int target_framerate_; | 55 int target_framerate_; |
63 int low_qp_threshold_; | 56 int low_qp_threshold_; |
64 int high_qp_threshold_; | 57 int high_qp_threshold_; |
65 MovingAverage<int> framedrop_percent_; | 58 MovingAverage<int> framedrop_percent_; |
| 59 MovingAverage<int> average_qp_; |
66 Resolution res_; | 60 Resolution res_; |
67 | 61 |
68 int downscale_shift_; | 62 int downscale_shift_; |
69 int framerate_down_; | 63 int framerate_down_; |
70 bool use_framerate_reduction_; | 64 bool use_framerate_reduction_; |
71 int min_width_; | 65 int min_width_; |
72 int min_height_; | 66 int min_height_; |
73 }; | 67 }; |
74 | 68 |
75 } // namespace webrtc | 69 } // namespace webrtc |
76 | 70 |
77 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ | 71 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ |
OLD | NEW |