1 /*
2 * Copyright (c) 2018 Sergey Lavrushkin
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 * @file
23 * DNN inference engine interface.
24 */
25
26 #ifndef AVFILTER_DNN_INTERFACE_H
27 #define AVFILTER_DNN_INTERFACE_H
28
29 #include <stdint.h>
32
33 #define DNN_GENERIC_ERROR FFERRTAG('D','N','N','!')
34
40
42
48
55
62
68
72 // dt and order together decide the color format
79
87
92
96
98 // Stores FilterContext used for the interaction between AVFrame and DNNData
100 // Stores function type of the model
102 // Gets model input information
103 // Just reuse struct DNNData here, actually the DNNData.data field is not needed.
105 // Gets model output width/height with given input w/h
107 const char *output_name, int *output_width, int *output_height);
108 // set the pre process to transfer data from AVFrame to DNNData
109 // the default implementation within DNN is used if it is not provided by the filter
111 // set the post process to transfer data from DNNData to AVFrame
112 // the default implementation within DNN is used if it is not provided by the filter
114 // set the post process to interpret detect result from DNNData
116 // set the post process to interpret classify result from DNNData
119
122
125
128
135
140
142
145
147
154
158
161
162 #if CONFIG_LIBTENSORFLOW
164 #endif
165
166 #if CONFIG_LIBOPENVINO
168 #endif
169 #if CONFIG_LIBTORCH
171 #endif
173
174 // Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.
178 // Loads model and parameters from given file. Returns NULL if it is not possible.
180 // Executes model with specified input and output. Returns the error code otherwise.
182 // Retrieve inference result.
184 // Flush all the pending tasks.
186 // Frees memory allocated for model.
188 };
189
190 // Initializes DNNModule depending on chosen backend.
192
196
198 {
200 }
201
203 {
205 }
206
208 {
210 }
211
212 #endif