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

Side by Side Diff: webrtc/api/java/jni/androidmediaencoder_jni.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 | « no previous file | webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc » ('j') | 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 codec_mode_ = codec_settings->mode; 381 codec_mode_ = codec_settings->mode;
382 int init_width = codec_settings->width; 382 int init_width = codec_settings->width;
383 int init_height = codec_settings->height; 383 int init_height = codec_settings->height;
384 scale_ = codecType_ != kVideoCodecVP9; 384 scale_ = codecType_ != kVideoCodecVP9;
385 385
386 ALOGD << "InitEncode request: " << init_width << " x " << init_height; 386 ALOGD << "InitEncode request: " << init_width << " x " << init_height;
387 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); 387 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled");
388 388
389 if (scale_) { 389 if (scale_) {
390 if (codecType_ == kVideoCodecVP8) { 390 if (codecType_ == kVideoCodecVP8) {
391 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the 391 quality_scaler_.Init(
392 // (internal) range: [0, 127]. And we cannot change QP_max in HW, so it is 392 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold,
393 // always = 127. Note that in SW, QP is that of the user-level range [0, 393 codec_settings->startBitrate, codec_settings->width,
394 // 63]. 394 codec_settings->height, codec_settings->maxFramerate);
395 const int kLowQpThreshold = 29; 395 } else if (codecType_ == kVideoCodecH264) {
396 const int kBadQpThreshold = 90; 396 quality_scaler_.Init(QualityScaler::kLowH264QpThreshold,
397 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, 397 QualityScaler::kBadH264QpThreshold,
398 codec_settings->startBitrate, codec_settings->width, 398 codec_settings->startBitrate, codec_settings->width,
399 codec_settings->height, 399 codec_settings->height,
400 codec_settings->maxFramerate); 400 codec_settings->maxFramerate);
401 } else if (codecType_ == kVideoCodecH264) {
402 // H264 QP is in the range [0, 51].
403 const int kLowQpThreshold = 22;
404 const int kBadQpThreshold = 35;
405 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold,
406 codec_settings->startBitrate, codec_settings->width,
407 codec_settings->height,
408 codec_settings->maxFramerate);
409 } else { 401 } else {
410 // When adding codec support to additional hardware codecs, also configure 402 // When adding codec support to additional hardware codecs, also configure
411 // their QP thresholds for scaling. 403 // their QP thresholds for scaling.
412 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds."; 404 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds.";
413 scale_ = false; 405 scale_ = false;
414 } 406 }
415 QualityScaler::Resolution res = quality_scaler_.GetScaledResolution(); 407 QualityScaler::Resolution res = quality_scaler_.GetScaledResolution();
416 init_width = res.width; 408 init_width = res.width;
417 init_height = res.height; 409 init_height = res.height;
418 ALOGD << "Scaled resolution: " << init_width << " x " << init_height; 410 ALOGD << "Scaled resolution: " << init_width << " x " << init_height;
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 return supported_codecs_; 1261 return supported_codecs_;
1270 } 1262 }
1271 1263
1272 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1264 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1273 webrtc::VideoEncoder* encoder) { 1265 webrtc::VideoEncoder* encoder) {
1274 ALOGD << "Destroy video encoder."; 1266 ALOGD << "Destroy video encoder.";
1275 delete encoder; 1267 delete encoder;
1276 } 1268 }
1277 1269
1278 } // namespace webrtc_jni 1270 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698