65 static void worker_func(
void *priv,
int jobnr,
int threadnr,
int nb_jobs,
int nb_threads)
71 ret =
c->func ?
c->func(avctx, (
char *)
c->args +
c->job_size * jobnr)
72 :
c->func2(avctx,
c->args, jobnr, threadnr);
84 for (
i = 0;
i <
c->thread_count;
i++) {
105 c->job_size = job_size;
125 c->mainfunc = mainfunc;
133 void (*mainfunc)(
void *);
152 if (thread_count <= 1) {
190 if (!entries || !field)
return;
195 while ((entries[field - 1] - entries[field]) <
shift){
static double(*const func2[])(void *, double, double)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
common internal and external API header
#define pthread_mutex_lock(a)
#define pthread_mutex_unlock(a)
int av_codec_is_encoder(const AVCodec *codec)
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF
Codec initializes slice-based threading with a main function.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
common internal API header
Memory handling functions.
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
void ff_reset_entries(AVCodecContext *avctx)
static void worker_func(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
void ff_slice_thread_free(AVCodecContext *avctx)
int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2 *func2, main_func *mainfunc, void *arg, int *ret, int job_count)
static int thread_execute(AVCodecContext *avctx, action_func *func, void *arg, int *ret, int job_count, int job_size)
int ff_alloc_entries(AVCodecContext *avctx, int count)
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
int() main_func(AVCodecContext *c)
int ff_slice_thread_init(AVCodecContext *avctx)
static int thread_execute2(AVCodecContext *avctx, action_func2 *func2, void *arg, int *ret, int job_count)
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
static void main_function(void *priv)
int() action_func2(AVCodecContext *c, void *arg, int jobnr, int threadnr)
int() action_func(AVCodecContext *c, void *arg)
typedef void(RENAME(mix_any_func_type))
void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
Execute slice threading.
int avpriv_slicethread_create(AVSliceThread **pctx, void *priv, void(*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), void(*main_func)(void *priv), int nb_threads)
Create slice threading context.
void avpriv_slicethread_free(AVSliceThread **pctx)
Destroy slice threading context.
struct AVSliceThread AVSliceThread
static int shift(int a, int b)
main external API structure.
int active_thread_type
Which multithreading methods are in use by the codec.
const struct AVCodec * codec
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 thread_count
thread count is used to decide how many independent tasks should be passed to execute()
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.
struct AVCodecInternal * internal
Private context used for internal data.
int caps_internal
Internal codec capabilities.
pthread_mutex_t * progress_mutex
pthread_cond_t * progress_cond
#define av_malloc_array(a, b)