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

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

Issue 2058753003: Adjust the amount of VP8 encoder threads for Android builds. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 6 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 | 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 // if resolution is below CIF. Otherwise, keep the default/user setting 626 // if resolution is below CIF. Otherwise, keep the default/user setting
627 // (|cpu_speed_default_|) set on InitEncode via codecSpecific.VP8.complexity. 627 // (|cpu_speed_default_|) set on InitEncode via codecSpecific.VP8.complexity.
628 if (width * height < 352 * 288) 628 if (width * height < 352 * 288)
629 return (cpu_speed_default_ < -4) ? -4 : cpu_speed_default_; 629 return (cpu_speed_default_ < -4) ? -4 : cpu_speed_default_;
630 else 630 else
631 return cpu_speed_default_; 631 return cpu_speed_default_;
632 #endif 632 #endif
633 } 633 }
634 634
635 int VP8EncoderImpl::NumberOfThreads(int width, int height, int cpus) { 635 int VP8EncoderImpl::NumberOfThreads(int width, int height, int cpus) {
636 #if defined(ANDROID)
637 if (width * height >= 320 * 180) {
638 if (cpus >= 4) {
639 // 3 threads for CPUs with 4 and more cores since most of times only 4
640 // cores will be active.
641 return 3;
642 } else if (cpus == 3 || cpus == 2) {
643 return 2;
644 } else {
645 return 1;
646 }
647 }
648 return 1;
649 #else
636 if (width * height >= 1920 * 1080 && cpus > 8) { 650 if (width * height >= 1920 * 1080 && cpus > 8) {
637 return 8; // 8 threads for 1080p on high perf machines. 651 return 8; // 8 threads for 1080p on high perf machines.
638 } else if (width * height > 1280 * 960 && cpus >= 6) { 652 } else if (width * height > 1280 * 960 && cpus >= 6) {
639 // 3 threads for 1080p. 653 // 3 threads for 1080p.
640 return 3; 654 return 3;
641 } else if (width * height > 640 * 480 && cpus >= 3) { 655 } else if (width * height > 640 * 480 && cpus >= 3) {
642 // 2 threads for qHD/HD. 656 // 2 threads for qHD/HD.
643 return 2; 657 return 2;
644 } else { 658 } else {
645 // 1 thread for VGA or less. 659 // 1 thread for VGA or less.
646 return 1; 660 return 1;
647 } 661 }
662 #endif
648 } 663 }
649 664
650 int VP8EncoderImpl::InitAndSetControlSettings() { 665 int VP8EncoderImpl::InitAndSetControlSettings() {
651 vpx_codec_flags_t flags = 0; 666 vpx_codec_flags_t flags = 0;
652 flags |= VPX_CODEC_USE_OUTPUT_PARTITION; 667 flags |= VPX_CODEC_USE_OUTPUT_PARTITION;
653 668
654 if (encoders_.size() > 1) { 669 if (encoders_.size() > 1) {
655 int error = vpx_codec_enc_init_multi(&encoders_[0], vpx_codec_vp8_cx(), 670 int error = vpx_codec_enc_init_multi(&encoders_[0], vpx_codec_vp8_cx(),
656 &configurations_[0], encoders_.size(), 671 &configurations_[0], encoders_.size(),
657 flags, &downsampling_factors_[0]); 672 flags, &downsampling_factors_[0]);
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 return -1; 1431 return -1;
1417 } 1432 }
1418 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1433 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1419 VPX_CODEC_OK) { 1434 VPX_CODEC_OK) {
1420 return -1; 1435 return -1;
1421 } 1436 }
1422 return 0; 1437 return 0;
1423 } 1438 }
1424 1439
1425 } // namespace webrtc 1440 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698