diff options
author | Yunqing Wang <yunqingwang@google.com> | 2011-05-05 04:59:54 -0700 |
---|---|---|
committer | Code Review <code-review@webmproject.org> | 2011-05-05 04:59:54 -0700 |
commit | aeb86d615c87d80cfd4127c915812e1299f80a33 (patch) | |
tree | c37bb2e465b6a93568a5c3c7689fbdd586e3d13d /vp8/decoder | |
parent | 3fbade23a2c6eb060f7c65df210bc84f1a801165 (diff) | |
parent | 297b27655eaf4a0cfd097b2ae94add4b19fed9eb (diff) | |
download | libvpx-aeb86d615c87d80cfd4127c915812e1299f80a33.tar libvpx-aeb86d615c87d80cfd4127c915812e1299f80a33.tar.gz libvpx-aeb86d615c87d80cfd4127c915812e1299f80a33.tar.bz2 libvpx-aeb86d615c87d80cfd4127c915812e1299f80a33.zip |
Merge "Runtime detection of available processor cores."
Diffstat (limited to 'vp8/decoder')
-rw-r--r-- | vp8/decoder/threading.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index 56275940e..9ef85e9cd 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -439,12 +439,18 @@ void vp8_decoder_create_threads(VP8D_COMP *pbi) pbi->b_multithreaded_rd = 0; pbi->allocated_decoding_thread_count = 0; - core_count = (pbi->max_threads > 16) ? 16 : pbi->max_threads; + + /* limit decoding threads to the max number of token partitions */ + core_count = (pbi->max_threads > 8) ? 8 : pbi->max_threads; + + /* limit decoding threads to the available cores */ + if (core_count > pbi->common.processor_core_count) + core_count = pbi->common.processor_core_count; if (core_count > 1) { pbi->b_multithreaded_rd = 1; - pbi->decoding_thread_count = core_count -1; + pbi->decoding_thread_count = core_count - 1; CHECK_MEM_ERROR(pbi->h_decoding_thread, vpx_malloc(sizeof(pthread_t) * pbi->decoding_thread_count)); CHECK_MEM_ERROR(pbi->h_event_start_decoding, vpx_malloc(sizeof(sem_t) * pbi->decoding_thread_count)); |