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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 2463033002: vp8_impl.cc: Adjust cpu speed setting for arm for devices with 4 or more cores. (Closed)
Patch Set: address comment Created 4 years, 1 month 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 | « webrtc/modules/video_coding/codecs/vp8/vp8_impl.h ('k') | 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 (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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 VP8EncoderImpl::VP8EncoderImpl() 113 VP8EncoderImpl::VP8EncoderImpl()
114 : encoded_complete_callback_(nullptr), 114 : encoded_complete_callback_(nullptr),
115 rate_allocator_(new SimulcastRateAllocator(codec_)), 115 rate_allocator_(new SimulcastRateAllocator(codec_)),
116 inited_(false), 116 inited_(false),
117 timestamp_(0), 117 timestamp_(0),
118 feedback_mode_(false), 118 feedback_mode_(false),
119 qp_max_(56), // Setting for max quantizer. 119 qp_max_(56), // Setting for max quantizer.
120 cpu_speed_default_(-6), 120 cpu_speed_default_(-6),
121 number_of_cores_(0),
121 rc_max_intra_target_(0), 122 rc_max_intra_target_(0),
122 token_partitions_(VP8_ONE_TOKENPARTITION), 123 token_partitions_(VP8_ONE_TOKENPARTITION),
123 down_scale_requested_(false), 124 down_scale_requested_(false),
124 down_scale_bitrate_(0), 125 down_scale_bitrate_(0),
125 key_frame_request_(kMaxSimulcastStreams, false), 126 key_frame_request_(kMaxSimulcastStreams, false),
126 quality_scaler_enabled_(false) { 127 quality_scaler_enabled_(false) {
127 uint32_t seed = rtc::Time32(); 128 uint32_t seed = rtc::Time32();
128 srand(seed); 129 srand(seed);
129 130
130 picture_id_.reserve(kMaxSimulcastStreams); 131 picture_id_.reserve(kMaxSimulcastStreams);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 doing_simulcast ? inst->simulcastStream[0].numberOfTemporalLayers 351 doing_simulcast ? inst->simulcastStream[0].numberOfTemporalLayers
351 : inst->VP8().numberOfTemporalLayers; 352 : inst->VP8().numberOfTemporalLayers;
352 353
353 // TODO(andresp): crash if num temporal layers is bananas. 354 // TODO(andresp): crash if num temporal layers is bananas.
354 if (num_temporal_layers < 1) 355 if (num_temporal_layers < 1)
355 num_temporal_layers = 1; 356 num_temporal_layers = 1;
356 SetupTemporalLayers(number_of_streams, num_temporal_layers, *inst); 357 SetupTemporalLayers(number_of_streams, num_temporal_layers, *inst);
357 358
358 feedback_mode_ = inst->VP8().feedbackModeOn; 359 feedback_mode_ = inst->VP8().feedbackModeOn;
359 360
361 number_of_cores_ = number_of_cores;
360 timestamp_ = 0; 362 timestamp_ = 0;
361 codec_ = *inst; 363 codec_ = *inst;
362 rate_allocator_.reset(new SimulcastRateAllocator(codec_)); 364 rate_allocator_.reset(new SimulcastRateAllocator(codec_));
363 365
364 // Code expects simulcastStream resolutions to be correct, make sure they are 366 // Code expects simulcastStream resolutions to be correct, make sure they are
365 // filled even when there are no simulcast layers. 367 // filled even when there are no simulcast layers.
366 if (codec_.numberOfSimulcastStreams == 0) { 368 if (codec_.numberOfSimulcastStreams == 0) {
367 codec_.simulcastStream[0].width = codec_.width; 369 codec_.simulcastStream[0].width = codec_.width;
368 codec_.simulcastStream[0].height = codec_.height; 370 codec_.simulcastStream[0].height = codec_.height;
369 } 371 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // use frame drops as a signal and is only applicable when we drop frames. 562 // use frame drops as a signal and is only applicable when we drop frames.
561 quality_scaler_enabled_ = encoders_.size() == 1 && 563 quality_scaler_enabled_ = encoders_.size() == 1 &&
562 configurations_[0].rc_dropframe_thresh > 0 && 564 configurations_[0].rc_dropframe_thresh > 0 &&
563 codec_.VP8()->automaticResizeOn; 565 codec_.VP8()->automaticResizeOn;
564 566
565 return InitAndSetControlSettings(); 567 return InitAndSetControlSettings();
566 } 568 }
567 569
568 int VP8EncoderImpl::SetCpuSpeed(int width, int height) { 570 int VP8EncoderImpl::SetCpuSpeed(int width, int height) {
569 #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) 571 #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID)
570 // On mobile platform, always set to -12 to leverage between cpu usage 572 // On mobile platform, use a lower speed setting for lower resolutions for
571 // and video quality. 573 // CPUs with 4 or more cores.
572 return -12; 574 RTC_DCHECK_GT(number_of_cores_, 0);
575 if (number_of_cores_ <= 3)
576 return -12;
577
578 if (width * height <= 352 * 288)
579 return -8;
580 else if (width * height <= 640 * 480)
581 return -10;
582 else
583 return -12;
573 #else 584 #else
574 // For non-ARM, increase encoding complexity (i.e., use lower speed setting) 585 // For non-ARM, increase encoding complexity (i.e., use lower speed setting)
575 // if resolution is below CIF. Otherwise, keep the default/user setting 586 // if resolution is below CIF. Otherwise, keep the default/user setting
576 // (|cpu_speed_default_|) set on InitEncode via VP8().complexity. 587 // (|cpu_speed_default_|) set on InitEncode via VP8().complexity.
577 if (width * height < 352 * 288) 588 if (width * height < 352 * 288)
578 return (cpu_speed_default_ < -4) ? -4 : cpu_speed_default_; 589 return (cpu_speed_default_ < -4) ? -4 : cpu_speed_default_;
579 else 590 else
580 return cpu_speed_default_; 591 return cpu_speed_default_;
581 #endif 592 #endif
582 } 593 }
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 return -1; 1326 return -1;
1316 } 1327 }
1317 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1328 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1318 VPX_CODEC_OK) { 1329 VPX_CODEC_OK) {
1319 return -1; 1330 return -1;
1320 } 1331 }
1321 return 0; 1332 return 0;
1322 } 1333 }
1323 1334
1324 } // namespace webrtc 1335 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/vp8_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698