summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-02 02:48:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-02 03:10:30 +0100
commit4121148388f4fd02ace89eca364904d3ea8bcfe7 (patch)
treec346f6906942b7a12c5c1f06e9d11205ea5660ab /libavcodec/pthread.c
parentef611095f0d0c1256cbb6654f94cae61a60f2736 (diff)
parentf15f02c204e5fe355e084923c34dda1c6c3a66ec (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avconv: make -frames work for all types of streams, not just video. bfi: K&R cosmetics bgmc: K&R cleanup rawdec: Set start_time to 0 for raw audio files. Detect 'yuv2' as rawvideo also in avi. rawdec: propagate pict_type information to the output frame rawdec: Support more QT 1bpp rawvideo files. avconv: free bitstream filters threads: limit the number of automatic threads to MAX_AUTO_THREADS avplay: K&R cleanup fate: use rgb24 as output format for dfa tests threads: set thread_count to 1 when thread support is disabled threads: introduce CODEC_CAP_AUTO_THREADS and add it to libx264 Conflicts: ffplay.c libavcodec/avcodec.h libavcodec/pthread.c libavcodec/version.h tests/ref/fate/dfa1 tests/ref/fate/dfa10 tests/ref/fate/dfa11 tests/ref/fate/dfa2 tests/ref/fate/dfa3 tests/ref/fate/dfa4 tests/ref/fate/dfa5 tests/ref/fate/dfa6 tests/ref/fate/dfa7 tests/ref/fate/dfa8 tests/ref/fate/dfa9 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index cdf3a391cc..717b865bae 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -193,7 +193,7 @@ static int get_logical_cpus(AVCodecContext *avctx)
if (avctx->height)
nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16);
- return FFMIN(nb_cpus, MAX_AUTO_THREADS);
+ return nb_cpus;
}
@@ -303,9 +303,11 @@ static int thread_init(AVCodecContext *avctx)
if (!thread_count) {
int nb_cpus = get_logical_cpus(avctx);
- // use number of cores + 1 as thread count if there is motre than one
+ // use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
- thread_count = avctx->thread_count = nb_cpus + 1;
+ thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
+ else
+ thread_count = avctx->thread_count = 1;
}
if (thread_count <= 1) {
@@ -783,9 +785,11 @@ static int frame_thread_init(AVCodecContext *avctx)
int nb_cpus = get_logical_cpus(avctx);
if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv)
nb_cpus = 1;
- // use number of cores + 1 as thread count if there is motre than one
+ // use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
- thread_count = avctx->thread_count = nb_cpus + 1;
+ thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
+ else
+ thread_count = avctx->thread_count = 1;
}
if (thread_count <= 1) {
@@ -1002,6 +1006,9 @@ static void validate_thread_parameters(AVCodecContext *avctx)
} else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS &&
avctx->thread_type & FF_THREAD_SLICE) {
avctx->active_thread_type = FF_THREAD_SLICE;
+ } else if (!(avctx->codec->capabilities & CODEC_CAP_AUTO_THREADS)) {
+ avctx->thread_count = 1;
+ avctx->active_thread_type = 0;
}
}