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

Unified Diff: media/filters/vpx_video_decoder.cc

Issue 55213002: media: Increase max number of decode threads for VP9 decodes at higher resolutions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copying my notes is hard. I meant >=, I swear... even the notes say >=. Oops. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/vpx_video_decoder.cc
diff --git a/media/filters/vpx_video_decoder.cc b/media/filters/vpx_video_decoder.cc
index 3c02d15f906c54e02378b93a6d1562a474118732..a3768b3dcd9a81de0b308c2962954c24b13678dd 100644
--- a/media/filters/vpx_video_decoder.cc
+++ b/media/filters/vpx_video_decoder.cc
@@ -42,17 +42,25 @@ static const int kDecodeThreads = 2;
static const int kMaxDecodeThreads = 16;
// Returns the number of threads.
-static int GetThreadCount() {
- // TODO(scherkus): De-duplicate this function and the one used by
- // FFmpegVideoDecoder.
-
+static int GetThreadCount(const VideoDecoderConfig& config) {
// Refer to http://crbug.com/93932 for tsan suppressions on decoding.
int decode_threads = kDecodeThreads;
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads));
- if (threads.empty() || !base::StringToInt(threads, &decode_threads))
+ if (threads.empty() || !base::StringToInt(threads, &decode_threads)) {
+ if (config.codec() == kCodecVP9) {
+ // For VP9 decode when using the default thread count, increase the number
+ // of decode threads to equal the maximum number of tiles possible for
+ // higher resolution streams.
+ if (config.coded_size().width() >= 2048)
scherkus (not reviewing) 2013/11/04 20:30:54 I don't know much about tiling, but do we need to
+ decode_threads = 8;
+ else if (config.coded_size().width() >= 1024)
+ decode_threads = 4;
+ }
+
return decode_threads;
+ }
decode_threads = std::max(decode_threads, 0);
decode_threads = std::min(decode_threads, kMaxDecodeThreads);
@@ -100,7 +108,7 @@ static vpx_codec_ctx* InitializeVpxContext(vpx_codec_ctx* context,
vpx_codec_dec_cfg_t vpx_config = {0};
vpx_config.w = config.coded_size().width();
vpx_config.h = config.coded_size().height();
- vpx_config.threads = GetThreadCount();
+ vpx_config.threads = GetThreadCount(config);
vpx_codec_err_t status = vpx_codec_dec_init(context,
config.codec() == kCodecVP9 ?
« 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