[FFmpeg-cvslog] pthread: Limit automatic threads to mb_height.

Michael Niedermayer git at videolan.org
Sun Jan 1 02:49:38 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan  1 01:21:31 2012 +0100| [e404eee1e1eb81900170e8f10db1328520ed97ae] | committer: Michael Niedermayer

pthread: Limit automatic threads to mb_height.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e404eee1e1eb81900170e8f10db1328520ed97ae
---

 libavcodec/pthread.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index a338dbe..1144011 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);
 }
 



More information about the ffmpeg-cvslog mailing list