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

Side by Side Diff: webrtc/api/java/jni/androidmediaencoder_jni.cc

Issue 1954433002: Tune QP threshold for HW codecs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: 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 | « no previous file | 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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 ALOGD << "InitEncode request: " << init_width << " x " << init_height; 385 ALOGD << "InitEncode request: " << init_width << " x " << init_height;
386 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); 386 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled");
387 387
388 if (scale_) { 388 if (scale_) {
389 if (codecType_ == kVideoCodecVP8) { 389 if (codecType_ == kVideoCodecVP8) {
390 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the 390 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the
391 // (internal) range: [0, 127]. And we cannot change QP_max in HW, so it is 391 // (internal) range: [0, 127]. And we cannot change QP_max in HW, so it is
392 // always = 127. Note that in SW, QP is that of the user-level range [0, 392 // always = 127. Note that in SW, QP is that of the user-level range [0,
393 // 63]. 393 // 63].
394 const int kLowQpThreshold = 29; 394 const int kLowQpThreshold = 29;
395 const int kBadQpThreshold = 100; 395 const int kBadQpThreshold = 90;
396 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, 396 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold,
397 codec_settings->startBitrate, codec_settings->width, 397 codec_settings->startBitrate, codec_settings->width,
398 codec_settings->height, 398 codec_settings->height,
399 codec_settings->maxFramerate); 399 codec_settings->maxFramerate);
400 } else if (codecType_ == kVideoCodecH264) { 400 } else if (codecType_ == kVideoCodecH264) {
401 // H264 QP is in the range [0, 51]. 401 // H264 QP is in the range [0, 51].
402 const int kLowQpThreshold = 24; 402 const int kLowQpThreshold = 22;
403 const int kBadQpThreshold = 39; 403 const int kBadQpThreshold = 35;
404 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, 404 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold,
405 codec_settings->startBitrate, codec_settings->width, 405 codec_settings->startBitrate, codec_settings->width,
406 codec_settings->height, 406 codec_settings->height,
407 codec_settings->maxFramerate); 407 codec_settings->maxFramerate);
408 } else { 408 } else {
409 // When adding codec support to additional hardware codecs, also configure 409 // When adding codec support to additional hardware codecs, also configure
410 // their QP thresholds for scaling. 410 // their QP thresholds for scaling.
411 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds."; 411 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds.";
412 scale_ = false; 412 scale_ = false;
413 } 413 }
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return supported_codecs_; 1268 return supported_codecs_;
1269 } 1269 }
1270 1270
1271 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1271 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1272 webrtc::VideoEncoder* encoder) { 1272 webrtc::VideoEncoder* encoder) {
1273 ALOGD << "Destroy video encoder."; 1273 ALOGD << "Destroy video encoder.";
1274 delete encoder; 1274 delete encoder;
1275 } 1275 }
1276 1276
1277 } // namespace webrtc_jni 1277 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698