FFmpeg
libavcodec
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
30
typedef
struct
FFExecutor
FFExecutor
;
31
typedef
struct
FFTask
FFTask
;
32
33
struct
FFTask
{
34
FFTask
*
next
;
35
int
priority
;
// task priority should >= 0 and < AVTaskCallbacks.priorities
36
};
37
38
typedef
struct
FFTaskCallbacks
{
39
void
*
user_data
;
40
41
int
local_context_size
;
42
43
// how many priorities do we have?
44
int
priorities
;
45
46
// run the task
47
int (*
run
)(
FFTask
*t,
void
*local_context,
void
*
user_data
);
48
}
FFTaskCallbacks
;
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
*/
56
FFExecutor
*
ff_executor_alloc
(
const
FFTaskCallbacks
*
callbacks
,
int
thread_count);
57
58
/**
59
* Free executor
60
* @param e pointer to executor
61
*/
62
void
ff_executor_free
(
FFExecutor
**e);
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
*/
69
void
ff_executor_execute
(
FFExecutor
*e,
FFTask
*t);
70
71
#endif //AVCODEC_EXECUTOR_H
callbacks
static const OMX_CALLBACKTYPE callbacks
Definition:
omx.c:340
FFTaskCallbacks::priorities
int priorities
Definition:
executor.h:44
FFTaskCallbacks
Definition:
executor.h:38
FFTask
Definition:
executor.h:33
FFTaskCallbacks::user_data
void * user_data
Definition:
executor.h:39
FFExecutor
Definition:
executor.c:56
ff_executor_execute
void ff_executor_execute(FFExecutor *e, FFTask *t)
Add task to executor.
Definition:
executor.c:213
FFTask::next
FFTask * next
Definition:
executor.h:34
FFTask::priority
int priority
Definition:
executor.h:35
ff_executor_alloc
FFExecutor * ff_executor_alloc(const FFTaskCallbacks *callbacks, int thread_count)
Alloc executor.
Definition:
executor.c:156
FFTaskCallbacks::run
int(* run)(FFTask *t, void *local_context, void *user_data)
Definition:
executor.h:47
FFTaskCallbacks::local_context_size
int local_context_size
Definition:
executor.h:41
ff_executor_free
void ff_executor_free(FFExecutor **e)
Free executor.
Definition:
executor.c:202
Generated on Tue Dec 3 2024 19:21:34 for FFmpeg by
1.8.17