[FFmpeg-cvslog] avcodec: remove ff_get_logical_cpus()
Michael Niedermayer
git at videolan.org
Fri May 24 21:03:06 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 24 20:24:29 2013 +0200| [42bb3e4db672ebb6d8b86e869602a02dcae0f4ca] | committer: Michael Niedermayer
avcodec: remove ff_get_logical_cpus()
This simplifies the code
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42bb3e4db672ebb6d8b86e869602a02dcae0f4ca
---
libavcodec/frame_thread_encoder.c | 2 +-
libavcodec/internal.h | 2 --
libavcodec/pthread.c | 13 +++----------
3 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 98c50ab..80577ec 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -126,7 +126,7 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
return 0;
if(!avctx->thread_count) {
- avctx->thread_count = ff_get_logical_cpus(avctx);
+ avctx->thread_count = av_cpu_count();
avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS);
}
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 4962f06..754d062 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -207,8 +207,6 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame);
int ff_thread_can_start_frame(AVCodecContext *avctx);
-int ff_get_logical_cpus(AVCodecContext *avctx);
-
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx);
/**
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 41d6d62..2433880 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -146,15 +146,6 @@ typedef struct FrameThreadContext {
* limit the number of threads to 16 for automatic detection */
#define MAX_AUTO_THREADS 16
-int ff_get_logical_cpus(AVCodecContext *avctx)
-{
- int nb_cpus = av_cpu_count();
- if (avctx->height)
- nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16);
-
- return nb_cpus;
-}
-
static void* attribute_align_arg worker(void *v)
{
AVCodecContext *avctx = v;
@@ -265,7 +256,9 @@ static int thread_init(AVCodecContext *avctx)
int thread_count = avctx->thread_count;
if (!thread_count) {
- int nb_cpus = ff_get_logical_cpus(avctx);
+ int nb_cpus = av_cpu_count();
+ if (avctx->height)
+ nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16);
// use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
More information about the ffmpeg-cvslog
mailing list