Move the QP scaling thresholds to the relevant encoders.
Also provide a new set of thresholds for the VideoToolbox encoder. The new thresholds were experimentally determined to work well on the iPhone 6S, and also adequately on the iPhone 5S. BUG=webrtc:5678 Review-Url: https://codereview.webrtc.org/2309743002 Cr-Commit-Position: refs/heads/master@{#14420}
This commit is contained in:
@ -213,10 +213,9 @@ int32_t H264EncoderImpl::InitEncode(const VideoCodec* codec_settings,
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
// TODO(pbos): Base init params on these values before submitting.
|
||||
quality_scaler_.Init(QualityScaler::kLowH264QpThreshold,
|
||||
QualityScaler::kBadH264QpThreshold,
|
||||
codec_settings_.startBitrate, codec_settings_.width,
|
||||
codec_settings_.height, codec_settings_.maxFramerate);
|
||||
quality_scaler_.Init(codec_settings_.codecType, codec_settings_.startBitrate,
|
||||
codec_settings_.width, codec_settings_.height,
|
||||
codec_settings_.maxFramerate);
|
||||
int video_format = EVideoFormatType::videoFormatI420;
|
||||
openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT,
|
||||
&video_format);
|
||||
|
||||
@ -33,6 +33,10 @@ namespace internal {
|
||||
// kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher
|
||||
// than the average bit rate to avoid undershooting the target.
|
||||
const float kLimitToAverageBitRateFactor = 1.5f;
|
||||
// These thresholds deviate from the default h264 QP thresholds, as they
|
||||
// have been found to work better on devices that support VideoToolbox
|
||||
const int kLowH264QpThreshold = 28;
|
||||
const int kHighH264QpThreshold = 39;
|
||||
|
||||
// Convenience function for creating a dictionary.
|
||||
inline CFDictionaryRef CreateCFDictionary(CFTypeRef* keys,
|
||||
@ -232,8 +236,8 @@ int H264VideoToolboxEncoder::InitEncode(const VideoCodec* codec_settings,
|
||||
RTC_DCHECK_EQ(codec_settings->codecType, kVideoCodecH264);
|
||||
{
|
||||
rtc::CritScope lock(&quality_scaler_crit_);
|
||||
quality_scaler_.Init(QualityScaler::kLowH264QpThreshold,
|
||||
QualityScaler::kBadH264QpThreshold,
|
||||
quality_scaler_.Init(internal::kLowH264QpThreshold,
|
||||
internal::kHighH264QpThreshold,
|
||||
codec_settings->startBitrate, codec_settings->width,
|
||||
codec_settings->height, codec_settings->maxFramerate);
|
||||
QualityScaler::Resolution res = quality_scaler_.GetScaledResolution();
|
||||
|
||||
@ -562,9 +562,8 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
||||
}
|
||||
|
||||
rps_.Init();
|
||||
quality_scaler_.Init(QualityScaler::kLowVp8QpThreshold,
|
||||
QualityScaler::kBadVp8QpThreshold, codec_.startBitrate,
|
||||
codec_.width, codec_.height, codec_.maxFramerate);
|
||||
quality_scaler_.Init(codec_.codecType, codec_.startBitrate, codec_.width,
|
||||
codec_.height, codec_.maxFramerate);
|
||||
|
||||
// Only apply scaling to improve for single-layer streams. The scaling metrics
|
||||
// use frame drops as a signal and is only applicable when we drop frames.
|
||||
|
||||
Reference in New Issue
Block a user