Go to the documentation of this file.
60 static void worker_func(
void *priv,
int jobnr,
int threadnr,
int nb_jobs,
int nb_threads)
66 ret =
c->func ?
c->func(avctx, (
char *)
c->args +
c->job_size * jobnr)
67 :
c->func2(avctx,
c->args, jobnr, threadnr);
91 c->job_size = job_size;
111 c->mainfunc = mainfunc;
119 void (*mainfunc)(
void *);
138 if (thread_count <= 1) {
int(* func)(AVBPrint *dst, const char *in, const char *arg)
#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF
Codec initializes slice-based threading with a main function.
void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
Execute slice threading.
void ff_slice_thread_free(AVCodecContext *avctx)
struct AVSliceThread AVSliceThread
static void main_function(void *priv)
const struct AVCodec * codec
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.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
static double(*const func2[])(void *, double, double)
struct AVCodecInternal * internal
Private context used for internal data.
static void worker_func(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static int thread_execute2(AVCodecContext *avctx, action_func2 *func2, 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)
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
int ff_slice_thread_init(AVCodecContext *avctx)
int av_codec_is_encoder(const AVCodec *codec)
int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2 *func2, main_func *mainfunc, void *arg, int *ret, int job_count)
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
int() main_func(AVCodecContext *c)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int() action_func2(AVCodecContext *c, void *arg, int jobnr, int threadnr)
main external API structure.
int active_thread_type
Which multithreading methods are in use by the 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() action_func(AVCodecContext *c, void *arg)
void avpriv_slicethread_free(AVSliceThread **pctx)
Destroy slice threading context.
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.