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
26
27 #define DNN_ASYNC_SUCCESS (void *)0
28 #define DNN_ASYNC_FAIL (void *)-1
29
31 {
32 if (!exec_params) {
35 }
36
40 }
41
45 }
46
47 return 0;
48 }
49
51 if (task ==
NULL || exec_params ==
NULL || backend_model ==
NULL)
53 if (do_ioproc != 0 && do_ioproc != 1)
55 if (async != 0 && async != 1)
57
63 task->
model = backend_model;
66
67 return 0;
68 }
69
70 /**
71 * Thread routine for async execution.
72 * @param args pointer to DNNAsyncExecModule module
73 */
75 {
77 void *request = async_module->
args;
78
81 }
84 }
85
87 {
89 if (!async_module) {
91 }
92 #if HAVE_PTHREAD_CANCEL
97 }
98 #endif
102 return 0;
103 }
104
106 {
109
110 if (!async_module) {
113 }
114
115 #if HAVE_PTHREAD_CANCEL
120 }
125 }
126 #else
130 }
132 #endif
133 return 0;
134 }
135
137 {
139
140 if (!task) {
142 }
143
146 }
147
152
154 }
155
157 {
160
162 if (!in_frame) {
165 }
166
168 if (!out_frame) {
172 }
173
174 in_frame->
width = input_width;
175 in_frame->
height = input_height;
178
180 }