| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // not to since current day CPUs tend to be multi-core and we measured | 44 // not to since current day CPUs tend to be multi-core and we measured |
| 45 // performance benefits on older machines such as P4s with hyperthreading. | 45 // performance benefits on older machines such as P4s with hyperthreading. |
| 46 static const int kDecodeThreads = 2; | 46 static const int kDecodeThreads = 2; |
| 47 static const int kMaxDecodeThreads = 16; | 47 static const int kMaxDecodeThreads = 16; |
| 48 | 48 |
| 49 // Returns the number of threads. | 49 // Returns the number of threads. |
| 50 static int GetThreadCount(const VideoDecoderConfig& config) { | 50 static int GetThreadCount(const VideoDecoderConfig& config) { |
| 51 // Refer to http://crbug.com/93932 for tsan suppressions on decoding. | 51 // Refer to http://crbug.com/93932 for tsan suppressions on decoding. |
| 52 int decode_threads = kDecodeThreads; | 52 int decode_threads = kDecodeThreads; |
| 53 | 53 |
| 54 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 54 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 55 std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads)); | 55 std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads)); |
| 56 if (threads.empty() || !base::StringToInt(threads, &decode_threads)) { | 56 if (threads.empty() || !base::StringToInt(threads, &decode_threads)) { |
| 57 if (config.codec() == kCodecVP9) { | 57 if (config.codec() == kCodecVP9) { |
| 58 // For VP9 decode when using the default thread count, increase the number | 58 // For VP9 decode when using the default thread count, increase the number |
| 59 // of decode threads to equal the maximum number of tiles possible for | 59 // of decode threads to equal the maximum number of tiles possible for |
| 60 // higher resolution streams. | 60 // higher resolution streams. |
| 61 if (config.coded_size().width() >= 2048) | 61 if (config.coded_size().width() >= 2048) |
| 62 decode_threads = 8; | 62 decode_threads = 8; |
| 63 else if (config.coded_size().width() >= 1024) | 63 else if (config.coded_size().width() >= 1024) |
| 64 decode_threads = 4; | 64 decode_threads = 4; |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 502 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
| 503 return; | 503 return; |
| 504 } | 504 } |
| 505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
| 506 vpx_image->stride[VPX_PLANE_Y], | 506 vpx_image->stride[VPX_PLANE_Y], |
| 507 vpx_image->d_h, | 507 vpx_image->d_h, |
| 508 video_frame->get()); | 508 video_frame->get()); |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace media | 511 } // namespace media |
| OLD | NEW |