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/avcodec.h | |
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/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8f3b9dc640..eea51304d4 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -17,7 +17,7 @@ extern "C" { #define FFMPEG_VERSION_INT 0x000408 #define FFMPEG_VERSION "0.4.8" -#define LIBAVCODEC_BUILD 4701 +#define LIBAVCODEC_BUILD 4702 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION FFMPEG_VERSION @@ -1508,6 +1508,32 @@ typedef struct AVCodecContext { * - decoding: unused */ int quantizer_noise_shaping; + + /** + * Thread count. + * is used to decide how many independant tasks should be passed to execute() + * - encoding: set by user + * - decoding: set by user + */ + int thread_count; + + /** + * the codec may call this to execute several independant things. it will return only after + * finishing all tasks, the user may replace this with some multithreaded implementation, the + * default implementation will execute the parts serially + * @param count the number of functions this will be identical to thread_count if possible + * - encoding: set by lavc, user can override + * - decoding: set by lavc, user can override + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); + + /** + * Thread opaque. + * can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() + */ + void *thread_opaque; } AVCodecContext; @@ -1846,6 +1872,11 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); void avcodec_default_free_buffers(AVCodecContext *s); +int avcodec_pthread_init(AVCodecContext *s, int thread_count); +void avcodec_pthread_free(AVCodecContext *s); +int avcodec_pthread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); +//FIXME func typedef + /** * opens / inits the AVCodecContext. * not thread save! |