FFmpeg
Loading...
Searching...
No Matches
executor.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Nuo Mi
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/*
22 * We still need several refactors to improve the current VVC decoder's performance,
23 * which will frequently break the API/ABI. To mitigate this, we've copied the executor from
24 * avutil to avcodec. Once the API/ABI is stable, we will move this class back to avutil
25 */
26
27#ifndef AVCODEC_EXECUTOR_H
28#define AVCODEC_EXECUTOR_H
29
30typedef struct FFExecutor FFExecutor;
31typedef struct FFTask FFTask;
32
33struct FFTask {
35 int priority; // task priority should >= 0 and < AVTaskCallbacks.priorities
36};
37
38typedef struct FFTaskCallbacks {
39 void *user_data;
40
42
43 // how many priorities do we have?
45
46 // run the task
47 int (*run)(FFTask *t, void *local_context, void *user_data);
49
50/**
51 * Alloc executor
52 * @param callbacks callback structure for executor
53 * @param thread_count worker thread number, 0 for run on caller's thread directly
54 * @return return the executor
55 */
56FFExecutor* ff_executor_alloc(const FFTaskCallbacks *callbacks, int thread_count);
57
58/**
59 * Free executor
60 * @param e pointer to executor
61 */
63
64/**
65 * Add task to executor
66 * @param e pointer to executor
67 * @param t pointer to task. If NULL, it will wakeup one work thread
68 */
70
71#endif //AVCODEC_EXECUTOR_H
FFExecutor * ff_executor_alloc(const FFTaskCallbacks *callbacks, int thread_count)
Alloc executor.
Definition executor.c:156
void ff_executor_execute(FFExecutor *e, FFTask *t)
Add task to executor.
Definition executor.c:213
void ff_executor_free(FFExecutor **e)
Free executor.
Definition executor.c:202
int local_context_size
Definition executor.h:41
void * user_data
Definition executor.h:39
int(* run)(FFTask *t, void *local_context, void *user_data)
Definition executor.h:47
int priority
Definition executor.h:35
FFTask * next
Definition executor.h:34