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

Side by Side Diff: webrtc/modules/video_coding/utility/quality_scaler.cc

Issue 1966213002: Unify hardware and software QP thresholds. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: compromise at 95 Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = 95;
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
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
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698