diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-02-13 17:54:10 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-02-13 17:54:10 +0000 |
commit | 9c3d33d67f2260d5ddc888e8ea380c3913e38a72 (patch) | |
tree | 46c82202d3f7c2964f7cace9e1131e97ada124bb /libavcodec/utils.c | |
parent | 7984082a08cf2119da3433c245b72a91020b879d (diff) | |
download | ffmpeg-9c3d33d67f2260d5ddc888e8ea380c3913e38a72.tar.gz |
multithreaded/SMP motion estimation
multithreaded/SMP encoding for MPEG1/MPEG2/MPEG4/H263
all pthread specific code is in pthread.c
to try it, run configure --enable-pthreads and ffmpeg ... -threads <num>
the internal thread API is a simple AVCodecContext.execute() callback which executes a given function pointer with different arguments and returns after finishing all, that way no mutexes or other thread-mess is needed outside pthread.c
Originally committed as revision 2772 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d04c2faaf0..e49ddd07f0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -324,6 +324,16 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ return 0; } +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ + int i; + + for(i=0; i<count; i++){ + int r= func(c, arg[i]); + if(ret) ret[i]= r; + } + return 0; +} + enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ return fmt[0]; } @@ -352,6 +362,8 @@ void avcodec_get_context_defaults(AVCodecContext *s){ s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; + s->execute= avcodec_default_execute; + s->thread_count=1; s->me_subpel_quality=8; s->lmin= FF_QP2LAMBDA * s->qmin; s->lmax= FF_QP2LAMBDA * s->qmax; |