OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 inited_(false), | 119 inited_(false), |
120 timestamp_(0), | 120 timestamp_(0), |
121 feedback_mode_(false), | 121 feedback_mode_(false), |
122 qp_max_(56), // Setting for max quantizer. | 122 qp_max_(56), // Setting for max quantizer. |
123 cpu_speed_default_(-6), | 123 cpu_speed_default_(-6), |
124 number_of_cores_(0), | 124 number_of_cores_(0), |
125 rc_max_intra_target_(0), | 125 rc_max_intra_target_(0), |
126 token_partitions_(VP8_ONE_TOKENPARTITION), | 126 token_partitions_(VP8_ONE_TOKENPARTITION), |
127 down_scale_requested_(false), | 127 down_scale_requested_(false), |
128 down_scale_bitrate_(0), | 128 down_scale_bitrate_(0), |
129 use_gf_boost_(webrtc::field_trial::IsEnabled("WebRTC-VP8-GfBoost")), | |
129 key_frame_request_(kMaxSimulcastStreams, false) { | 130 key_frame_request_(kMaxSimulcastStreams, false) { |
130 uint32_t seed = rtc::Time32(); | 131 uint32_t seed = rtc::Time32(); |
131 srand(seed); | 132 srand(seed); |
132 | 133 |
133 picture_id_.reserve(kMaxSimulcastStreams); | 134 picture_id_.reserve(kMaxSimulcastStreams); |
134 last_key_frame_picture_id_.reserve(kMaxSimulcastStreams); | 135 last_key_frame_picture_id_.reserve(kMaxSimulcastStreams); |
135 temporal_layers_.reserve(kMaxSimulcastStreams); | 136 temporal_layers_.reserve(kMaxSimulcastStreams); |
136 raw_images_.reserve(kMaxSimulcastStreams); | 137 raw_images_.reserve(kMaxSimulcastStreams); |
137 encoded_images_.reserve(kMaxSimulcastStreams); | 138 encoded_images_.reserve(kMaxSimulcastStreams); |
138 send_stream_.reserve(kMaxSimulcastStreams); | 139 send_stream_.reserve(kMaxSimulcastStreams); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 codec_.mode == kScreensharing ? 300 : 1); | 628 codec_.mode == kScreensharing ? 300 : 1); |
628 vpx_codec_control(&(encoders_[i]), VP8E_SET_CPUUSED, cpu_speed_[i]); | 629 vpx_codec_control(&(encoders_[i]), VP8E_SET_CPUUSED, cpu_speed_[i]); |
629 vpx_codec_control(&(encoders_[i]), VP8E_SET_TOKEN_PARTITIONS, | 630 vpx_codec_control(&(encoders_[i]), VP8E_SET_TOKEN_PARTITIONS, |
630 static_cast<vp8e_token_partitions>(token_partitions_)); | 631 static_cast<vp8e_token_partitions>(token_partitions_)); |
631 vpx_codec_control(&(encoders_[i]), VP8E_SET_MAX_INTRA_BITRATE_PCT, | 632 vpx_codec_control(&(encoders_[i]), VP8E_SET_MAX_INTRA_BITRATE_PCT, |
632 rc_max_intra_target_); | 633 rc_max_intra_target_); |
633 // VP8E_SET_SCREEN_CONTENT_MODE 2 = screen content with more aggressive | 634 // VP8E_SET_SCREEN_CONTENT_MODE 2 = screen content with more aggressive |
634 // rate control (drop frames on large target bitrate overshoot) | 635 // rate control (drop frames on large target bitrate overshoot) |
635 vpx_codec_control(&(encoders_[i]), VP8E_SET_SCREEN_CONTENT_MODE, | 636 vpx_codec_control(&(encoders_[i]), VP8E_SET_SCREEN_CONTENT_MODE, |
636 codec_.mode == kScreensharing ? 2 : 0); | 637 codec_.mode == kScreensharing ? 2 : 0); |
638 // Apply boost on golden frames (has only effect when resilience is off). | |
639 if (use_gf_boost_ && codec_.VP8()->resilience == kResilienceOff) { | |
640 const int kGfBoostPercent = 50; | |
brandtr
2017/03/10 08:21:31
Maybe we should send in this value as part of the
åsapersson
2017/03/10 11:01:40
Sounds good. Done.
| |
641 vpx_codec_control(&(encoders_[i]), VP8E_SET_GF_CBR_BOOST_PCT, | |
642 kGfBoostPercent); | |
643 } | |
637 } | 644 } |
638 inited_ = true; | 645 inited_ = true; |
639 return WEBRTC_VIDEO_CODEC_OK; | 646 return WEBRTC_VIDEO_CODEC_OK; |
640 } | 647 } |
641 | 648 |
642 uint32_t VP8EncoderImpl::MaxIntraTarget(uint32_t optimalBuffersize) { | 649 uint32_t VP8EncoderImpl::MaxIntraTarget(uint32_t optimalBuffersize) { |
643 // Set max to the optimal buffer level (normalized by target BR), | 650 // Set max to the optimal buffer level (normalized by target BR), |
644 // and scaled by a scalePar. | 651 // and scaled by a scalePar. |
645 // Max target size = scalePar * optimalBufferSize * targetBR[Kbps]. | 652 // Max target size = scalePar * optimalBufferSize * targetBR[Kbps]. |
646 // This values is presented in percentage of perFrameBw: | 653 // This values is presented in percentage of perFrameBw: |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 return -1; | 1309 return -1; |
1303 } | 1310 } |
1304 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1311 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1305 VPX_CODEC_OK) { | 1312 VPX_CODEC_OK) { |
1306 return -1; | 1313 return -1; |
1307 } | 1314 } |
1308 return 0; | 1315 return 0; |
1309 } | 1316 } |
1310 | 1317 |
1311 } // namespace webrtc | 1318 } // namespace webrtc |
OLD | NEW |