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

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

Issue 2309743002: Move the QP scaling thresholds to the relevant encoders (Closed)
Patch Set: fix namespace issue in videoToolbox encoder Created 4 years, 3 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
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 10
(...skipping 13 matching lines...) Expand all
24 static const int kMinDownscaleDimension = 140; 24 static const int kMinDownscaleDimension = 140;
25 // Initial resolutions corresponding to a bitrate. Aa bit above their actual 25 // Initial resolutions corresponding to a bitrate. Aa bit above their actual
26 // values to permit near-VGA and near-QVGA resolutions to use the same 26 // values to permit near-VGA and near-QVGA resolutions to use the same
27 // mechanism. 27 // mechanism.
28 static const int kVgaBitrateThresholdKbps = 500; 28 static const int kVgaBitrateThresholdKbps = 500;
29 static const int kVgaNumPixels = 700 * 500; // 640x480 29 static const int kVgaNumPixels = 700 * 500; // 640x480
30 static const int kQvgaBitrateThresholdKbps = 250; 30 static const int kQvgaBitrateThresholdKbps = 250;
31 static const int kQvgaNumPixels = 400 * 300; // 320x240 31 static const int kQvgaNumPixels = 400 * 300; // 320x240
32 } // namespace 32 } // namespace
33 33
34 // QP thresholds are chosen to be high enough to be hit in practice when quality
35 // is good, but also low enough to not cause a flip-flop behavior (e.g. going up
36 // in resolution shouldn't give so bad quality that we should go back down).
37
38 const int QualityScaler::kLowVp8QpThreshold = 29;
39 const int QualityScaler::kBadVp8QpThreshold = 95;
40
41 #if defined(WEBRTC_IOS)
42 const int QualityScaler::kLowH264QpThreshold = 32;
43 const int QualityScaler::kBadH264QpThreshold = 42;
44 #else
45 const int QualityScaler::kLowH264QpThreshold = 24;
46 const int QualityScaler::kBadH264QpThreshold = 37;
47 #endif
48
49 QualityScaler::QualityScaler() : low_qp_threshold_(-1) {} 34 QualityScaler::QualityScaler() : low_qp_threshold_(-1) {}
50 35
51 void QualityScaler::Init(int low_qp_threshold, 36 void QualityScaler::Init(int low_qp_threshold,
52 int high_qp_threshold, 37 int high_qp_threshold,
53 int initial_bitrate_kbps, 38 int initial_bitrate_kbps,
54 int width, 39 int width,
55 int height, 40 int height,
56 int fps) { 41 int fps) {
57 ClearSamples(); 42 ClearSamples();
58 low_qp_threshold_ = low_qp_threshold; 43 low_qp_threshold_ = low_qp_threshold;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (downscale_shift_ < 0) 167 if (downscale_shift_ < 0)
183 downscale_shift_ = 0; 168 downscale_shift_ = 0;
184 if (!up) { 169 if (!up) {
185 // First downscale hit, start using a slower threshold for going up. 170 // First downscale hit, start using a slower threshold for going up.
186 measure_seconds_upscale_ = kMeasureSecondsUpscale; 171 measure_seconds_upscale_ = kMeasureSecondsUpscale;
187 UpdateSampleCounts(); 172 UpdateSampleCounts();
188 } 173 }
189 } 174 }
190 175
191 } // namespace webrtc 176 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698