Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: webrtc/modules/video_coding/utility/quality_scaler.cc

Issue 1900483004: Add QVGA to thresholds for initial quality. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/video_coding/utility/quality_scaler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0e1f1d4248bd7e97a66542da765e12b18a3c5464..b9190bb245b165994cd6c0c3fdcf0623c3dcc315 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler.cc
+++ b/webrtc/modules/video_coding/utility/quality_scaler.cc
@@ -18,8 +18,6 @@ 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;
@@ -46,12 +44,19 @@ void QualityScaler::Init(int low_qp_threshold,
measure_seconds_upscale_ = kMeasureSecondsFastUpscale;
const int init_width = width;
const int init_height = height;
- // 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) {
+ if (initial_bitrate_kbps > 0) {
+ // Resolutions a bit above their actual values to permit near-VGA and
+ // near-QVGA resolutions to use the same mechanism.
+ int init_num_pixels = width * height;
+ static const int kVgaBitrateThresholdKbps = 500;
AlexG 2016/04/18 20:30:03 Why not to keep all these constants at the start w
pbos-webrtc 2016/04/18 20:41:44 Done.
+ static const int kVgaNumPixels = 700 * 500; // 640x480
+ if (initial_bitrate_kbps < kVgaBitrateThresholdKbps)
+ init_num_pixels = kVgaNumPixels;
+ static const int kQvgaBitrateThresholdKbps = 250;
+ static const int kQvgaNumPixels = 400 * 300; // 320x240
+ if (initial_bitrate_kbps < kQvgaBitrateThresholdKbps)
+ init_num_pixels = kQvgaNumPixels;
+ while (width * height > init_num_pixels) {
++downscale_shift_;
width /= 2;
height /= 2;
« no previous file with comments | « no previous file | webrtc/modules/video_coding/utility/quality_scaler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698