Mercurial > libavcodec.hg
diff utils.c @ 1799:95612d423fde libavcodec
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
author | michael |
---|---|
date | Fri, 13 Feb 2004 17:54:10 +0000 |
parents | a3da4b429984 |
children | a660ef952580 |
line wrap: on
line diff
--- a/utils.c Thu Feb 12 16:21:21 2004 +0000 +++ b/utils.c Fri Feb 13 17:54:10 2004 +0000 @@ -324,6 +324,16 @@ 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 @@ 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;