1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 /**
20 * @file
21 * DNN common functions different backends.
22 */
23
25
26 #define DNN_ASYNC_SUCCESS (void *)0
27 #define DNN_ASYNC_FAIL (void *)-1
28
30 {
31 if (!exec_params) {
34 }
35
39 }
40
44 }
45
47 // currently, the filter does not need multiple outputs,
48 // so we just pending the support until we really need it.
51 }
52
53 return 0;
54 }
55
57 if (task ==
NULL || exec_params ==
NULL || backend_model ==
NULL)
59 if (do_ioproc != 0 && do_ioproc != 1)
61 if (async != 0 && async != 1)
63
69 task->
model = backend_model;
72
74 }
75
76 /**
77 * Thread routine for async execution.
78 * @param args pointer to DNNAsyncExecModule module
79 */
81 {
83 void *request = async_module->
args;
84
87 }
90 }
91
93 {
95 if (!async_module) {
97 }
98 #if HAVE_PTHREAD_CANCEL
103 }
104 #endif
109 }
110
112 {
115
116 if (!async_module) {
119 }
120
121 #if HAVE_PTHREAD_CANCEL
126 }
131 }
132 #else
135 }
137 #endif
139 }
140
142 {
144
145 if (!task) {
147 }
148
151 }
152
157
159 }
160
162 {
165
167 if (!in_frame) {
170 }
171
173 if (!out_frame) {
177 }
178
179 in_frame->
width = input_width;
180 in_frame->
height = input_height;
183
185 }