summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-01 01:21:31 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-01 02:39:06 +0100
commite404eee1e1eb81900170e8f10db1328520ed97ae (patch)
tree7987511e17ac721c03436d4b97aa78dca7acab50 /libavcodec/pthread.c
parent9c1f0493d5582f2c7b12dd16b70062cf233066b0 (diff)
pthread: Limit automatic threads to mb_height.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c4
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);
}