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

Unified Diff: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm

Issue 2309743002: Move the QP scaling thresholds to the relevant encoders (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
index 2d1e2a1416d350e02da3db3a17f7ec00a085c206..6c57202f820abd592c97f9f1948ef51025718a23 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
@@ -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,10 +236,11 @@ 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(codec_settings->codecType,
codec_settings->startBitrate, codec_settings->width,
- codec_settings->height, codec_settings->maxFramerate);
+ codec_settings->height, codec_settings->maxFramerate,
+ internal::kLowH264QpThreshold,
+ internal::kHighH264QpThreshold);
QualityScaler::Resolution res = quality_scaler_.GetScaledResolution();
// TODO(tkchin): We may need to enforce width/height dimension restrictions
// to match what the encoder supports.

Powered by Google App Engine
This is Rietveld 408576698