History

dnn_interface: add interface to support async execution

Guo, Yejun committed 5 years ago

Commit 39f5cb41 parent 38089922 files · +13 −1Browse files

Unified · Split

2 files
  1. libavfilter/dnn/dnn_interface.c +1 −1
  2. libavfilter/dnn_interface.h +12 −0
libavfilter/dnn/dnn_interface.c+1−1
@@ -33,7 +33,7 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type) · 32 unmodified lines
33{33{
34 DNNModule *dnn_module;34 DNNModule *dnn_module;
35 35
36 dnn_module = av_malloc(sizeof(DNNModule));36 dnn_module = av_mallocz(sizeof(DNNModule));
37 if(!dnn_module){37 if(!dnn_module){
38 return NULL;38 return NULL;
39 }39 }
libavfilter/dnn_interface.h+12−0
@@ -35,6 +35,13 @@ typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType; · 34 unmodified lines
35 35
36typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;36typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
37 37
38typedef enum {
39 DAST_FAIL, // something wrong
40 DAST_EMPTY_QUEUE, // no more inference result to get
41 DAST_NOT_READY, // all queued inferences are not finished
42 DAST_SUCCESS // got a result frame successfully
43} DNNAsyncStatusType;
44
38typedef struct DNNData{45typedef struct DNNData{
39 void *data;46 void *data;
40 DNNDataType dt;47 DNNDataType dt;
@@ -69,6 +76,11 @@ typedef struct DNNModule{ · 28 unmodified lines
69 // Executes model with specified input and output. Returns DNN_ERROR otherwise.76 // Executes model with specified input and output. Returns DNN_ERROR otherwise.
70 DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame,77 DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame,
71 const char **output_names, uint32_t nb_output, AVFrame *out_frame);78 const char **output_names, uint32_t nb_output, AVFrame *out_frame);
79 // Executes model with specified input and output asynchronously. Returns DNN_ERROR otherwise.
80 DNNReturnType (*execute_model_async)(const DNNModel *model, const char *input_name, AVFrame *in_frame,
81 const char **output_names, uint32_t nb_output, AVFrame *out_frame);
82 // Retrieve inference result.
83 DNNAsyncStatusType (*get_async_result)(const DNNModel *model, AVFrame **out);
72 // Frees memory allocated for model.84 // Frees memory allocated for model.
73 void (*free_model)(DNNModel **model);85 void (*free_model)(DNNModel **model);
74} DNNModule;86} DNNModule;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t