diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-01 04:21:31 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-01 05:39:06 +0400 |
commit | e404eee1e1eb81900170e8f10db1328520ed97ae (patch) | |
tree | 7987511e17ac721c03436d4b97aa78dca7acab50 /libavcodec | |
parent | 9c1f0493d5582f2c7b12dd16b70062cf233066b0 (diff) |
pthread: Limit automatic threads to mb_height.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pthread.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index a338dbedef..1144011a91 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -189,6 +189,10 @@ static int get_logical_cpus(AVCodecContext *avctx) nb_cpus = sysconf(_SC_NPROCESSORS_ONLN); #endif av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); + + if (avctx->height) + nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16); + return FFMIN(nb_cpus, MAX_AUTO_THREADS); } |