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 #include "webrtc/modules/video_coding/utility/quality_scaler.h" | 10 #include "webrtc/modules/video_coding/utility/quality_scaler.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 static const int kMinDownscaleDimension = 140; | 23 static const int kMinDownscaleDimension = 140; |
24 // Initial resolutions corresponding to a bitrate. Aa bit above their actual | 24 // Initial resolutions corresponding to a bitrate. Aa bit above their actual |
25 // values to permit near-VGA and near-QVGA resolutions to use the same | 25 // values to permit near-VGA and near-QVGA resolutions to use the same |
26 // mechanism. | 26 // mechanism. |
27 static const int kVgaBitrateThresholdKbps = 500; | 27 static const int kVgaBitrateThresholdKbps = 500; |
28 static const int kVgaNumPixels = 700 * 500; // 640x480 | 28 static const int kVgaNumPixels = 700 * 500; // 640x480 |
29 static const int kQvgaBitrateThresholdKbps = 250; | 29 static const int kQvgaBitrateThresholdKbps = 250; |
30 static const int kQvgaNumPixels = 400 * 300; // 320x240 | 30 static const int kQvgaNumPixels = 400 * 300; // 320x240 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 // QP thresholds are chosen to be high enough to be hit in practice when quality | |
34 // is good, but also low enough to not cause a flip-flop behavior (e.g. going up | |
35 // in resolution shouldn't give so bad quality that we should go back down). | |
36 | |
37 const int QualityScaler::kLowVp8QpThreshold = 29; | |
38 const int QualityScaler::kBadVp8QpThreshold = 100; | |
AlexG
2016/05/11 17:13:48
I want to keep "bad" threshold at 90 at least for
pbos-webrtc
2016/05/11 17:19:26
Are you certain that this doesn't flip-flop for ei
| |
39 | |
40 const int QualityScaler::kLowH264QpThreshold = 22; | |
41 const int QualityScaler::kBadH264QpThreshold = 35; | |
42 | |
33 QualityScaler::QualityScaler() : low_qp_threshold_(-1) {} | 43 QualityScaler::QualityScaler() : low_qp_threshold_(-1) {} |
34 | 44 |
35 void QualityScaler::Init(int low_qp_threshold, | 45 void QualityScaler::Init(int low_qp_threshold, |
36 int high_qp_threshold, | 46 int high_qp_threshold, |
37 int initial_bitrate_kbps, | 47 int initial_bitrate_kbps, |
38 int width, | 48 int width, |
39 int height, | 49 int height, |
40 int fps) { | 50 int fps) { |
41 ClearSamples(); | 51 ClearSamples(); |
42 low_qp_threshold_ = low_qp_threshold; | 52 low_qp_threshold_ = low_qp_threshold; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 downscale_shift_ = 0; | 171 downscale_shift_ = 0; |
162 if (!up) { | 172 if (!up) { |
163 // Hit first downscale, start using a slower threshold for going up. | 173 // Hit first downscale, start using a slower threshold for going up. |
164 measure_seconds_upscale_ = kMeasureSecondsUpscale; | 174 measure_seconds_upscale_ = kMeasureSecondsUpscale; |
165 UpdateSampleCounts(); | 175 UpdateSampleCounts(); |
166 } | 176 } |
167 ClearSamples(); | 177 ClearSamples(); |
168 } | 178 } |
169 | 179 |
170 } // namespace webrtc | 180 } // namespace webrtc |
OLD | NEW |