comparison avcodec.h @ 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 5e5c3d4a1e82
children 6d762acfff5d
comparison
equal deleted inserted replaced
1798:a3da4b429984 1799:95612d423fde
15 #include "rational.h" 15 #include "rational.h"
16 #include <sys/types.h> /* size_t */ 16 #include <sys/types.h> /* size_t */
17 17
18 #define FFMPEG_VERSION_INT 0x000408 18 #define FFMPEG_VERSION_INT 0x000408
19 #define FFMPEG_VERSION "0.4.8" 19 #define FFMPEG_VERSION "0.4.8"
20 #define LIBAVCODEC_BUILD 4701 20 #define LIBAVCODEC_BUILD 4702
21 21
22 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT 22 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
23 #define LIBAVCODEC_VERSION FFMPEG_VERSION 23 #define LIBAVCODEC_VERSION FFMPEG_VERSION
24 24
25 #define AV_STRINGIFY(s) AV_TOSTRING(s) 25 #define AV_STRINGIFY(s) AV_TOSTRING(s)
1506 * Quantizer noise shaping. 1506 * Quantizer noise shaping.
1507 * - encoding: set by user 1507 * - encoding: set by user
1508 * - decoding: unused 1508 * - decoding: unused
1509 */ 1509 */
1510 int quantizer_noise_shaping; 1510 int quantizer_noise_shaping;
1511
1512 /**
1513 * Thread count.
1514 * is used to decide how many independant tasks should be passed to execute()
1515 * - encoding: set by user
1516 * - decoding: set by user
1517 */
1518 int thread_count;
1519
1520 /**
1521 * the codec may call this to execute several independant things. it will return only after
1522 * finishing all tasks, the user may replace this with some multithreaded implementation, the
1523 * default implementation will execute the parts serially
1524 * @param count the number of functions this will be identical to thread_count if possible
1525 * - encoding: set by lavc, user can override
1526 * - decoding: set by lavc, user can override
1527 */
1528 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count);
1529
1530 /**
1531 * Thread opaque.
1532 * can be used by execute() to store some per AVCodecContext stuff.
1533 * - encoding: set by execute()
1534 * - decoding: set by execute()
1535 */
1536 void *thread_opaque;
1511 } AVCodecContext; 1537 } AVCodecContext;
1512 1538
1513 1539
1514 /** 1540 /**
1515 * AVOption. 1541 * AVOption.
1844 1870
1845 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); 1871 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1846 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); 1872 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1847 void avcodec_default_free_buffers(AVCodecContext *s); 1873 void avcodec_default_free_buffers(AVCodecContext *s);
1848 1874
1875 int avcodec_pthread_init(AVCodecContext *s, int thread_count);
1876 void avcodec_pthread_free(AVCodecContext *s);
1877 int avcodec_pthread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
1878 //FIXME func typedef
1879
1849 /** 1880 /**
1850 * opens / inits the AVCodecContext. 1881 * opens / inits the AVCodecContext.
1851 * not thread save! 1882 * not thread save!
1852 */ 1883 */
1853 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); 1884 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);