| Index: webrtc/modules/video_coding/utility/quality_scaler.cc
|
| diff --git a/webrtc/modules/video_coding/utility/quality_scaler.cc b/webrtc/modules/video_coding/utility/quality_scaler.cc
|
| index 541d0d431fb413944ca42ffdc03f3a2b2b7f4766..e436d3fedf7ddde46649cfb23dd54c4cfcfcbbae 100644
|
| --- a/webrtc/modules/video_coding/utility/quality_scaler.cc
|
| +++ b/webrtc/modules/video_coding/utility/quality_scaler.cc
|
| @@ -19,16 +19,11 @@ static const int kMeasureSecondsFastUpscale = 2;
|
| static const int kMeasureSecondsUpscale = 5;
|
| static const int kMeasureSecondsDownscale = 5;
|
| static const int kFramedropPercentThreshold = 60;
|
| +static const int kHdResolutionThreshold = 700 * 500;
|
| +static const int kHdBitrateThresholdKbps = 500;
|
| // Min width/height to downscale to, set to not go below QVGA, but with some
|
| // margin to permit "almost-QVGA" resolutions, such as QCIF.
|
| static const int kMinDownscaleDimension = 140;
|
| -// Initial resolutions corresponding to a bitrate. Aa bit above their actual
|
| -// values to permit near-VGA and near-QVGA resolutions to use the same
|
| -// mechanism.
|
| -static const int kVgaBitrateThresholdKbps = 500;
|
| -static const int kVgaNumPixels = 700 * 500; // 640x480
|
| -static const int kQvgaBitrateThresholdKbps = 250;
|
| -static const int kQvgaNumPixels = 400 * 300; // 320x240
|
| } // namespace
|
|
|
| // QP thresholds are chosen to be high enough to be hit in practice when quality
|
| @@ -59,13 +54,12 @@ void QualityScaler::Init(int low_qp_threshold,
|
| measure_seconds_upscale_ = kMeasureSecondsFastUpscale;
|
| const int init_width = width;
|
| const int init_height = height;
|
| - if (initial_bitrate_kbps > 0) {
|
| - int init_num_pixels = width * height;
|
| - if (initial_bitrate_kbps < kVgaBitrateThresholdKbps)
|
| - init_num_pixels = kVgaNumPixels;
|
| - if (initial_bitrate_kbps < kQvgaBitrateThresholdKbps)
|
| - init_num_pixels = kQvgaNumPixels;
|
| - while (width * height > init_num_pixels) {
|
| + // TODO(glaznev): Investigate using thresholds for other resolutions
|
| + // or threshold tables.
|
| + if (initial_bitrate_kbps > 0 &&
|
| + initial_bitrate_kbps < kHdBitrateThresholdKbps) {
|
| + // Start scaling to roughly VGA.
|
| + while (width * height > kHdResolutionThreshold) {
|
| ++downscale_shift_;
|
| width /= 2;
|
| height /= 2;
|
|
|