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" |
11 | 11 |
12 namespace webrtc { | 12 namespace webrtc { |
13 | 13 |
14 namespace { | 14 namespace { |
15 static const int kMinFps = 5; | 15 static const int kMinFps = 5; |
16 static const int kMeasureSecondsDownscale = 3; | |
17 // Threshold constant used until first downscale (to permit fast rampup). | 16 // Threshold constant used until first downscale (to permit fast rampup). |
18 static const int kMeasureSecondsFastUpscale = 2; | 17 static const int kMeasureSecondsFastUpscale = 2; |
19 static const int kMeasureSecondsUpscale = 5; | 18 static const int kMeasureSecondsUpscale = 5; |
| 19 static const int kMeasureSecondsDownscale = 5; |
20 static const int kFramedropPercentThreshold = 60; | 20 static const int kFramedropPercentThreshold = 60; |
21 static const int kHdResolutionThreshold = 700 * 500; | 21 static const int kHdResolutionThreshold = 700 * 500; |
22 static const int kHdBitrateThresholdKbps = 500; | 22 static const int kHdBitrateThresholdKbps = 500; |
23 // Min width/height to downscale to, set to not go below QVGA, but with some | 23 // Min width/height to downscale to, set to not go below QVGA, but with some |
24 // margin to permit "almost-QVGA" resolutions, such as QCIF. | 24 // margin to permit "almost-QVGA" resolutions, such as QCIF. |
25 static const int kMinDownscaleDimension = 140; | 25 static const int kMinDownscaleDimension = 140; |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 QualityScaler::QualityScaler() | 28 QualityScaler::QualityScaler() |
29 : low_qp_threshold_(-1), framerate_down_(false) {} | 29 : low_qp_threshold_(-1), framerate_down_(false) {} |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 downscale_shift_ = 0; | 177 downscale_shift_ = 0; |
178 if (!up) { | 178 if (!up) { |
179 // Hit first downscale, start using a slower threshold for going up. | 179 // Hit first downscale, start using a slower threshold for going up. |
180 measure_seconds_upscale_ = kMeasureSecondsUpscale; | 180 measure_seconds_upscale_ = kMeasureSecondsUpscale; |
181 UpdateSampleCounts(); | 181 UpdateSampleCounts(); |
182 } | 182 } |
183 ClearSamples(); | 183 ClearSamples(); |
184 } | 184 } |
185 | 185 |
186 } // namespace webrtc | 186 } // namespace webrtc |
OLD | NEW |