64 static void* attribute_align_arg
worker(
void *v)
68 unsigned last_execute = 0;
94 c->
func2(avctx, c->
args, our_job, self_id);
206 if (thread_count <= 1) {
230 for (i=0; i<thread_count; i++) {
262 if (!entries || !field)
return;
267 while ((entries[field - 1] - entries[field]) < shift){
static av_unused void w32thread_init(void)
const struct AVCodec * codec
int ff_slice_thread_init(AVCodecContext *avctx)
static int shift(int a, int b)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Memory handling functions.
int( action_func)(AVCodecContext *c, void *arg)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
pthread_cond_t current_job_cond
int av_codec_is_encoder(const AVCodec *codec)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Multithreading support functions.
pthread_mutex_t * progress_mutex
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
static void *attribute_align_arg worker(void *v)
pthread_mutex_t current_job_lock
int active_thread_type
Which multithreading methods are in use by the codec.
simple assert() macros that are a bit more flexible than ISO C assert().
void ff_thread_free(AVCodecContext *avctx)
static void * av_mallocz_array(size_t nmemb, size_t size)
int ff_alloc_entries(AVCodecContext *avctx, int count)
static int thread_execute2(AVCodecContext *avctx, action_func2 *func2, void *arg, int *ret, int job_count)
void ff_slice_thread_free(AVCodecContext *avctx)
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
pthread_cond_t * progress_cond
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
void ff_reset_entries(AVCodecContext *avctx)
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Libavcodec external API header.
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
main external API structure.
static av_always_inline void thread_park_workers(SliceThreadContext *c, int thread_count)
int(* func)(AVBPrint *dst, const char *in, const char *arg)
common internal api header.
common internal and external API header
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
struct AVCodecInternal * internal
Private context used for internal data.
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
#define av_malloc_array(a, b)
int( action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr)
static int thread_execute(AVCodecContext *avctx, action_func *func, void *arg, int *ret, int job_count, int job_size)
pthread_cond_t last_job_cond
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)