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 19 matching lines...) Expand all Loading... |
30 int height, | 30 int height, |
31 int fps); | 31 int fps); |
32 void ReportFramerate(int framerate); | 32 void ReportFramerate(int framerate); |
33 void ReportQP(int qp); | 33 void ReportQP(int qp); |
34 void ReportDroppedFrame(); | 34 void ReportDroppedFrame(); |
35 void OnEncodeFrame(const VideoFrame& frame); | 35 void OnEncodeFrame(const VideoFrame& frame); |
36 Resolution GetScaledResolution() const; | 36 Resolution GetScaledResolution() const; |
37 const VideoFrame& GetScaledFrame(const VideoFrame& frame); | 37 const VideoFrame& GetScaledFrame(const VideoFrame& frame); |
38 int downscale_shift() const { return downscale_shift_; } | 38 int downscale_shift() const { return downscale_shift_; } |
39 | 39 |
| 40 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the |
| 41 // bitstream range of [0, 127] and not the user-level range of [0,63]. |
| 42 static const int kLowVp8QpThreshold; |
| 43 static const int kBadVp8QpThreshold; |
| 44 |
| 45 // H264 QP is in the range [0, 51]. |
| 46 static const int kLowH264QpThreshold; |
| 47 static const int kBadH264QpThreshold; |
| 48 |
40 private: | 49 private: |
41 void AdjustScale(bool up); | 50 void AdjustScale(bool up); |
42 void UpdateTargetResolution(int frame_width, int frame_height); | 51 void UpdateTargetResolution(int frame_width, int frame_height); |
43 void ClearSamples(); | 52 void ClearSamples(); |
44 void UpdateSampleCounts(); | 53 void UpdateSampleCounts(); |
45 | 54 |
46 Scaler scaler_; | 55 Scaler scaler_; |
47 VideoFrame scaled_frame_; | 56 VideoFrame scaled_frame_; |
48 | 57 |
49 size_t num_samples_downscale_; | 58 size_t num_samples_downscale_; |
50 size_t num_samples_upscale_; | 59 size_t num_samples_upscale_; |
51 int measure_seconds_upscale_; | 60 int measure_seconds_upscale_; |
52 MovingAverage<int> average_qp_upscale_; | 61 MovingAverage<int> average_qp_upscale_; |
53 MovingAverage<int> average_qp_downscale_; | 62 MovingAverage<int> average_qp_downscale_; |
54 | 63 |
55 int framerate_; | 64 int framerate_; |
56 int low_qp_threshold_; | 65 int low_qp_threshold_; |
57 int high_qp_threshold_; | 66 int high_qp_threshold_; |
58 MovingAverage<int> framedrop_percent_; | 67 MovingAverage<int> framedrop_percent_; |
59 Resolution res_; | 68 Resolution res_; |
60 | 69 |
61 int downscale_shift_; | 70 int downscale_shift_; |
62 }; | 71 }; |
63 | 72 |
64 } // namespace webrtc | 73 } // namespace webrtc |
65 | 74 |
66 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ | 75 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_QUALITY_SCALER_H_ |
OLD | NEW |