FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavfilter
dnn_interface.h
Go to the documentation of this file.
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
typedef
enum
{
DNN_SUCCESS
,
DNN_ERROR
}
DNNReturnType
;
30
31
typedef
enum
{
DNN_NATIVE
,
DNN_TF
}
DNNBackendType
;
32
33
typedef
struct
DNNData
{
34
float
*
data
;
35
int
width
,
height
,
channels
;
36
}
DNNData
;
37
38
typedef
struct
DNNModel
{
39
// Stores model that can be different for different backends.
40
void
*
model
;
41
// Sets model input and output, while allocating additional memory for intermediate calculations.
42
// Should be called at least once before model execution.
43
DNNReturnType
(*
set_input_output
)(
void
*
model
,
DNNData
*input,
DNNData
*output);
44
}
DNNModel
;
45
46
// Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.
47
typedef
struct
DNNModule
{
48
// Loads model and parameters from given file. Returns NULL if it is not possible.
49
DNNModel
*(*load_model)(
const
char
*model_filename);
50
// Executes model with specified input and output. Returns DNN_ERROR otherwise.
51
DNNReturnType
(*
execute_model
)(
const
DNNModel
*model);
52
// Frees memory allocated for model.
53
void
(*
free_model
)(
DNNModel
**model);
54
}
DNNModule
;
55
56
// Initializes DNNModule depending on chosen backend.
57
DNNModule
*
ff_get_dnn_module
(
DNNBackendType
backend_type);
58
59
#endif
DNNModel::model
void * model
Definition:
dnn_interface.h:40
DNNData::channels
int channels
Definition:
dnn_interface.h:35
DNNModel::set_input_output
DNNReturnType(* set_input_output)(void *model, DNNData *input, DNNData *output)
Definition:
dnn_interface.h:43
DNNBackendType
DNNBackendType
Definition:
dnn_interface.h:31
DNN_NATIVE
Definition:
dnn_interface.h:31
DNN_SUCCESS
Definition:
dnn_interface.h:29
DNN_ERROR
Definition:
dnn_interface.h:29
DNNData::height
int height
Definition:
dnn_interface.h:35
DNNModule::execute_model
DNNReturnType(* execute_model)(const DNNModel *model)
Definition:
dnn_interface.h:51
void
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
DNNReturnType
DNNReturnType
Definition:
dnn_interface.h:29
DNNData::width
int width
Definition:
dnn_interface.h:35
DNNData
Definition:
dnn_interface.h:33
DNNModule::free_model
void(* free_model)(DNNModel **model)
Definition:
dnn_interface.h:53
DNN_TF
Definition:
dnn_interface.h:31
DNNModule
Definition:
dnn_interface.h:47
DNNData::data
float * data
Definition:
dnn_interface.h:34
ff_get_dnn_module
DNNModule * ff_get_dnn_module(DNNBackendType backend_type)
Definition:
dnn_interface.c:31
DNNModel
Definition:
dnn_interface.h:38
Generated on Tue Nov 6 2018 18:11:21 for FFmpeg by
1.8.6