diff options
author | hkuang <hkuang@google.com> | 2015-02-09 16:25:20 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2015-02-09 16:25:20 -0800 |
commit | 1cdb5439e74061234e518519e7768f543d8d5a37 (patch) | |
tree | b5cd1573a2367d8946d534f04845a9dec5b1a811 | |
parent | 07eb8c8da3d0cd5b6339d90a677c3d824d787c86 (diff) | |
parent | dd88f482964a0fb4c8044ff7ff82adbc014daa5b (diff) | |
download | libvpx-1cdb5439e74061234e518519e7768f543d8d5a37.tar libvpx-1cdb5439e74061234e518519e7768f543d8d5a37.tar.gz libvpx-1cdb5439e74061234e518519e7768f543d8d5a37.tar.bz2 libvpx-1cdb5439e74061234e518519e7768f543d8d5a37.zip |
Merge "Set the maximum decode threads to be 8."
-rw-r--r-- | vp9/common/vp9_thread.h | 8 | ||||
-rw-r--r-- | vp9/vp9_dx_iface.c | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/vp9/common/vp9_thread.h b/vp9/common/vp9_thread.h index 864579c03..c24ef5fac 100644 --- a/vp9/common/vp9_thread.h +++ b/vp9/common/vp9_thread.h @@ -22,6 +22,10 @@ extern "C" { #endif +// Set maximum decode threads to be 8 due to the limit of frame buffers +// and not enough semaphores in the emulation layer on windows. +#define MAX_DECODE_THREADS 8 + #if CONFIG_MULTITHREAD #if defined(_WIN32) @@ -103,8 +107,8 @@ static INLINE int pthread_cond_destroy(pthread_cond_t *const condition) { static INLINE int pthread_cond_init(pthread_cond_t *const condition, void* cond_attr) { (void)cond_attr; - condition->waiting_sem_ = CreateSemaphore(NULL, 0, 1, NULL); - condition->received_sem_ = CreateSemaphore(NULL, 0, 1, NULL); + condition->waiting_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL); + condition->received_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL); condition->signal_event_ = CreateEvent(NULL, FALSE, FALSE, NULL); if (condition->waiting_sem_ == NULL || condition->received_sem_ == NULL || diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c index 4e0f4e5d3..1b72f3f4e 100644 --- a/vp9/vp9_dx_iface.c +++ b/vp9/vp9_dx_iface.c @@ -363,6 +363,8 @@ static vpx_codec_err_t init_decoder(vpx_codec_alg_priv_t *ctx) { ctx->num_cache_frames = 0; ctx->num_frame_workers = (ctx->frame_parallel_decode == 1) ? ctx->cfg.threads: 1; + if (ctx->num_frame_workers > MAX_DECODE_THREADS) + ctx->num_frame_workers = MAX_DECODE_THREADS; ctx->available_threads = ctx->num_frame_workers; ctx->flushed = 0; |